truman
October 20, 2010, 9:16pm
1
I’ve a problem with TerrainLodControl in TerrainTest
[java]…
terrain = new TerrainQuad(“terrain”, map+1, 513, heightMap.getHeightMap());
List cameras = new ArrayList();
cameras.add(getCamera());
TerrainLodControl control = new TerrainLodControl(terrain, cameras);
terrain.addControl(control);
terrain.setMaterial(matRock);
terrain.setModelBound(new BoundingBox());
terrain.updateModelBound();
terrain.setLocalTranslation(new Vector3f(200, -7, 800));
terrain.setLocalScale(terrainScale);
terrain.setShadowMode(ShadowMode.Receive);
rootNode.attachChild(terrain);
…
[/java]
this is my scene at start:
just pressing S key I have this result
commenting line
[java]terrain.addControl(control);[/java]
the problem disappears
‘S’ key as in ‘moving backwards’? It just looks like the LOD changed because you moved farther away.
Could you describe more of what you are seeing?
Thanks
truman
November 3, 2010, 6:04pm
3
Sploreg said:
'S' key as in 'moving backwards'? It just looks like the LOD changed because you moved farther away.
Could you describe more of what you are seeing?
Thanks
I just press S once to move camera (or any other key that moves camera) and many triangles disapper as you can see from statistics in images attached
That is the level of detail changing. You can change the distance threshold of when it changes by adding this:
[java]
int patchSize = 65;
terrain = new TerrainQuad(“terrain”, patchSize , 513, new Vector3f(1, 1, 1), heightmap.getHeightMap());
LodThreshold lodThreshold = new SimpleLodThreshold(patchSize , 4); // default is 2, I changed this to 4 (ie. 4 x patchSize )
LodDistanceCalculatorFactory lodCalculatorFactory = new LodDistanceCalculatorFactory(lodThreshold);
terrain.setLodCalculatorFactory(lodCalculatorFactory);
[/java]
This will increase the distance when the LOD changes.
If your terrain is small, you won’t need LOD, so you can just disable it as you did by commenting out ‘terrain.addControl(control);’
truman
November 3, 2010, 9:59pm
5
using your code I have the same problem, I’ve to disable it
thanks for your help