Hi I made these plants in Blender using geometry nodes. I exported the glb using this tool GitHub - takahirox/glTF-Blender-IO-EXT-mesh-gpu-instancing which creates from the geometry node instanced meshes and when loading the glb it works and I see all my clones in the same position as my 3d in blender. I also created a shader to move the plants but when I apply it to the glb with the instances I don’t see all my clones but I only see the original plant with my shader applied, so it’s like I lost the references to all the instances when apply my shader and it work only for the original plant. If I do a console log of the glb however I see the instancematrix attribute whit the instacemesh and also on the material I see that the shader was applied… What can I do to recreate the same configuration I had in blender but with a shader applied on all instances?
Looking at your scene,this is first example that came to my mind:
If by “shader configuration”, you mean the Shader uniforms, as far as I know, you can’t set the uniforms of each instance individually, at least not with a normal ThreeJS setup. You can only update the transformation Matrix and the color vertices (with no alpha).
You can try the Troika’s InstancedUniformsMesh, it extends Three.js’s InstancedMesh
to allow its material’s shader uniforms to be set individually per instance.
mesh.setUniformAt(uniformName, instanceIndex, value)
The last time I tried it, it worked fine for me, not sure if it’s still up to date.
Ok thank you for this useful example. Do you have any useful info also about being able to place the instances as in the figure I attached earlier, so in three different places in the scene?