In this playground I’m loading in a map (gltf file), and it’s embedded with 20008 rock instanced meshes and 2858 pine tree foliage meshes, and 1429 tree trunk meshes.
I loop through all of the embedded meshes, and replace them with thin instances. I used the _worldMatrix of each of the instanced meshes as source of each thin instance like so:
m._localMatrix.copyToArray(pineLeaves.matricesData, i * 16)
I don’t see anything of the thin instances rendering though, and I’m not sure where I’m going wrong.
You don’t see the rocks because
meshes is not a rock but a leaf. You should use
meshes instead for the rock root.
You need to reset the transformations of the root node, else it will be applied to all the thin instances.
Also, at least for the rocks, there are some transformations that have a positive determinant and others with a negative determinant. It’s more difficult to convert them to thin instances because you would need two roots, one for each case. It’s easier to switch the scene to a right handed system (
scene.useRightHandedSystem = true;) so that you end up only with positive determinants for all meshes:
Understood, I used Blender to create three separate particle systems - and you’re saying that because Blender uses a right handed coordinate system I need to switch babylon’s scene to that mode as well. I think I’ve tried using negative scaling in the past to achieve reflection transformations, and that did not work and now I know why. THANK YOU!!
Also, the scene in the pg you linked maintains a steady 60 fps even with while rendering 20k+ thin instances that is amazing!
@Evgeni_Popov you rock !!!