Landscape X and Y scale uniformity

I have been trying to import real-world height map data into Unreal Engine but as my heightmap is rectangle I would like to scale my landscape independently on the X and Y axes. Currently they seem to be bound (as opposed to the Z axis) and I was wondering how I could go about recreating the proportions of my heightmap in-game.

I think you’ll need to generate a rectangular grid of components (the big squares of the landscape that contain quads). So, at the initial generation of a new landscape, go to Number of Components and select X or Y to change its value to add more components on one axis than the other. If I were you, I wouldn’t bother trying to measure exactly what size per axis you need in terms of components and quads, but simply generate something that the heightmap will fit into, and then adjust it if necessary. It could actually be helpful to maintain extra landscape space beyond the heightmap borders, and you can always simply hide the extra space by clicking on those individual components / quads, then changing the settings for visibility. You can also measure the exact space needed by importing the heightmap and do an accurate measuring of the space it covers in the landscape grid…then do a new landscape with the calculated measures and generate it and re-import heightmap. It’s best not to change the Scale values of X and Y independently because it’ll probably skew any materials and sculpting or other changes you make to the landscape, with unintended results that can be difficult impossible to fix.

Thanks for the answer! When I create my landscape (using import from file option), I can use Fit to data to let Unreal estimate the number of components needed in order to fit the heightmap into it. So the landscape is rectangular, but the problem is that the proportions are off. My landscape is skewed in the X axis compared to what it should be and I can’t modifiy it afterwards as I can’t scale it. I’m not sure what to do here.

Just modify the heightmap.

make sure you use a 16bit program
So absolutely not photoshop.
Krita or Gimp can work.

First, create a landscape that follows the performance requirements from the docs.

Second, export the landscape heightmap so you have the base file to work with.

Third, open the file in the DCC and make sure that your are locked in 16bit mode.

Fourth. Open and paste you heightmap in place. Save out.

Fifth. Re-import the heightmp inside unreal.

I would suggest you leave the extra components be / run the soften tool at the hard edges you probably created. And call it a day.
Non regular (square) landscapes with equal number components can cause issues.

Can you post a screenshot or two of the skewed on X landscape, and its size / resolution details in Unreal? Being skewed on X axis wouldn’t imply a Z axis problem unless its a rotational skewing, which I’m guessing it’s not. What program did you create the heightmap in?

You should be capable of rescaling the landscape on X / Y independently per axis in UE. When in Landscape Mode, select the Manage tab and click Select. Then select all the components to rescale, and the settings are in the interface to change values or you could utilize the viewport scale tool. It’s definitely better to get a more rough draft of the landscape in a DCC / external app before importing so it can be modified more carefully and at greater detail in UE.


That’s how my terrain looks in Unreal.


Here’s how it should look.

Screenshot_2
And those are the details in Unreal

Thank you! I did not know Photoshop didn’t handle 16bit PNGs, so that’s why I was having issues. I will try GIMP!

Alright so even after cropping in GIMP the landscape is skewed in Unreale, so I guess the problem is with the base heightmap itself. It originally comes from the NASA dataset that comes with Blender GIS add-on, but maybe I need to bake my landscape on a plane to make sure the height map has the adequate dimensions.

Even though it’s a wireframe view, the first image in grayscale appears blurry or as though the elevations are squelched. Whereas in the actual map (2nd image), they’re more distinguishable and have a better gradient transition representing the terrain. It could be the Scale values are too high (X=2500, X=2500, z=15000), so the results in Unreal of interpolating based on the quads in components is watering down the distinctions in height. Basically it’s modifying the slope to be noticeably more gradual than the actual map.

2500 is 25 meters per quad, and there’s 512 quads / component in 2x2 sections, so 512x2 = 1024. Thus, 25,600 meters, which I’m thinking is the map’s coverage area, correct? or is it smaller than that? Decreasing the scale of X and Y, then increasing the number of components proportionally to get the same coverage area may be a part of the solution. And if you weren’t using 16-bit before, it would also explain the flattened result in Unreal. Interesting though, not using 16-bit could also produce exaggerated height / slope representation in other extreme too, with steeper slopes and sharp terrain transitions.

150 meters per Z axis sounds rather tall for the map in 2nd image. What are the lowest and highest points in the original heightmap?

The scale values are high because I wanted to have real-life proportions, and that was the closest to real-life. Problem is I can’t seem to increase the number of components.

And yeah, the map’s coverage area is pretty much 25km but I can manage with a square map of about 16km. Now I tried using 16-bit and it doesn’t change my main problem, which is actually the X scale in proportion to the Y scale. But maybe that’s due to Mercator projection in BlenderGIS. I need to look into that and try scaling the heightmap with a precise value.

150 meters per Z axis is to attain max altitude of 4800meters (that’s the highest mountain in the area). I think proportions are pretty real in terms of Z axis. It’s only the X that’s problematic.

How Unreal does a landscape Z for heightmaps is interpolates between complete black and complete white…but the original map is in reference to sea level being a specific grey when there’s terrain below it. So, if the original heightmap (before import to Unreal) is a total of 4800 meters above sea level, and there’s some terrain below sea level, then the total Z scale needs to fit all that height…from the lowest heights below sea level to the 4800 meters mountain peak. But, if 4800 is above surrounding terrain rather than sea level, then I guess it’s safe to assume the height goes 0 - 4800.

I had a thought. Try not selecting the Fit Data option when importing and generating the landscape. It could be stretching the heightmap on X to fit the total resolution of the Unreal generator’s settings. It may even be slightly skewed on Y due to it too. But you definitely need to ensure that the Z axis scale value is producing the exact elevation levels for a realistic data set. If it’s off by enough, which could be not much required to get incorrect, the system is probably going to extend on X/Y to try and match slopes.

You need to stretch the heightmap file to approximation the real life size.
Not the unreal landscape.

Also. Sea level is (65535/2)+1 - but you can extract the gray value by making a new landscape and exporting/sampling the heightmap.

To calculate zero scale there’s an exact ratio to follow which is now found in the landscape docs with examples detailing the process (took some doing to get them to change those).

Wen going from 20m dtm to 1:1, you will loose some steepness no matter what program you use.

You also want to run a radial blur on the map after upsampling, so that the transitions don’t produce terraces of 20m. Since you just stretched from 1 pixel per meter to the same pixel every 20 meters…

Alright! I solved it by measuring points on a real-life map, comparing it with my landscape, then adjusting my heightmap accordingly, in GIMP. Using Photoshop didn’t work, so at least I learned something! I guess the skew was due to mercator projection or something… I don’t really know, but at least it’s solved.
Thanks everybody!