1.11. ADDING RAIL, ROADS, ETC.

This section’s all about using GIS vector data to add roads, rail and trails to the landscape.

WE NEED:

Since UE4 doesn’t natively support GIS vector data, we’ve developed an editor plugin to provide this functionality. In case you’d missed it, it’s called TerraForm and you can get it here. It comes with a 10 day free trial period, so if you find it’s not for you, you can cancel your subscription before the end of the trial and we won’t charge you a penny.

IMPORTING RailS:

We’ll start with the rail track. The process is the same for roads and trails but with slightly different values and different meshes.

Step 1:

Choose the rail GIS line (.shp) file to import:

  • Select the ‘Landscape’ actor in the ‘World Outliner’.
  • On the ‘TerraForm’ mode panel, click the ‘Import Lines as Landscape Splines’ button.
  • Navigate to the rail vector file you created and select it.
  • Click ‘Open’.
Step 2:

Set the ‘Vector Line Import Options’ for the landscape spline to be created:

Under ‘Control Point Import Settings’:

  • Set the ‘Spline Width’ to ‘300 Centimetres’. Rail width (gauge) is ~1.4m in the US. The Procedural Landscape Ecosystem (“PLE”) mesh includes some modelling of sleepers and track ballast, so we’ll set the width of the overall mesh to 3m.
  • TerraForm automatically clamps the spline control points’ height to the terrain. The ‘Side Falloff’ and ‘End Falloff’ values affect how the spline is blended with the landscape (both in respect of terrain and any landscape layer materials). Because the DTM is relatively accurate and high resolution, we’ll use a small value of 2m either side. 

Under ‘Spline Segment Import Settings’:

  • We want to remove any vegetation under the rail lines, so we’ll specify the dirt layer (‘Global_ground_a’) in the ‘Layer’ – this will modify the layer masks to reveal ‘Global_ground_a’ layer under the rail tracks when we import the line file.
[NOTE: You must hit the <ENTER> key to ensure the layer name you’ve typed is applied. If you don’t, UE4 may not update the ‘Layer’ value.]
  • ‘Raise Terrain’ and ‘Lower Terrain’ should both be checked – this will allow us to deform the terrain to fit the spline mesh later.
  • In ‘Segment Mesh’, set the ‘Mesh’ to ‘SM_train_track’.
Step 3:

Import the spline and apply the meshes:

  • Click ‘Import’ to create the rail landscape spline.

IMPORTING Roads:

Importing roads is much the same as rail with a few different settings.

Step 1:

Choose the roads GIS line (.shp) file and set the import options:

  • Select ‘Landscape’ in ‘World Outliner’.
  • In ‘TerraForm’ mode, select ‘Import Lines as Landscape Splines’.
  • Navigate to the roads vector file you created and ‘Open’ it.
  • It’s a single track road mesh so the ‘Spline Width’ is about 600cm.
  • ‘Falloff’ values we used were 300cm.
  • ‘Layer’ should be ‘Global_ground_a’. (Hit the <ENTER> key after typing the layer name to ensure it’s applied.)
  • ‘Raise Terrain’/’Lower Terrain’ – both checked
  • ‘SM_roads_a’ is the mesh we applied to the segments.
Step 2:

Import the spline and apply the meshes:

  • Click ‘Import’ to create the road landscape splines.

IMPORTING TRAILS:

Here are the settings for importing the trails. The main difference is we’re not adding a spline mesh – we just want to remove the vegetation and replace the surface textures.

Step 1:

Choose the trails GIS line (.shp) file and set the import options:

  • Select ‘Landscape’ in ‘World Outliner’.
  • In ‘TerraForm’ mode, select ‘Import Lines as Landscape Splines’.
  • Navigate to the trails vector file and ‘Open’ it.
  • ‘Spline Width’ we set to 300cm.
  • ‘Falloff’ values we used were 50cm.
  • ‘Layer’ should be ‘Global_ground_a’. (Hit the <ENTER> key after typing the layer name to ensure it’s applied.)
  • ‘Raise Terrain’/’Lower Terrain’ – unchecked. (Because trails normally conform more to the landscape we don’t want to deform the terrain).
  • ‘Segment Mesh’ > ‘Mesh’ is left as ‘None’.
Step 2:

Import the spline.

  • Click ‘Import’ to create the trails landscape splines.

UPDATE THE LANDSCAPE’S TERRAIN:

If you move the camera to ground level and check out the rail spline, you’ll see the landscape needs a little tweaking to accommodate the track. The terrain and ground surfaces don’t fit and there are rocks and vegetation growing all over it. We need to modify the landscape actor to blend with the rail, road and trail splines and remove the stuff we don’t want.

Step 1:

Open the ‘Edit Splines’ tool:

  • Open the ‘Landscape’ mode panel.
  • Select ‘Manage’.
  • Click on the ‘Selection Tool’ icon and change it to ‘Edit Splines’.
Step 2:

Deform the landscape to fit the splines you’ve just imported:

  • In ‘Tool Settings’ click ‘All Splines’.
  • The terrain and surface materials will be modified to accommodate the splines. Next we need to remove the rocks and trees.
Step 3:

Regenerate the placement of procedural foliage to get rid of any vegetation or other spawned objects on the track:

  • Click back onto the ‘TerraForm’ mode panel.
  • In the ‘World Outliner’, select the three foliage spawners.
  • Scroll down the ‘Details’ panel and click ‘Resimulate’.

Depending on your system and the resolution of the landscape you’re creating, it might take a little time to resimulate the spawners to accommodate the new splines.

Et voilà!