LoD for scene objects

Hi, I’m trying to implement LoD for all scene models/objects. I wanna do it by code - automatically generating LoD levels in code.

Here’s my code which seems doesnt work, dunno why:
[java]
for (Spatial spatial : map.getChildren()) {
if (spatial instanceof Geometry) {
listGeoms.add((Geometry) spatial);
}
}
reductionvalue = 0.25f;
lodLevel = 1;
for (final Geometry geometry : listGeoms) {
LodGenerator lodGenerator = new LodGenerator(geometry);
lodGenerator.bakeLods(LodGenerator.TriangleReductionMethod.PROPORTIONAL, reductionvalue);
//geometry.setLodLevel(lodLevel);
LodControl lc = new LodControl();
geometry.addControl(lc);
}
[/java]

How many lod levels are generated?
What does your model looks like?
The lod generator will fail on some models that are triangulated.

How many lod levels are generated?
Do I have also set LoD in Scene Composer for each model?
What does your model looks like?
I got alot of buildings,trees etc on my map

Also, do I have to batch geometry first?

any 1 know whats wrong?

Answer my questions. I mean really, not answering with another question.
once you called the bakeLods method, how many lod levels are there in the geometry ?(you can fetch them doing geom.getLodLevel()

Post a picture of your models in wireframe mode

Hmm, dunno what’s going on. I call generateLod method but there isn’t any prints from Syste.out.

[java] private void generateLoD(Node map) {
for (Spatial spatial : map.getChildren()) {
if (spatial instanceof Geometry) {
listGeoms.add((Geometry) spatial);
}
}
reductionvalue = 0.25f;
lodLevel = 1;
for (final Geometry geometry : listGeoms) {
LodGenerator lodGenerator = new LodGenerator(geometry);
lodGenerator.bakeLods(LodGenerator.TriangleReductionMethod.PROPORTIONAL, reductionvalue);
System.out.println(geometry.getLodLevel());
LodControl lc = new LodControl();
geometry.addControl(lc);
}
System.out.println(listGeoms);
}[/java]

Post a picture of your models in wireframe mode

on example 1 like that:

Have you tried stepping through generateLoD() using a debugger?

No I haven’t. I need also generate LoDs in Scene Composer? And later use code? Because all seems be ok, but still 0 effect …