Image heightmap question

Hi all,

I was wondering how image-based heightmaps (as described in the tutorial) are interpreted by JME. That is, what does one rgb value relate to? How is each rgb float value converted into world units?



EDIT: Sorry, meant to post this into the General Discussion forum.

The heightmap only uses B/W color (I think it might use the blue channel for color images, but I dont know exactly) and only converts that to height.



Thanks Normen. What maps one world unit to the float? i.e. 1f = 1wu (hardly)? I did some math and browsed through the available code, but can’t figure out the exact relation…

Well, you can also define scaling values on import I think, so its not defined per se… Just try using a black image and see where the surface is with certain scaling values…

Setting the scale doesn’t help. The problem with it is thatI still won’t be able to precisely know how you guys map floats to world units as the local scale is being applied to the terrain matrix once the image has already been loaded (or so I understand it)…

My problem is that, in addition to the mercator chart, I would like to load bathymetry data. In order for the terrain to remain in scale, I will need to know what one world unit equates to in terms of the floats describing the greyscale image. Since I can calculate the number of pixels and world units per minute of my chart, knowing how the floats are mapped to world units would allow me to load the bathymetry data into my mercator terrain.

There is no measure in the units, you can use and scale them as you like. When using physics 1 unit=1 meter.

1 Like