What is Unreal Unit height translation after importing 16bit heightmap to Level?

Hi there,
I’m pretty new to UE4 and trying to understand unreal units while importing from heightmaps.
I read that 1 pixel in the PNG will be translated to 100 uu after importing (100cm). (UE4 Heightmap Guide: Everything You Need to Know About Landscape Heightmaps for UE4 - YouTube) Is this correct?
Now when I generate a level from a 16bit PNG, there are 65536 possibilities for the height value, but how this correlates to unreal units after importing? Like, each unitary value from the 65536 possibilities will be how many uu’s after importing? Or its just a one to one relation like (1 value from 65536 = 1 uu) ?

This is specially important for me as I just started evaluating UE4 for real terrain representations (GIS). Also not interested at the moment in third party software (paid or not) that will just convert for me. Really want to understand how it works.

Tried to browse/find in the documentation section for this but no luck still.

Appreciate any clue!

Hi, with the default landscape scale one pixel corresponds to 1 square meter (so you got that right) and for the height, to quote the docs there

from Landscape Technical Guide in Unreal Engine | Unreal Engine 5.3 Documentation under “Calculating Heightmap Z Scale”

Hi I use real world GIS data like yourself.
My workaround for the vertical scale may help
In QGIS I note the elevation range
Import the Height map into UE4 and create the terrain
I place a static mesh cube in the scene and make its Z scale equal the elevation range
(I also make the X or Y Greater than the tile width)
View from an Ortho position left, right, front back
Move the cube up or down to match and then with the landscape selected in the world outliner scale it until it matches the Cube vertically
If you have a tiled landscape you only need to do this once and then apply the scale to each tile
There is probably a way to get the extents of terrain ? bounds?
If so setting z scale would be way easier :slight_smile:
Paul G

Thought I would have a look for extents (bounds)
This will give you the height of landscape object in metres - Scale the landscape to Match you GIS vertical extents

Paul G

Thanks chrudimer for pointing the right direction in the docs! Now I see I should have searched more before asking. Tried ‘search’ for this but looked awful by the site pointing only for old UE versions in the subject.
Thanks **Sly401 **for the tips and tricks,

I have been playing around creating some levels manually then exporting to PNG. UE zero height (i’m calling it “sea level”) will be INT 32768 in the 16bit exported image, this makes sense.
Adjusting X & Y scale on importing, based on the original image cell size (spatial resolution) is easy and works as expected. For the height… for example if i pick a SRTM in the range of 759m ~ 1367m this will be imported as a height entirely place below “sea level”, and this makes sense considering UE characteristics. The point is increasing Z scale in this situation will start throwing the entire level deeper into the “ocean” more and more.
For what I could grasp from tests I did, going to try Gdal to just expand and change pixel values on the scene to be imported so it fits exactly in the 32768 ~ 65536 full range, this will make the terrain using the max resolution possible above “sea level” in the viewport after import. Then calculate and apply the appropriated Z scale.

Not sure, probably doing somehing wrong but is not working for me if I follow https://docs.unrealengine.com/en-US/…ide/index.html “Calculating Heightmap Z Scale” example.

Yes it worked that way:

Starting from SRTM image:
gdalwarp -co “COMPRESS=LZW” -r near -t_srs “EPSG:31983” S20W044.hgt S20W044.tif
To bring data values to a suitable orthogonal projection. Open image, select and clip some desired area. I selected some 505px x 505px (15150m x 15150m) area to have image exact size one of the recommended UE sizes. Then write down min max image pixel values (heights), for me is 683 ~ 1370.
gdal_translate -ot UInt16 -scale 683 1370 32768 65535 S20W044_1.tif S20W044.png
This scale up pixel values to full range (of half space for Z - from 0 to 255.992 in UE). Also save it as 16bit unsigned, just to have image in same shape of ones exported from UE levels.
Spatial resolution (cell size) of SRTM is 30, so the real size is 505*30=15150m. The new scale for X Y is 15150/505=30x the size of actual scale=3000.
For Z scale, the real world height amplitude from the SRTM clip is 68600cm, and actual amplitude in uu is 256, so 68600/256=270.703 for Z scale.

It did matched in uu and have correct aspect. It seems that Level was cut. Not sure why but I see the level touching a sphere in the wireframe.

The sphere is most likely the mesh you use for your sky and since that is also most likely opaque, you won’t see the landscape if it outside of it. So you could increase the scale of your skysphere.

Thank you for this info. I have been trying to figure out this same issue and your solution works. The Z-scale calculation that Unreal provides is also not working for me. I have created a web application where you can select a location on the world map and generate a 16 bit png heightmap image based on the tile you selected. The data is from Mapbox. Mapbox uses an RGB png encoded height values that I am decoding to height in meters using their formula

height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)

You can take a look at the demo app here Unreal Mapbox Bridge (justgeektechs.com). You need a free Mapbox account and access token. Also, the source is here delebash/unreal_mapbox_bridge (github.com).

What are you doing to the X and Y value?
Are you changing the X and Y so that the Landscape transform location is at Y = 0 X = 0. Currently the X and Y coordinates of my landscape are not even close to 0,0.

Also, can you explain your Z scale calculation? Example if I have a png size 0f 2017x2017 with a max and min height how do I calculate the Z scale. I have tried the Unreal version, but it is not correct after scaling the image. If I do not scale the image the Z scale seems accurate.

How do I calculate the cell size of the created png?

Thanks again. Really helped. Cheers!