How should TerrainPage subdivision work?

Hi all,



I’m missing how to best optimize a terrain using a terrainpage. I understand the benefit of the current setup, in that it completely culls branches of the tree that are invisible. Below are two screenshots from a scene. The second shows the wireframe. Is it possible to build the terrain in such a way, that when a complete branch of the tree is flat, this is brought back to a single quad?



I would like to use this to optimize a large urban terrain with many flat spaces.











Thanks

JWar


the problem with one big single quad would be that for example the lightning wouldn't work or would look poor.

Then what is the best posibility to achieve this type of optimization, or isn’t there one in jME. The LOD function in the TerrainPage is too heavy.:




Use the Terra system ???

So the terra system allows for reduction of unnecessary triangles? I've been looking through the code, but I can't find a simple way to create a terrain from an int[], like is possible by creating a TerrainPage. Am I missing something?

You are - just create a byte buffer for the heights ( put the int [] into a byte buffer ). see the constrctor for TerraMap



Also - see the code snippet from MapManager



TerraMap entry = new TerraMap( mapNode, ByteBuffer.allocate(size*4), blocksInMapWidth * blocksInMapWidth, new TerrainKey(mapX, mapY, TerrainKey.KEY_MAP));
      entry.getMapHeights().rewind();
      IntBuffer intbuf = entry.getMapHeights().asIntBuffer();
      
      int terrainRuleIndex = getTerrainGeneratorId(mapX, mapY);
      
      int[] hm = terrainGenerator[terrainRuleIndex].getDefaultHeightMap().getHeightMap();
      for (int k = 0; k < mapsize; k++) {
         intbuf.put(hm, (k * terrainGenerator[terrainRuleIndex].getDefaultHeightMap().getSize()) , mapsize);
      }
      intbuf.rewind();
   

I am quite sure that there's no LOD function in the terra system. This is a rather specific optimization so don't expect it to be implemented anywhere… I suggest that you add it yourself to TerrainBlock in your copy.

Thanks for the info.

There is a LOD in LLamaa's original Terra system. It is also allowed for in the current system, the LOD is just not added to the scenegraph in the latest. It is detected when required.



I found that moutains would have the appearance of collapsing in Llama original, so am looking to implement a system that will keep the peaks of a block whilst reducing the meshes of the low lying areas ( out of view ). This way it is hidden from the user that LOD is being used. Also the texturing on a LOD block needs to be reduced.