This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Generating Roads

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Engineering / Sim SDK edition to use it.

Roads are generated by tiling a decal created from a primary static mesh along the vector data available.

Let's review the general workflow.

Notice
The article assumes that you have already added the data required for the terrain surface.

1. Preparing a Primary Object#

First, we create a Mesh Static object that will be used as a building block for the generation.

Notice
The Mesh Static object must be located and have a pivot at the origin (0, 0, 0).
  1. Create a mesh (we use a plane for the road here): click Create —> Primitive —> Plane on the Menu bar.

  2. Specify the mesh parameters. For our road, we set the following:

    Notice
    We recommend using more than a single segment to make road curves smoother.
  3. Inherit a material from mesh_base, set all necessary textures and parameters, and assign it to the mesh.

  4. The road is generated by tiling the primary mesh along one of the axes X, Y, or Z (forward axis), so make sure that your mesh is oriented correctly — in this case, the forward axis is X (red arrow).

  5. Geometry is very resource-consuming. Thus, to maintain acceptable performance, you should set up LODs for the primary mesh. For each surface of the mesh, specify visibility and fade distances. These settings will be used for managing LODs of generated spline objects.

    For more information on LOD settings, see Setting Up Object LODs.

  6. Move the mesh to the origin and export it to a .node file.


Now that the primary node for roads (the *.node asset) is ready to use, you can delete it from the scene.

2. Adding a Vector Data Source#

Currently, Sandworm allows using only offline vector data sources for the generation.

  1. In the Sources panel:

    • Clicking on Vector opens the window for adding Slots. Slots are designed to organize data.

      Slots

    • Clicking on + Add Layer provides the toolset for uploading vector data.
  2. When adding a layer, define the type of Data Source to be used: Assets or External Files. Currently, only *.shp and *.geojson are supported as assets. Therefore, if you have other types of files, you can try to add them as External Files.

    Click Import.

  3. In the window that opens, select the set of files to be used as vector data.

When the vector data is added, its image is displayed atop all the layers in the Preview panel (you may change the order of layers display by RMB click on a layer in the list of sources), and the Vector layer parameters become available.

3. Specifying Filters for Vector Data#

The Filter is a set of rules used to pick the specific data from the list of all available vector data. The rules are created using Attributes, and only the objects that fit the requirements of every attribute are generated based on this Filter.

Filters are created as follows:

  1. Click the Add button in the Filters window of the Parameters panel.

    Double-click on the Filter to specify a Filter name. To remove a Filter, use the Remove button. You can add as many Filters as necessary.

    The Share button allows shared use of the Filter among source data layers. Select the source data layer that will share this Filter in the pop-up window. Changes in a shared Filter will be applied to it in all source data layers.

  2. Select a slot from those created by you (Sources -> Vector).
  3. For each Filter, set an Attribute (or Attributes) to filter specific data from the vector source. The required data is filtered using the attribute value and a suitable operator. Autocomplete is available — you can type in Attribute names and values or select them from the Attribute list.

    The available operators are: =, !=, >, <, ANY. ANY generates all the objects that have any value assigned for the selected attribute.

    Warning
    When using > and <, make sure that the selected attribute type is a number. String comparison may cause issues.

    You can also select attribute values from the Attributes table. The table opens using the sign on the right of the attribute expression.

    Double-clicking on a value in the table adds it to the attribute value field.

  4. To add more attributes, use the "+" (plus) button. You can add as many Attributes for one Filter as necessary. It is possible to set AND and OR relations between the Attributes in the Filter.

    To remove an Attribute, use the button to the right of the Attribute expression.

4. Specifying Parameters of Vector Objects#

In this step, we set objects that will be generated and placed across the terrain's surface according to the data picked out by the Filter.

  1. On the Sources panel, click + Add Object.

  2. In the drop-down, select the type of object you are will generate according to the slot data. In our case, it is Roads. Click Import.

Set the following object parameters:

Vector Slot A Slot created by you to organize data using Filters.
Object Name The object's name that is displayed in the Objects list in Sandworm and in the World Nodes hierarchy when the terrain is generated.
Node The path to the primary object's *.node file.
Decal Texture Resolution

Resolution of the decal texture into which road projections are baked.

Split Segments

Flag indicating whether the segment splitting mode is enabled. In this mode, all line segments will be divided into subsegments of the specified length (if this length does not exceed the length of the segment itself). This parameter can be used to provide smoother curving and better alignment of decals with the terrain.

Split Segment Length

Length of the subsegment for splitting mode, in units.

Notice
Splitting a segment into too many subsegments (i. e. using very small values) affects the generation time and memory consumption.
Split Lines Length (km) Roads are projected onto a terrain using the Decal object. A decal object might be too big, and it is split into segments for optimization purposes. Splitting the lines implies forming a grid with a cell size defined by this Split Lines Length value and making the grid cells individual Decal objects.
Adjust Terrain Heights and Masks

Flag indicating whether terrain heights and masks will be adjusted for generated roads. When this option is enabled, the following terrain data will be modified in the areas along the roads (vector data) having the width specified by the Area Width parameter:

  • Height data will be adjusted (flattened) to provide better alignment of generated roads with the terrain surface.

  • Masks data will be cut out (e.g. preventing grass from growing on roads).

    Notice
    All masks will be affected.

Notice
  • Enabling this option significantly increases generation time.
  • Adjustment will affect all height and mask LODs of the global terrain having the density satisfying the following condition:

    Density < Area width x 6.

Area width

Width of the area along the spline to be affected by heights and masks adjustment.

Notice
Available only when heights and masks adjustment is enabled.
Forward axis Axis along which the primary mesh is to be extruded or tiled.

5. Generating Roads#

Now you need to configure the output settings and generate (or regenerate) roads on the terrain by clicking the Generate button.

If the terrain has already been generated and you made no changes to it, you can regenerate only the vector data. In the corresponding settings, disable the data types you don't need to be regenerated.

A terrain fragment with roads generated based on vector data using the primary mesh object:

Last update: 2021-12-13
Build: ()