[SOLVED] Levels of details

Hello all,

Some of my 3D models are detailed are starts to trigger lag, especially when you see all of them from distance.
In a previous technology i used, i used to make Levels of Details like this:

  • Close to the model, the most detailed model is shown, like a detailed house.
  • At like 50 meters, it’s less detailed, for instance you can’t see a house’s interior but exterior is still detailed.
  • At 300 meters, the house’s model become only a few faces.
    I to all the models, and i tell the engine which one to display at which distance.

I looked at JME’s LOD, but i’ve seen only an auto generated one which alter meshes, i didn’t found a model-based LOD.

So here are my questions:

  • Is there a way to manually do LOD by selecting the different models and distance ?
  • If not, at least is there a “switch” node mecanism ? (a node which have several childrens and you programmatically choose which one is displayed).

And another question a bit off JME:

  • My modeling software’s exporter is a bit dumb : it generate lots of small meshs instead of grouping the faces by texture, it’s not practical for auto generated LOD.
    Which external tools can be used to just “regroup” the different meshs which share the same texture ?

Thanks in advance,

Ga3L

@pspeed made an LODSwitchControl for his tree generator (SimArboreal Editor) which works exactly that way, although I haven’t tried creating one manually outside of his editor - but I imagine it shouldn’t be hard to modify to work to your specific needs

If they all share the same material, then you should be able to batch them into a single geometry by using the SDK Scene Editor’s batching tool.

To do this in the SDK’s scene editor, just select the parent Node that contains your split meshes/geometries, and then right click and press “batch geometries”

Also, the lag might improve after you batch all of your split meshes back together. The total object/geometry count for your scene will have a much higher impact on your FPS than the triangle count, (so having a scene with 10,000 small objects and 100k tris will actually be much much slower than a scene with 100 objects and 100k tris, despite having the same triangle and vertex count)

JME has a built in LOD control that works with LOD in the Mesh itself if present. I think it even has a tool in the SDK to generate the LOD levels.

I guess you can manually set LOD meshes that you generated in a 3D modeling software like Blender. You need to get the index buffer of those LOD meshes and pass them into the following method:

Then LodControl will use them to switch LODs.

Thanks everyone for the answers !

@yaRnMcDonuts The LodSwitchControl is what i searched, so i see it’s based on Culling mecanism, now i can easily make similar mecanism on my own !

Also the batching tool work like a charm ! I was searching for external tools but i didn’t knew JME’s IDE itself was doing it the way i wanted, great discovery !

Also i know about the existence of mesh-based built-in LODs but it wasn’t adapted in my case, as i have some objects composed of several materials.

1 Like