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 Objects
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
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

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 ObjectMeshStatic, 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 the 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 Source Data panel, add a new vector data layer.
  2. In the Parameters panel, 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 Tags to Filter Vector Data#

The Tag 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 to the requirements of every attribute are generated based on this tag.

Tags are created as follows:

  1. Click the Add button in the Tags window in the Parameters panel.

    Double-click on the tag to specify a tag name. To remove a tag use Remove button.
  2. For each tag, 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.
  3. To add more attributes, use the "+" (plus) button. You can add as many attributes for one tag as necessary.
    If several attributes are set, only the data that comply with all the attributes will be selected.

    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 filtered by the tag.

In the Objects window, click Add to add the object that will be generated on the terrain based on the vector data specified for it. The dialog window will open:

Set the following object parameters:

Name The object's name, which is displayed in the Objects list in Sandworm and in World Nodes when the terrain is generated.
Tag The tag for the selected object from the list of created tags. In this case, we select Roads.
Type Type of the vector object to be generated. In this case, we are generating Roads.
Node The path to the basic object's *.node file.
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.
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 (km) Flag indicating whether line splitting mode is enabled. By default a single decal object shall be generated for the specified tag 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 LOD's 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.

4. 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-04-29
Build: ()