Need advise about Terrain Smooth

I create terrain via editor using image. So problem is that it looks likes it was made with blocks, I would like to make it more smooth. So I used this method to smooth terrain when create terrain not via Editor:



[java]

public class TerrainSmoother {



private static final int Increment = 2;



public static float[] Smooth(float[] HeightMap, int MapWidth, int Passes)

{

int Alternator = 0;

for (int p = 0; p < Passes; p++)

{

for (int i = MapWidth + 1 + Alternator; i < HeightMap.length - MapWidth - 1 - Alternator; i += Increment)

{

// Each middle value equals the average point between the points around it

HeightMap = ((HeightMap + HeightMap +

HeightMap + HeightMap +

HeightMap + HeightMap +

HeightMap +

HeightMap) / 8f);

}

if (Alternator == 0)

Alternator = 1;

else

Alternator = 0;

}

return HeightMap;

}



}

[/java]



So I decided to get hightmap from terrain which have been created via Editor, then smooth this hightmap and create new terrain instance.

[java]

terrain = (TerrainQuad)SceneNode.getChild("terrain-Chapter01");

SceneNode.detachChildNamed("terrain-Chapter01");

terrainMap = TerrainSmoother.Smooth(terrain.getHeightMap(), 512, 5);

terrainNew = new TerrainQuad("my terrain", 600, 513, terrainMap);

terrainNew.setLocalTranslation(0, -100, 0);

terrainNew.setLocalScale(1f, 1f, 1f);

rootNode.attachChild(terrainNew);

mat_terrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");

terrainNew.setMaterial(mat_terrain);

[/java]

But new terrain is not visible in this case.

And I need advice how to work around this case, may be there is another short way to smooth terrain, which have been created via Editor



Thanks

Run your source heightmap image through a gaussian blur before you translate it into terrain. Photoshop will easily do this for you.

The editor also has a smooth tool now, you will need the latest version from SVN to use it.

Yes I have blurred image in Photoshop, but it did help much. Hmm, I need some svn application to download latest version or I can do it via JmonkeyPlatform? Sorry for stupid question