# Exact Z-axis value for a heightmap?

Hello!

I sure hope someone can help me.

I am creating a landscape for a serious, non-gaming application. I have a high-resolution PNG heightmap (8129x8129, 16 bit). I’m following the recommendations for setting up the importation settings.

The actual real-world height range is from 548 m to 1,253 m (difference of 705 meters in terms of elevation variance).

In the Lanscape creation mode, it automatically sets the scale to 100, 100, 100.

Obviously, the Z axis is wrong. If I leave X and Y set to 100, what should the exact value be for Z? I want a 1:1 relationship to the difference of 705 meters. I’ve tried calculating this, but depending on how I calculate it I keep getting inconsistent values.

I need this to be as accurate as possible for a simulation.

I’d really appreciate some help with this. I don’t want to judge it visually, and I need high confidence in the correct value for the Z-axis scale if X and Y are both set to 100.

Thank you!

Ben

(post deleted by author)

I obtained the heightmap here:

Calculate the Z scale for your heightmap.

1. The Z scale equation is (Max height of your heightmap in meters) x (100 to convert to centimeters) x 0.001953125. For more information on calculating Z scale, see Landscape Technical Guide.

If the lowest point of your heightmap is higher than 0 elevation, subtract that height from the highest point to get the relative max height.

So with a scale of 100 you have a height of ± 256m

The math for it is (256 * 2) / 65535, where 65535 is your 16bit color, and 256 is your landscape height.
This boils down to a single shade of color on the heigjtmap with scale 100

Now.
Depending on what the maximum color of your landscape heightmap is, you got to do your math.

If your heightmap is properly notmalized, then you can assume that height to be 700m.

700 / 65535
Then gives you the height of a individual color value.

The scale to enter on that would be:
256*2 is to 100 as (700/2)*2 is to X

Be careful with that though. There is pretty much no chance the heightmap you got is normalized.

Also, when you simplify this way, you are deploying the map both in Negative And Positive space with a maximum overall height of 700m.

The engine will place it at the midpoint and draw up stuff under the Z 0
(Z 0 value being roughly 65535/2 bit value wise on the heightmap).

If you want the engine to go only up, then you need to rebase your heightmap accordingly, where the lowest color it can have is 565535/2 rounded up.

Needelss to say, you would need to double your scale if doing so, since you will now need a ±700 value for your terrain, where the 0 to -700m is just not used.

Last thing, you can forget about the engine being precise ebough to make things work to the millimeter.
You should probably create the map as a mesh in a DCC you are comfortable with.
Its really the only way to have millimetric precision for surveys and such.

Huge thanks to you both!