Vast terrains can render quite slowly, especially if you waste cycles calculating vertices that the player doesn't even see.
We can activate an optimization called LOD by performing the following steps:
Return to your copy of
TerrainSimple.java
.Create a
TerrainLodControl
(from thecom.jme3.terrain.geomipmap
package) and add it to the terrain spatial.TerrainQuad terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap()); TerrainLodControl lodControl = new TerrainLodControl(terrain, getCamera()); terrain.addControl(lodControl); terrain.setMaterial(terrainMat); rootNode.attachChild(terrain);
Run the code and move high up and closer again. Watch the change in the level of detail based on how far away each terrain patch is from the camera.