<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>How to implement glTF EXT_mesh_gpu_instancing?!</div><div><br></div><div>When looking through the glTF sample models, sooner or later you will stumble across an example and this extension.</div><div><br></div><div>https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing</div><div>https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/SimpleInstancing</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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:</div><div><br></div><div>Documentation of InstancedShape in X_ITE with example at the bottom of the page (2500 instances, 2,160,040 triangles):</div><div>https://create3000.github.io/x_ite/components/x-ite/instancedshape/</div><div><br></div><div>InstancedShape : X3DShapeNode {</div><div>   # ... inherited fields</div><div>   MFVec3f [in,out] translations [] #</div><div>   MFRotation [in,out] rotations [] # list of rotations, one for each instance</div><div>   MFVec3f [in,out] scales [] # list of scales, one for each instance</div><div>   # List of translations, rotations, scales; one for each instance.</div><div>   # If only one value is provided, it is provided to each instance equivalently.</div><div>}</div><div><br></div><div>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.</div><div><br></div><div>Examples to see InstancedShape node in action, all files are in glTF or GLB format converted to X3D:</div><div><br></div><div>Simple Instancing (125 instances, 1,500 triangles):</div><div>https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/SimpleInstancing/glTF/SimpleInstancing.gltf</div><div><br></div><div>Teapots Galore (958 instances, 7,725,314 triangles):</div><div>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</div><div><br></div><div>Fur Instancing (10,000 instances, 3,200,000 triangles):</div><div>https://create3000.github.io/x_ite/playground/?url=https://create3000.github.io/media/glTF/FurInstancing/FurInstancing.glb</div><div><br></div><div>3D Tiles (10 instances, 120 triangles):</div><div>https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/main/glTF/GpuInstancesMetadata/GpuInstancesMetadata.gltf</div><div><br></div><div>Forest (100 instances, 21,400 triangles):</div><div>https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/bertt/cesium_3dtiles_samples/master/samples/1.1/forest/forest.glb</div><div><br></div><div>How do you do that, do you? Maybe we could consider this for a future X3D version.</div><div><br></div><div>Make X3D even better!</div><div>Best regards,</div><div>Holger</div><div><br></div><div>
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="text-align: start; text-indent: 0px; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">--</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">Holger Seelig</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">Leipzig, Germany</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;"><br></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">holger.seelig@yahoo.de</div><div>https://create3000.github.io/x_ite/</div></div></div></div></div></div></div>
</div>

<br></body></html>