Heightmap help

So I was looking at the terrain tutorial, and you can load a heightmap image, and I also seen that you could do it by just using a float array like; float[] map = new float[]{200, 200, 255, 200 };
and it didn’t really show an example on that so I’m wondering how exactly would i load that as my heightmap instead of using the image? Or even using them together?
Thank you!

The way i do it is extend AbstractHeightMap http://hub.jmonkeyengine.org/javadoc/com/jme3/terrain/heightmap/AbstractHeightMap.html
I implement the method getHeightMap() to return the array I want to use as a height map. Then you simple give the TerrainQuad an instance of your height map implementation instead of the image based one.

1 Like
<cite>@jmaasing said:</cite> The way i do it is extend AbstractHeightMap http://hub.jmonkeyengine.org/javadoc/com/jme3/terrain/heightmap/AbstractHeightMap.html I implement the method getHeightMap() to return the array I want to use as a height map. Then you simple give the TerrainQuad an instance of your height map implementation instead of the image based one.
Thanks it sort of helps me but I'm pretty new, can you show me an example of this?

Trust the source Luke

https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/terrain/com/jme3/terrain/heightmap/HillHeightMap.java

It does all the good stuff (i.e. create the actual values) in the load method.

1 Like
<cite>@jmaasing said:</cite> Trust the source Luke

https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/terrain/com/jme3/terrain/heightmap/HillHeightMap.java

It does all the good stuff (i.e. create the actual values) in the load method.


Thank you very much, I’ll check it out.