private void setUpTerrain(SimpleApplication simpleApp, AssetManager assetManager) {
                // HEIGHTMAP image (for the terrain heightmap)
                TextureKey hmKey = new TextureKey("Textures/Terrain/splat/mountains512.png", false);
                Texture heightMapImage = assetManager.loadTexture(hmKey);

                // CREATE HEIGHTMAP
                AbstractHeightMap heightmap;
                try {
                    heightmap = new ImageBasedHeightMap(heightMapImage.getImage(), 0.3f);
                    heightmap.load();
                    heightmap.smooth(0.9f, 1);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }

                terrain = new TerrainQuad("terrain", patchSize + 1, terrainSize + 1, heightmap.getHeightMap());
                TerrainLodControl control = new TerrainLodControl(terrain, getApplication().getCamera());
                control.setLodCalculator(new DistanceLodCalculator(patchSize + 1, 2.7f)); // patch size, and a multiplier
                terrain.addControl(control);
                terrain.setMaterial(matTerrain);
                terrain.setLocalTranslation(0, -100, 0);
                terrain.setLocalScale(1f, 1f, 1f);
                simpleApp.getRootNode().attachChild(terrain);
            }
Test advanced PBR terrain with different debug modes

@param testName The name of the test (used for screenshot filename)
@param debugMode The debug mode to use
jme3-screenshot-tests/src/test/java/org/jmonkeyengine/screenshottests/terrain/TestPBRTerrainAdvanced.java