Terrain generated from HeightMap always angled


I created a heightmap with Freeworld 3D. Generating a TerrainBlock from that heightmap ends in a Terrain with rough and angled terrain transitions. I tried different scalings in both the code and freeworld. I tried it with bmp heightmap and raw heightmaps (raw only works with 8bit depth). The terrain more or less always looks angled. If I scale to low, the heightdifference almost disappear, but you still can see a little staireffect.

So my question is, is there maybe a method which smoothes the terrain, or is there a possibility to work with 32bit oder 16bit raw files? Or maybe is there a way to use heightmaps with float values?

Or maybe im doing sth wrong. It looks like that many people are using heightmaps, so it must be somehow possible to create a smooth terrain.

Thanks in advance.

Greets Av


There is a modification for 16bit RAW loading (see my topic in User code).

Hm, I've tried your code and it is loading raws fine, but with 16bit raw files, i still get a very spiky terrain. 32bit (of cousre your code implements just 16bit, just tested it) creates the same. I think problem is, that the HeightMaps are integer arrays. 2 neighbored fields differ min 1 in height. So only with scaling you can calm the different height.

But that almost flattens the terrain, until I make rough height differences in editor before.

Well, 16bit should be enough for everyone.  :smiley:

If you consider the highest mountain 7Km high, and the lowest terrain point of about (umm) -7Km, which is a range of 14Km divided by the 16bit 65536 value, it gives you a resolution of about 0,21meters, or 20cm.

First of all, when painting your terrain, use up the whole grayscale range. Your highest mountain should be totally white. There are filters in paint programs for balancing brightness, which should balance your terrain altitude values into the whole 16bit range. You can use the stepScale value after loading to scale your terrain into proper dimensions.

In case you are using CLOD, i have noticed that CLOD and steep terrain do not mix well…

If you want to smoothen the looks of your terrain, then use shading. Shading the terrain with light using the terrains vertex normals smoothens the looks. BTW, i think the TerrainBlock uses face normals, which is not suitable for shading.

Ok, yes I see, 16bit should really be enough. Maybe Freeworld3Ds exported 16bit raws are of another implementation (dont know if there are differences), cause as I said, importing them results in really strange results. But I realized with the exported BMPs, that the range of BMP Heightmaps isnt used, cause the highest parts are middle grey, and the lowest are just a little darker. So I will go on experimenting with scales and maybe try that filtering with a paint program. Can you give me an example, which program can do this?

Thank you for your help.

If FreeWorld3D can't export them with the full range used, then don't bother trying to convert the file with another program. It, of course, won't recover any of the lost resolution (you might as well use scale in jME then).

Freeworld can export the heightmap into 24bit BMP, 8bit, 16bit and 32bit RAW.

But with BMP and 8bit RAW, of course smoothness gets lost.

After experimenting I get relative good results by export 16bit RAW files, opening them in Photoshop, balancing them to the whole range of 0 to 255, saving them as PNG an then import them into jME with ImageBasedHeightMap. After that playing a little with the setStepScale value of the TerrainBlock. I still see a little relief effect, like heightlines on geographic maps. But maybe I can smooth this with shaders or sth else later on.

Thx for you help guys.