[SOLVED] How does LoD work?

Hello guys.
I was wondering how LoD works on jme, I’m not referring to the generator but how the engine switches from the high-poly mesh to the first lod level and from it to another one.
I thought it would replace the entire geometry with the LoD one, inside the update of the LodControl, but I read the source and it seems it’s doing something more sophisticated, but I’m not sure what.
I hope someone can enlighten me.

Lod in Jme doesn’t change the mesh at all. A mesh is mainly a position buffer and an index buffer. The position buffer holds the positions of all vertices in the mesh, the index buffer drives how those vertices should be connected to form triangles.
And here is the subtlety, only the vertices referenced in the index buffer will be rendered.

LOD takes advantage of this by creating several index buffers that connects vertices in a different way. So you don’t switch meshes when changing a LOD level, you switch index buffers.
That’s what the LODControl does.

1 Like
@nehon said: Lod in Jme doesn't change the mesh at all. A mesh is mainly a position buffer and an index buffer. The position buffer holds the positions of all vertices in the mesh, the index buffer drives how those vertices should be connected to form triangles. And here is the subtlety, only the vertices referenced in the index buffer will be rendered.

LOD takes advantage of this by creating several index buffers that connects vertices in a different way. So you don’t switch meshes when changing a LOD level, you switch index buffers.
That’s what the LODControl does.

Thanks nehon, now everything makes sense.