This page has been translated automatically.
Video Tutorials
How To
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Light Sources
World Nodes
Sound Objects
Pathfinding Objects
Setting Up Development Environment
Usage Examples
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
Double Precision Coordinates
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
Art Samples

Generating Roads

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 basic static mesh along the vector data available.

Let's review the basic workflow.

It is assumed that you have already added the data required for the terrain surface.

1. Preparing a Basic Object#

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

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): on the Menu Bar, click Create —> Primitive —> Plane.

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

    It is recommended to use 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 means of tiling of the basic mesh along one of the axes X, Y or Z (forward axis), so make sure that your mesh is oriented properly — 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 basic 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 the basic node for roads (the *.node asset) is ready to use and you can delete it from the scene.

2. Adding a Vector Data Source#

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

  1. In the Sources panel:

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


    • 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 (the order of layers display may be changed), and the Vector layer parameters become available.

3. Specifying Filters for Vector Data#

The Filter is in fact a set of rules used to pick the specific data from the list of all available vector data. The rules are created using the Attributes. 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 Remove button. You can add as many filters as necessary.

    The Share button allows shared use of the filter among masks. Select the mask that will share this filter in the pop-up window. Changes in a shared filter will be applied to it in all masks.

  2. Select a slot from those created by you (Sources -> Vector). Slots are designed to organize data into different terrain masks.
  3. For each filter, set an attribute (or attributes) to filter certain data from the vector source. The required data is filtered using the attribute value and 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.

    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 an 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 atributes in the filter.

    To remove a filter, use the button to the right of the attribute expression.

4. Specifying Parameters of Vector Objects#

In this step, we are going to set objects that will be generated and placed across the surface of the terrain 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 going to generate according to the slot data. In our case it is Roads. Click Import.

Set the following object parameters:

Slot A slot created by you to organize data filters.
Enabled When toggled on, the objects of this type will be generated. When toggled off, the objects of this type are not generated and won't exist in the world containing the generated terrain.
Node The path to the basic object's *.node file.
Decal texture resolution

Resolution of the baked texture for decals.

Available only for decal type.
Split segments

Flag indicating whether the segment splitting mode is enabled. In this mode all 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 better alignment of decals with the terrain.
Split segment length

Length of the segment for splitting mode, in units.

The lower the value the more segments will be generated. Setting too low values may significantly reduce performance.
Split lines length (km) Flag indicating whether line splitting mode is enabled. By default a single decal object shall be generated for the specified filter and shall include all relevant decals. When line splitting mode is enabled the line will be divided into parts of the specified length (if this length does not exceed the length of the line itself). Each part will be represented by a separate decal object.
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 data of the terrain 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).

    All masks will be affected.

  • 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.

Available only when heights and masks adjustment is enabled.
Forward axis Axis along which the basic 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.

A terrain fragment with roads generated on the basis of vector data using the basic mesh object we created:

Last update: 2021-09-30
Build: ()