How do I use the georeferencing plugin to map a real world hieghtmap long/lat to unreal l

I have an application that imports a real world heightmap from mapbox into Unreal as a landscape. I want to georeference the landscape so that real world long/lat features match up with the Unreal landscape. For example I have the long lat coordinates of a road in the real world. I want to be able to draw this road on my landscape based on the long/lat of the road.

Attached is a video that better describes my problem. Any help is appreciated.

Help in understanding georeferencing a real world heightmap to ue landscape. - YouTube

My plugin source

delebash/UnrealMapboxBridgePlugin: Import heightmaps into Unreal from real world locations using Mapbox (github.com)

1 Like

Hi Dan,

I just came across your post and had a look at the video. Are you still struggling?
I have the impression that you’re stacking 2 errors.

Mistake 1: The Georeferencing definition (that makes your cube go to a bad location)
Mistake 2: Your landscape generation, in orientation and scale.

Mistake 1:
When setting up the georeferencing, you need to start by answering the 2 following questions:

  1. Is the geometry in my world Flat/Projected or curved to consider the earth’s curvature?

Landscape are not adapted to round earth, so I guess the answer is “Projected” which is correct for an environment of a few dozen of km.
In that case, the GeoreferencingSystem Actor has to be set to “Flat Planet”

  1. Where (in the real world) is located the origin of my UE Level?

You have to choose once a reference point in your map, and keep it forever.
I often use the south/west (bottom/left) point, and get its coordinates.
=> These are the coordinates that you enter in the Origin Location fields.
They can be expressed in Geo or Projected coordinates at your convenience, whereever the Flat/Round mode is. (We use the CRS to convert them internally).

In your case, it should be 46.558, -122,34375 if you select this SW point as the origin for your landscape geometry.

NOTE : The location of the GeoReferencingSystem actor is not considered at all. It’s an object inheriting from AInfo, meaning it’s an actor without any location. You can’t edit its location in the Details panel.
I know the ability to have a gizmo and move its icon is confusing, but once again, don’t move it, it’s useless. Unless you want to avoid its icon overlapping with other actor’s icons in the viewport.

Now, Mistake number 2:
That is your responsibility to ensure that all the geometry you create is spawned in the world at a location relative to the origin, with the right orientation.
Absolutes UE axes are by convention:
X+ → East
Y+ → South! – This is tricky, but UE is left-handed, so we need to flip one axis
Z+ → Up

It means that when you generate the landscapes heightmaps with GDAL, the Easting values will propagate along X+, and the Northing values along Y-. A Y flip is required.

That’s for the orientation. But you have to consider the scaling. A landscape with a scale of 100 will consider that the elevation grid has a one-meter spacing. So if you have 2017 samples, it will be around 2km in size (+/- the odd sample values related to components/quads maps).
if you want elevation samples to be larger (let’s say 5m or 30m depending on your DEM), you’ll have to play with the landscape scale, according to the sample count.
It’s explained in the technical guide…
You might also want to consider another scaling for the height values, because UE uses a 16b grayscale texture to have the max precision, and the height range is by default +/-256m. To have higher elevations, you need to change the scale. But on your video, it seems that you figured it out.

You might need to try to correlate your terrain with proven solutions. I would try adding a Cesium or Esri environment with the right georeferencing first, and then generate my landscape on top of them. Of course, it won’t perfectly overlap because your world is flat and theirs round, but that should help you to find the right scaling and axes.

I hope it helps.

Alban

3 Likes

Thank you very much. I ended up with a working solution not using the built in Georeferencing plugin. But I do want to learn to use it so I will give it a try with your solution. Thanks again. Cheers!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.