Question about Imagebasedheightmap

Hey everyone ,



I was interrested by doing some terrain from heightmap i work into photoshop but i have a strange thing coming into the result , when i try to do just a circle on my heightmap the terrain is not showing a circle but a lot of stairs effect are appearing making the circle not really looking good. Is there some way to tweak or fix that ?

Whats the bit depth of the image you use?

ImageBasedHeightMap does not have good precision, only 0 - 255 possible heights.

You should use RawHeightMap instead, which allows 0 - 65535.

normen said:
Whats the bit depth of the image you use?

16 bits


Momoko_Fan said:
ImageBasedHeightMap does not have good precision, only 0 - 255 possible heights.
You should use RawHeightMap instead, which allows 0 - 65535.


The thing is that i'm using JME platform terrain editor and there is not RawHeigthMap options cause i need to retake it by using sploreg's tools .

@danath

Can you show us the heightmap image you are using?

Even with imageBasedHeightmap not being very precise, you still shouldn’t get “steps” unless the image itself has steps with the gradient you are using.

Sure :

http://img856.imageshack.us/f/sploreg.png/



By the way 133 K vertices for that , is that normal ? Low poly is what i want :wink:

Heh, that image turns all of our thoughts upside down xD Just raise the texture resolution. (from 512x512 to 1024x1024 or something)

The geometry it produced is as expected by the supplied heightmap. If you want a rounded hill, you will have to shade the edges of the circles. As for the jagged edges of the circles, that is just from the resolution of the mesh and heightmap image. The more triangles/pixels the smoother the cliff’s edges will look.You generally don’t want that steep of cliff faces. Try and blend the edges of the circles a bit and the result will look much smoother.

If you want fewer polygons, supply a smaller heightmap and make the terrain mesh smaller when you create it, then just scale the terrain to make it larger in size. That way you will have a large terrain with few polygons.

Sploreg said:
The geometry it produced is as expected by the supplied heightmap. If you want a rounded hill, you will have to shade the edges of the circles. As for the jagged edges of the circles, that is just from the resolution of the mesh and heightmap image. The more triangles/pixels the smoother the cliff's edges will look.You generally don't want that steep of cliff faces. Try and blend the edges of the circles a bit and the result will look much smoother.
If you want fewer polygons, supply a smaller heightmap and make the terrain mesh smaller when you create it, then just scale the terrain to make it larger in size. That way you will have a large terrain with few polygons.



Can you give me an example of a heightmap with smooth edges cause i'm not sure i can do what you said in photoshop , thank you :).

For the polygons i'll try what you said , again thank you and good luck for the terrain editor !

The terrain test cases in jme use image based heightmaps. You can check out the heightmap images they use: they blend the slopes from black to white gradually to produce smooth slopes.

I’ll check it out thank you !

This is not working , it’s too difficult to reproduce the same quality of heightmap , do you guys have some software or anything for creating heightmap ? cause even in photoshop this is too difficult to have something clean to import into the engine …

P.S : I have to take this solution since there is nor smooth tools neither undo action in the terrain jme editor , if you know a 3rd solution i’ll take it.

Heightmaps are often generated by real data, and stored in an image. Real data being Digital Elevation Maps.

With a little practice in photoshop you can make it look good.



A 3rd option would be to help write the smooth tool. It would not be difficult and we can guide you in the right direction.

Ok sploreg i’ll do it , can you tell me where i find the source of the raise and lower function in terrain editor so i can take it as a base ,



thanks .

Excellent!

If you check out the latest trunk version of JME, you will see the SDK in there. In netbeans, load up the sdk project, expand the modules, and right click on the TerrainEditor module, then select Open Project.



The UI and tools are defined in the TerrainEditorTopComponent. They set a state in the TerrainToolController via an enum called TerrainEditButton. When the smooth button is pressed, have it pass in the state TerrainEditButton.smoothTerrain.



In the TerrainToolController class you will also have to add a case to the setTerrainEditButtonState() to detect the smoothTerrain state, so you can see the tool.

Once that is done, you will be able to select the smooth button and see the editing tool sphere appear on the terrain when you place the mouse over it.



Now you need to implement the actual actions. In TerrainToolController, in the doTerrainEditToolActivated() method, you will want to call a modify method in the TerrainEditorController. This class does the actual terrain modifications.



Note that methods prefixed with “do” happen on the OpenGL thread, while other methods without the “do” prefix happen on the Swing thread.



All actual terrain modification should happen on the OpenGL thread. Just follow how the raise/lower tool works and you will see, it does its work in TerrainEditorController.doModifyTerrainHeight()

This might help too:

https://wiki.jmonkeyengine.org/legacy/doku.php/sdk#development