<div dir="auto">From what I saw of X_ITE code, I could create a particle systems physics model that could use one or more variables in a shader to introduce parameters.  But I don’t know if the physics model is for all instances or one instance, so I’m questioning if this is possible.</div><div dir="auto"><br></div><div dir="auto">It would seem like x3d_ParticleMatrix is at an instance level, along with a couple of other variables.</div><div dir="auto"><br></div><div dir="auto">Maybe something like an InstancedShape could be used instead of a particle system.</div><div dir="auto"><br></div><div dir="auto">Say the object i want to morph is a sphere, and I have an SFVec4f per sphere.  I can use rotations for the other 2 variables.</div><div dir="auto"><br></div><div dir="auto">This seems much more doable than a particle system.</div><div dir="auto"><br></div><div dir="auto">But I would also like to use a ParticleMatrix to position the instance or particle in space.</div><div dir="auto"><br></div><div dir="auto">Feedback welcome!</div><div dir="auto"><br></div><div dir="auto">John</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2024 at 10:23 AM John Carlson <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="auto">Makes me wonder if I could target individual instances using a new attribute or field, “toIndex” on ROUTEs, targeting a particular translation, scale or rotation in an MF field of InstanceShape.</div><div dir="auto"><br></div><div dir="auto">Sorry for spew of emails.</div><div dir="auto"><br></div><div dir="auto">John </div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2024 at 6:36 AM Holger Seelig via x3d-public <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div style="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><a href="https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing" target="_blank">https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing</a></div><div><a href="https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/SimpleInstancing" target="_blank">https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/SimpleInstancing</a></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><a href="https://create3000.github.io/x_ite/components/x-ite/instancedshape/" target="_blank">https://create3000.github.io/x_ite/components/x-ite/instancedshape/</a></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><a href="https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/SimpleInstancing/glTF/SimpleInstancing.gltf" target="_blank">https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/SimpleInstancing/glTF/SimpleInstancing.gltf</a></div><div><br></div><div>Teapots Galore (958 instances, 7,725,314 triangles):</div><div><a href="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" target="_blank">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</a></div><div><br></div><div>Fur Instancing (10,000 instances, 3,200,000 triangles):</div><div><a href="https://create3000.github.io/x_ite/playground/?url=https://create3000.github.io/media/glTF/FurInstancing/FurInstancing.glb" target="_blank">https://create3000.github.io/x_ite/playground/?url=https://create3000.github.io/media/glTF/FurInstancing/FurInstancing.glb</a></div><div><br></div><div>3D Tiles (10 instances, 120 triangles):</div><div><a href="https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/main/glTF/GpuInstancesMetadata/GpuInstancesMetadata.gltf" target="_blank">https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/main/glTF/GpuInstancesMetadata/GpuInstancesMetadata.gltf</a></div><div><br></div><div>Forest (100 instances, 21,400 triangles):</div><div><a href="https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/bertt/cesium_3dtiles_samples/master/samples/1.1/forest/forest.glb" target="_blank">https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/bertt/cesium_3dtiles_samples/master/samples/1.1/forest/forest.glb</a></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="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;line-break:after-white-space;color:rgb(0,0,0)"><div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;line-break:after-white-space;color:rgb(0,0,0)"><div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;line-break:after-white-space;color:rgb(0,0,0)"><div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;line-break:after-white-space;color:rgb(0,0,0)"><div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;line-break:after-white-space;color:rgb(0,0,0)"><div dir="auto" style="text-align:start;text-indent:0px;line-break:after-white-space"><div style="letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)">--</div><div style="letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)">Holger Seelig</div><div style="letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)">Leipzig, Germany</div><div style="letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)"><br></div><div style="letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(0,0,0)"><a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a></div><div><a href="https://create3000.github.io/x_ite/" target="_blank">https://create3000.github.io/x_ite/</a></div></div></div></div></div></div></div>
</div>

<br></div>_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div></div>
</blockquote></div></div>