Mesh Instancing with nested hierarchy

Hey Guys,

I’m importing a model with nested hierarchy which has multiple assemblies and parts in it.
Also there are few parts and assemblies which are reused throughout the model. So for the same parts I want to use the instancing functionality to reduce the draw calls. Following is the hierarchy of the model,

-Scene

  • cubePart(Object3D)
    - cubeMesh (Mesh)
  • cubePart(Object3D)
    - cubeMesh (Mesh)

So during adding the first “cubePart” I have created a instanced mesh using the cubeMesh geometry and material and maintained that instanced mesh it in a “list”.

For loading the second “cubePart” I have just cloned the first “cubePart” and removed normal mesh from it and added the instanced mesh by accessing it from the list.

So the problem here is I’m unable to see the instanced meshes in scene as it is not visible although I can see its existence in scene by using console.

Could you please help me with how can I resolve this issue? Any example for reference would be really helpful.

I used .worldMatrix property in this example for hierarchical structure of fingers:

Phalanxes are single InstancedMesh of a custom capsule geometry.

Hi,

Thanks for the reply. I’m able to load the hierarchy with instanced meshes.