J3o lod generate

hello i learn Level of Detail (LOD) Optimization :: jMonkeyEngine Docs

but can’t generate lod for models
because have error open gl context not started
and
i cant generate in code because i load spatial and lod generator need geometry
(cant cast spatial to geometry)

Please help generate lod for 2 files

lod loader will work with j3o?
or you need to somehow convert the spatial to geometry?

make this, work without errors:

       Node sceneNode = (Node)rootNode.getChild("Plane");

       Geometry sceneGeometry = (Geometry)sceneNode.getChild(0);
       LodGenerator lod = new LodGenerator(sceneGeometry);
       lod.bakeLods(LodGenerator.TriangleReductionMethod.PROPORTIONAL,0.25f, 0.5f, 0.75f);
       LodControl lc = new LodControl();
       sceneGeometry.addControl(lc);

it right?
but i have big model of level and not understand work it or no (i theory level is always near)

Using the LodGenerator on something as large as a level is probably not a good idea (or its intended use).
As you say, the level will always be near enough to not actually lod. You can try by moving the camera far away.
But in my experience, the LodGenerator will probably not handle objects as complex as a level very well.

If you break it up into sections, buildings, etc, and they’re far way, then maybe.

2 Likes