[Solved] LOD Levels and their distances

I must be missing something with the LOD Control or else I’m just really dense (probably the later).

        LodControl lc = new LodControl();
        
        LodGenerator lod = new LodGenerator(astGeo);
        lod.bakeLods(LodGenerator.TriangleReductionMethod.PROPORTIONAL,0.9f);
        
        
        astGeo.addControl(lc);
        
        
        rootNode.attachChild(astGeo);

This works well and adjusts nicely when it does switch even when I change the reduction value to 0.1f or whatever.

Cool.

I’d have thought though that there’d be multiple “distances” out from the camera where the detail of the provided mesh would decrease. The documentation indicates there are multiple LOD levels but for the life of me I’m unsure as to how to invoke them. Even looking at the TestLodStress.java I’m a bit at a loss.

Is there another class I can look at to give me the hint or some nugget of wisdom that’ll lead me set me right?

Thanks!

I’m probably not the best to answer, but I think the .bakeLods() method is used for a one time reduction, so maybe you could check the object distance manually and set the reduction value based on the distance.

Otherwise the only way I know to set different reduction levels for different distances is through the SDK’s Lod generator in the scene composer, or through blender when you make the model, but I’m not sure how to achieve the same results on a generated model and LodControll with code.

1 Like

Not sure if I can help but I would generate LODs in the SDK. There you can directly view the various LODs.
By the way, I personally had better experience with the CONSTANT mode instead of PROPORTIONAL.

2 Likes

The thing is that you are generating just ONE lod level. If you want more lod levels you must specify more reduction values:

lod.bakeLods(LodGenerator.TriangleReductionMethod.PROPORTIONAL, .9f, .5f, .3f);
2 Likes

Also, you can do it from GUI in SS Editor :wink:

2 Likes

Ah that did the multiple reduction values part. Thanks!

Any idea how to set the distances for each reduction value? The first reduction happens an awful long ways out.

Egad you are relentless :wink: I don’t think SS Editor would work in my case. Everything I’m doing is procedural. So the mesh along with it’s location is random(ish). Although I probably will be using it for figuring out the Shaders I want to use.

Take a look at LodControl’s options. If you need something different you can make your own lod control (looking the LodControl’s source may help here).

(There is some info in the wiki about this too.)

1 Like

do you mean shader nodes?

Yes. That. Sorry still waking up here.

Excellent. Thanks!

I think I might submit an update to that article once I’m done figuring it out on my end. I think it could be a titch clearer.

1 Like