Simplify not replacing meshes at given distances for loaded gltf model

I need to use simplify to improve performance when rendering a large scene that uses many GLB models. I make heavy use of instances, so I need Auto-LOD to work with instances. Everything seems to work correctly, the simplification is successful and the simplified models are created (we can find them using mesh.getLODLevelAtDistance(d: number)).

However, when the scene is rendered, the instances always use the complete mesh, at any distance.
I tried using a simple sphere instead (created using MeshBuilder.CreateSphere) and both the original and the instances correctly swap between the complete and decimated meshes.

Here is a playground with a reproduction: https://playground.babylonjs.com/#WGZLGJ#9671

Welcome aboard!

You must attach instances to the same parent as the base mesh, because when a glTF is loaded, a special root node is created, which makes the determinant of the child-world matrix negative, whereas the determinant is positive for instances because they have no parent :

As an alternative, you can also set scene.useRightHandedSystem = true because the special root node will have the identity matrix in this case:

1 Like

Thank you!