How to get smooth terrain from ImageBasedHeightmap

I have been using jMonkey for few days now, and I like it very much so far, but I cannot get smooth terrain from it.

I have tried to create terrain with this tutorial
but you can even see small steps in the picture used in the tutorial.
I don’t thing there is a problem in my heightmap because I have used different ones(created in different resolutions of power of 2, in different image editors, all in 16-bit greyscale, blurred and shaded, in PNG), even tried downloaded ones
even simple smooth gradient makes small steps same as here Jagged terrain?

I have read that I should use heightMap.smooth(float ); but the method just isn’t there (I am using SDK v3.1-stable)
But when I use HillHeightMap instead of ImageBasedHeightMap the terrain looks as it should.

This is my terrain when I use smoothest gradient I can

btw I use gimp and blender to create heightmaps bcause Build-in terrain editor isn’t working
It says OpenGl context not started, I have tried to check UseHeavyWheightCanvas option but than cannot run SDK at all so I leaved it unchecked

When do you get this exception? When loading the terrain? When opening the scene? Hmm, it’s weird because the terrain editor is working for me, it always worked…

My last info is that jme does not support 16bit grayscale images loaded from a png. AFAIK it is a AWT limitation that the image gets downsampled to 8bits. Might be outdated, but it was that way

1 Like

As was mentioned this is caused by getting reduced to 8bits. You can get better looking maps if you use gimp to convert the original 16bit png image to .dds format. The loader will read it in as 16bit then.

and then install the gimp DDS exporter linked to this wiki page,

See also Is PNG suitable for textures? for more info on why its happening.

You will still get the stepping you have but it is greatly reduced. You can then use
heightmap.smooth(1f, 2);
in your code to get even better results.

For better results creating your heightmaps in blender use the displacement bake option as is explained here, (link provided by Ali)

Adjusting the height of the BakeToPlane modifies the results.

I plan on making a tutorial eventually. Just busy currently.

It happens when opening the scene

Did you try to create a completly new .j3o file ?


Maybe reinstalling the SDK might help… Sorry, I don’t know why that happens :worried:

I don’t thing that reinstalling will help because I have reinstalled it multiple times due to LWJGL library that caused problems

So you can’t open any j3o file in the SDK at all?

I don’t know, I thought only scenes are .j3o…

OK got it.
heghtMap.smooth() did the trick, (I’m not sure why I didn’t saw the method before)
and I changed my graphics drivers so I can now play scene composer which makes terrain smooth as well.
Thank you for replies and sorry for grammar.