Exporting landscapes from Gaea to Unreal Engine 5
Recently, while working on a game development project, I needed to create a landscape. I found the landscape tools in Unreal Engine 5 to be unsatisfactory for what I wanted to create. That is when I came across Gaea, a node based terrain design tool. It had a free plan that was enough for me so I went ahead and downloaded it. I generated the landscape I was happy with, thanks to the help of the Gaea community, and then came across probably one of the most common questions people have with Gaea and Unreal Engine 5; How to export the terrain from Gaea into Unreal Engine 5 and scale correctly? I believe I have found a nice workflow so here's a short post detailing it.
Version of software used
- Gaea Version 1.3.2 Community
- Unreal Engine 5.3.2
Basic points to keep in mind
Before we start, there are a few things to keep in mind about Unreal Engine.
- The heightmap's height is calculated by using values between -256 and 255.992, stored with 16-bit precision. So, roughly, there is a range of 512 in the Z-axis.
- The default scale is 100. This is because Unreal Engine's default units are in centimeter and expect the heightmap's values to be in metres. For eg. a value of 0 in the heightmap is -512cm when the scale is 1. Most heightmap's are made in metres and so, for things to make sense, the default is set to 100.
- Unreal Engine has some pre-defined landscape sizes/resolutions that are not exactly 1024 or 2048. The list of recommended landscape sizes can be found here. For our purpose in the rest of the blog, we will use 1009 x 1009.
Basic configuration in Gaea
Before you start working on a new Gaea project, set up the "Terrain Definition" parameters. These can be modified in an existing project too but that will change the terrain. The values should be as such:
Scale: Use the landscape size that is selected. Since we selected 1009 x 1009 as the landscape size, we will use that as the scale.
Height: For our height, we will use 512.
Build configuration in Gaea
Now, once we have built our terrain, it's time to build and export the heightmap. We will use the following configuration:
File format: .png
Resolution: 1009
Range: Raw
And we will start building our heightmap. The built heightmap will be in our file system. We will import the .png
file in Unreal Engine 5.
Landscape import configuration in Unreal Engine 5
Finally, time to import the heightmap into Unreal Engine 5 and generate the landscape. Assuming we already have a level created, we will need to go to the Landscape mode. In the "Manage" mode, we can create a New landscape and select the "Import from File" mode.
We will use the following options in the fields:
Heightmap File: The built .png
file.
Location: 0.0, 0.0, 25600.0
Scale: 100.0, 100.0, 100.0
Section Size: 63x63 Quads
Sections Per Component: 1x1 Section
Number of Components: 16, 16
Overall Resolutions: 1009, 1009
2x2 Sections
in the "Sections Per Component" options while making the "Number of Components" as 8, 8
to keep the "Overall Resolution" at 1009, 1009
. This can reduce the number of "Total Components" and depends on the use case.Click on "Import" to start the import. We should see the terrain imported with the correct scale and the bottom-most point of the terrain right on the XY plane.
And with that, we have what we wanted.
I want a hiiiigh landscape!
So, in the above steps, I have mentioned keeping the "Height" in Gaea's "Terrain Definition" at 512. That means that the highest you can build is 512m. But what if you want to build higher? That should not be a problem. One can technically use whatever height Gaea supports. I have used 512m to keep things simple. If you want to use another height, just multiply the height by 100 and divide that by 512 and use the result in the Z-axis scale. For eg. if we set the height in Gaea at 1000, we should set the scale as 195.3125. This calculation comes from the fact that 512m in Gaea refers to a scale value of 100 in Unreal Engine. Moreover, the Z-axis value of the location needs to be updated in a similar ratio. To get the value multiply 256 with the Z-axis scale. In this case, we get 50000.0 so that's what we put to locate the bottom of the landscape at z=0.
Using a sea level
If the landscape in Gaea uses the Sea node to simulate a sea level, then one can import the landscape into Unreal Engine keeping the sea level at z=0. After getting the sea level in percentage from Gaea, subtract this as a ratio from 1 and then multiply by the value of the bottom of the landscape. For eg. in the previous case, if the sea level was 10%, then the location on the Z-axis would have been 50000 multiplied by 0.9 to get 45000.0. This would ensure that the sea level is at z=0.
That should be all. I hope it helps someone looking for a way to get the 2 working nicely. Let me know if something can be improved.