[x3d-public] How to implement glTF EXT_mesh_gpu_instancing?!

John Carlson yottzumm at gmail.com
Sun Apr 21 08:00:20 PDT 2024


Sorry, biffed it:


https://coderextreme.net/X3DJSONLD/src/main/html/bumpyrefs.html

On Sun, Apr 21, 2024 at 9:55 AM John Carlson <yottzumm at gmail.com> wrote:

> Interesting.  Can I instance based on another shader, like:
>
> https://coderextreme.net/src/main/html/bumpyrefs.html
>
> Say I want to animate thousands if the these:
>
> https://coderextreme.net/X3DJSONLD/src/main/html/flowers.xhtml
>
>
> On Sun, Apr 21, 2024 at 6:36 AM Holger Seelig via x3d-public <
> x3d-public at web3d.org> wrote:
>
>> How to implement glTF EXT_mesh_gpu_instancing?!
>>
>> When looking through the glTF sample models, sooner or later you will
>> stumble across an example and this extension.
>>
>>
>> https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing
>>
>> https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/SimpleInstancing
>>
>> The simplest idea to implement this, which I did, was to generate a lot
>> of Transform nodes (one for each instance) and clone the shapes or geometry
>> nodes. But this runs counter to the name of the extension (GPU). Especially
>> if you create thousands of transform nodes for a shape with a geometry with
>> only a few polygons. The extension is made to clone a lot of objects, e.g.
>> a leaf on a tree, which then reappears in many places on the tree, only
>> with different transformations, and everything should be calculated in one
>> pass by the GPU.
>>
>> The second idea I had was to somehow incorporate the transformations
>> (translation, rotation, scale) for each instance into the X3DGeometryNode
>> nodes. However, this would have meant changing all of these nodes. So I
>> discarded this for the time being and postponed it.
>>
>> Then I came up with the idea of why add it to the geometry nodes when you
>> could invent a new shape node. So the idea of "InstancedShape" grew:
>>
>> Documentation of InstancedShape in X_ITE with example at the bottom of
>> the page (2500 instances, 2,160,040 triangles):
>> https://create3000.github.io/x_ite/components/x-ite/instancedshape/
>>
>> InstancedShape : X3DShapeNode {
>>    # ... inherited fields
>>    MFVec3f [in,out] translations [] #
>>    MFRotation [in,out] rotations [] # list of rotations, one for each
>> instance
>>    MFVec3f [in,out] scales [] # list of scales, one for each instance
>>    # List of translations, rotations, scales; one for each instance.
>>    # If only one value is provided, it is provided to each instance
>> equivalently.
>> }
>>
>> The advantage is that the geometry nodes do not have to be changed, and
>> the same functions could be used to implement these nodes that were already
>> available for ParticleSystem nodes with some trivial additions.
>>
>> Examples to see InstancedShape node in action, all files are in glTF or
>> GLB format converted to X3D:
>>
>> Simple Instancing (125 instances, 1,500 triangles):
>>
>> https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/SimpleInstancing/glTF/SimpleInstancing.gltf
>>
>> Teapots Galore (958 instances, 7,725,314 triangles):
>>
>> https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/KhronosGroup/glTF/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/samples/teapots_galore/teapots_galore.gltf
>>
>> Fur Instancing (10,000 instances, 3,200,000 triangles):
>>
>> https://create3000.github.io/x_ite/playground/?url=https://create3000.github.io/media/glTF/FurInstancing/FurInstancing.glb
>>
>> 3D Tiles (10 instances, 120 triangles):
>>
>> https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/main/glTF/GpuInstancesMetadata/GpuInstancesMetadata.gltf
>>
>> Forest (100 instances, 21,400 triangles):
>>
>> https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/bertt/cesium_3dtiles_samples/master/samples/1.1/forest/forest.glb
>>
>> How do you do that, do you? Maybe we could consider this for a future X3D
>> version.
>>
>> Make X3D even better!
>> Best regards,
>> Holger
>>
>> --
>> Holger Seelig
>> Leipzig, Germany
>>
>> holger.seelig at yahoo.de
>> https://create3000.github.io/x_ite/
>>
>> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20240421/676cad75/attachment-0001.html>


More information about the x3d-public mailing list