Removing LOD levels for instances

I have a mesh which I instance many times with createInstance(). In the docs, it says that I only have to set LOD for the baseMesh, and the instances will have the same LODs. This works perfectly.

Now, I want to be able to show a mesh even if it is outside the highest LOD-distance. For this, I tried (myInstancedMesh as BABYLON.Mesh).removeLODLevel(null). However, this throws an error saying removeLODLevel doesn’t exist on myInstancedMesh. Can I only have one set of LODLevels for all my instanced meshes or am I doing something different wrong?
When I change instance to clone, I ofc have to add the LODLevels for all the clones, but after that it works as expected.

Another (un/semi-related) thing I tried is adding LODLevels to thinInstances. It didn’t work, they just disappeared entirely from the scene. I googled it and found this forum post, which says that thinInstances don’t support LOD at all. However, it’s the only thing I found relating LOD and thinInstances. Would it make sense to mention this in the doc article for LOD

You need to do it only on the main mesh I believe but a playground would really help us help you here.

adding @PirateJC for the doc part.

Yeah I think I was a bit too tired yesterday or something, I should have checked the API before coming here. I was trying to call removeLODLevel() on an InstancedMesh, which doesn’t exist but somehow I was convinced it did exist.

Basically, I need to have different LOD levels for some of my instances, which doesn’t seem possible, so I’ve now changed them from instances to clones and it works perfectly.

2 Likes