LOD works on a specific distance only

Hi everyone, I have LOD enabled for instances in my game, it basically just 2 distances that I use, one to load a lower res model and another is null to not load anything farther away.

it’s pretty much set up like this:

highresmodel.addLODLevel(15, lowresmodel);
highresmodel.addLODLevel(50, null);

I first specified those values as 15 and 50, it all worked very well but the low poly model was kicking in too close to the camera, so all I did is just changing values to 20 and 50, but now everything pretty much behaves as if both 20 and 50 is null without anything after the distance of 20 showing up.

I’ll be creating a playground demo shortly trying to replicate this issue, but any idea why this behaviour could happen in the first place? Could the way the models are loaded be the case?

Thanks!

Quite strange, I don’t see anything in the code that could explain this.

The LOD mesh is retrieved according to the distance between the camera and the center of the bounding sphere, so if you messed up the bounding sphere in some way, it may fail the LOD lookup, but else…

Thanks a lot! I was indeed messing with the bounding sphere, but had no idea it affected the LOD mesh.

I was using mesh.doNotSyncBoundingInfo = true; as outlined here Optimize your scene - Babylon.js Documentation but it said nothing about this aspect, nor does the “how to” on LOD. All fixed now, and great to learn how it works internally, many thanks again.