1.9. CREATING A LANDSCAPE IN UE4
This section’s all about how to use the data we’ve just prepared to create a Landscape in UE4.
Since UE4 doesn’t natively support GIS vector data, we’ve developed an editor plugin to provide this functionality.
- We’re using TerraForm in this tutorial.
- We’re using Procedural Landscape Ecosystem in this tutorial.
The first thing we need to do is create a new project:
- Launch the Unreal Engine (Version 4.24.3) from within the Unreal Browser.
- In the ‘Select or Create New Project’ section, select ‘Games’ from the ‘New Project Categories’ and click ‘Next’.
- In the ‘Select Template’ window, select the ‘Blank’ template and click ‘Next’.
- The ‘Project Settings’ window confirms your choices and gives you the opportunity to select the folder you want to create your project in and give the project a filename.
Add the Procedural Landscape Ecosystem plugin to the project.
- To do this you need to close the project you’ve just created and return to the Unreal Browser.
- Click ‘Add to Project’ on the Procedural Landscape Ecosystem.
- Select the Project to add the content to.
- Click ‘Add To Project’.
Add the TerraForm plugin to Unreal Engine.
With the Unreal Editor closed:
- Navigate to the folder on your hard drive you installed Unreal Engine to.
- Open the folder for the Unreal Engine version (in this case it’s 4.24.3, so the ‘UE_4.24’ folder is the one we want) and then ‘Engine’ > ‘Plugins’.
- Unzip the contents of the ‘TerraFormLite_V203_UE4.24.3.zip’ you downloaded from TerraFormPro.com into the ‘Plugins’ folder.
- I installed Unreal Engine to D:/Epic/ so on my system it looks like this:
- Make sure that the ‘Enabled’ box is checked. Then close the ‘Plugins’ window.
Delete the default ‘Floor’ object:
- Select the ‘Floor’ object in the ‘World Outliner’.
- <Right-click>, select ‘Edit’ > ‘Delete’.
Open the TerraForm modes panel and activate the plugin (if you haven’t already):
- Select the TerraForm mode from the ‘Modes’ Panel.
- Click the ‘Activate TerraForm’ button.
- In the ‘Activate TerraForm’ window, type a reference in ‘Activated By’ (this is used to help you figure out which computers/people are using your ‘Activation Keys’ in ‘My Account’ on TerraFormPro.com can be anything as long as it contains only letters and numbers – no spaces).
- Copy your ‘Activation Key’ (from ‘Activation Keys’ in ‘My Account’ on TerraFormPro.com) and paste it into the ‘Activation Key’ field.
- Select ‘Annual’ or ‘Monthly’, depending on which subscription duration you’ve signed up for.
- Click ‘Activate’ to activate TerraForm.
- If you have any problems activating TerraForm, you can get help at: firstname.lastname@example.org.
Import your DTM as a height map to create a new landscape in UE4:
- Click the ‘Import DTM as Landscape’ button.
- In the ‘Import DTM’ file browser, navigate to the folder you exported your GIS data to and select the DTM.
- Click ‘Open’.
Set the options for the landscape you want to create and apply the landscape material:
- The ‘Source Dimensions’ of your DTM source data are shown in the ‘Information’ section. Change the ‘Number of Components’ (and if you like the ‘Quads per Section’ and ‘Sections per Component’) so that the ‘Overall Resolution’ of you new landscape approximately matches the ‘Source Dimensions’ of the DTM data.
- Select ‘M_Spring’ in the ‘Landscape Material’ section.
- Click ‘Import’ to create your new landscape. (Depending on the options you’ve set and the size of your source file, this may take a short while.)
[NOTE: We’re closely matching the Source Dimensions to the Overall Resolution to retain as much accuracy of the DTM as possible, whilst minimising the resolution of the landscape we create. You can equally have a smaller Overall Resolution to improve performance, or a larger one to over-sample the DTM data.]
Assign Layer Info objects to the landscape material layers:
- Select the ‘Landscape’ mode, then select ‘Paint’.
- Under ‘Target Layers’, you’ll find the ‘Procedural Landscape Ecosystem’ layer list. Initially, each ‘Layer’ will be set to ‘None’.
- Click the drop-down arrow in the field under the ‘Grass_plane’ layer name and select ‘Grass_plane_Layerinfo’.
- Repeat this for the other layers in Procedural Landscape Ecosystem.
[NOTE: If you’re using your own landscape materials, you can mimic this step with your own assets.]
Eye Adaption provides additional realism in game, but is a bit of a pain when working with large landscapes in the Unreal Editor – continually adjusting brightness as you navigate the scene. At this point we find it easier to fix it to switch it off in the Unreal Editor
- In the Editor Viewport, click ‘Show’ > ‘Post Processing’, then uncheck the ‘Eye Adaption’ check box.
The scene still looks a little dark, so we’ll increase the brightness of the light source:
- In the ‘World Outliner’, select ‘Light Source’.
- In the ‘Intensity’ field under ‘Light’, increase the setting. 12.0 lux is about right for our project.
Save the project so far:
- Click ‘File’, then ‘Save Current As…’
- In the ‘Save Level As’ window, give your new level a file name and hit ‘Save’.