4. IMPORT LINES AS LANDSCAPE SPLINES
To use the Import Lines as Landscape Splines feature, you must first select a landscape to import the vector lines to – the Import Lines as Landscape Splines button will be inactive (greyed out) until you select a landscape actor.
TerraForm uses your GIS vector line data to create native landscape splines in UE4.
Landscape splines allow you to deform your landscape and are generally used to create linear features that need to be embedded into your terrain including, for example, roads, train lines, hiking trails, and river beds.
Because we’re using your GIS data to create landscape splines in UE4, you can use the Edit Spline tools built into the Unreal Editor. This means you can deform the landscape to meet the spline by raising or lowering the terrain around it. The same process also allows you to replace the landscape material in your layer masks along the spline’s length, meaning you can use them to clear paths for other content – it’s a great way to remove trees along the length of a power line or a fence, and to cut a channel for a river into the terrain.
As with DTM data, TerraForm requires that you do a little work to prepare your GIS vector line data before importing it as landscape splines into UE4. The processes to meet the specifications are very straightforward, but necessary to ensure you achieve the best results in UE4. We’ve created Step-by-Step Tutorials to show you how to prepare data (using the open source QGIS software). You can find them here: Tutorials.
In time, we’ll add further functionality into the TerraForm tools to automate the process of preparing your data for UE4, such as supporting more data formats, re-projecting data in different projections, and editing spline control point spacing (among other things).
4.2.1. Data Formats:
TerraForm initially supports only GIS vector line data in ESRI Shapefile (.shp) format. This is the most common (industry standard) vector line format and all GIS software can export it.
Your vector line data can be stored in any projection/datum combination – TerraForm will re-project your data to same projection as your DTM data when you import it.
TerraForm will set the height value of each control point along your spline to the altitude of the landscape onto which it is imported. If the vector line data is exactly the same extent as the DTM (or larger), it’s possible there will be no landscape underneath the spline control point and height values will default to zero. For this reason we recommend you export your GIS vector line data to an area slightly smaller (by at least one source pixel dimension) than your DTM data.
4.2.4. Data Density:
The number of points in your GIS vector line data directly affects how the spline is applied to the terrain, and how the spline mesh is applied to the spline.
> TOO FEW DATA POINTS:
If your data is too sparse (there are too few vertices in your vector line), the height calculation for each control point will be spaced too far apart and your landscape’s terrain may vary considerably in between:
This is problematic because when you deform the landscape to meet your spline, you may create ridges or cut channels that look unrealistic (see below).
> TOO MANY DATA POINTS:
UE4 uses tangents to determine the distribution of the spline mesh along the landscape spline segments. If your data points are too close together (data is too dense), these tangents are squashed and your spline meshes will be squashed too.
As a general rule, the spline points should be spaced at least 1.5x the length of the spline mesh you intend to use.
4.2.5. Scale vs Data Volume:
It’s easily possible to overload UE4 system resources with GIS data, so you need to be mindful to optimise as much as possible. If you’re building a very large area, you won’t be able to use very detailed line vectors – there will simply be too many data points for UE4 to handle. You may need to iterate the process of refining and importing vectors to get the best balance between performance, detail and accuracy.
4.2.6. Single-Part/Multi-Part Vector Lines:
GIS vector line data can be single-part or multi-part – the difference being that multi-part line vectors are the considered the same line, but aren’t connected. UE4 uses a single spline for each line and doesn’t understand multi-part line vectors – it will crash if you try to import them. Make sure to convert multi-part vector lines to single-part before importing into Unreal.
We’re not currently reading attributes in vector line Shapefiles, but we are working towards support for this. Reading/using attributes in shapefiles will allow you to, for example, automatically set different width values at each control point along the length of your river, or import a shapefile containing many different types of roads and assign different meshes/width options to each spline.
The Vector Line Import Options window gives you the opportunity to set the parameters for all splines to be created from your GIS vector data. Once imported, you can modify these values for individual control points, segments, or splines by using the landscape Edit Spline tools built in to Unreal Editor.
The Vector Line Import Options window appears when you click the Import Lines as Landscape Splines button (available when you’ve selected a landscape actor) and looks like this:
Source File: The name of the GIS vector line (.shp) file you’re importing.
Assets Path: The path to the folder to use to save any assets created during the import process.
4.3.2. Control Point Import Settings:
> SIZE & LOCATION:
Spline Width: The width of the spline to be created at each control point.
Side Falloff: The lateral distance at each control point over which the spline will be blended with the landscape (terrain/material).
> CONTROL POINT MESH:
Mesh: The static mesh object to place at each control point.
Mesh Scale: The scale of the static mesh object being placed at each control point.
Collision Enabled: Whether you should be able to bump into meshes at control points.
Cast Shadow: Whether control point meshes should cast a shadow.
Max Draw Distance: The maximum distance that the control point mesh should be drawn.
Translucency Sort Priority: The sort priority of transparencies in the control point mesh.
4.3.3. Spline Segment Import Settings:
> SEGMENT MESH:
Mesh: The static mesh object to use for landscape spline segments.
Mesh Forward Axis: The mesh object axis to use in the direction of the spline.
Mesh Scale: The scale of the segment mesh object.
Mesh Vertical Offset: The distance above or below the spline to place the segment mesh.
Collision Enabled: Whether you should be able to bump into segment meshes.
Cast Shadow: Whether segment meshes should cast a shadow.
Max Draw Distance: The maximum draw distance of your spline segment meshes.
Translucency Sort Priority: The sort priority of transparencies in the spline segment mesh.
When you import vector line data as landscape splines, TerraForm first reads the metadata from the Shapefile to be imported. It then reads the GIS Projection Asset and compares the values. If the imported Shapefile projection information is the same as that for the landscape, your data is imported without reprojection. If they differ, your GIS vector data is reprojected to the same projection system as your landscape, then imported.
4.4.2. Height Test:
Once your vector data is in the same projection as your landscape, TerraForm checks the landscape’s terrain altitude at each of your control points and sets its z-value, applying your spline to the landscape’s surface. If spline points fall outside the extent of your DTM data, this can cause unusual behaviour, so make sure you clip the GIS data inside the DTM extents before importing.
4.4.3. Applying Import Settings:
The final step in the process is to create the landscape splines and apply the options you set in the Vector Line Import Options window.
4.4.4. Editing Imported Splines:
TerraForm imports your vector lines data as native UE4 landscape splines, meaning that once imported, you can adjust the position, scale and rotation of individual control points of the landscape spline in the viewport. Moreover, you can use the Unreal Editor’s landscape Edit Splines Tool to adjust settings on a per control point, per segment, or per spline basis.