shown in other instead.
Roads are generated by tiling a decal created from a basic static mesh along the vector data available.
Let's review the basic workflow.
1. Preparing a Basic Object#
First, we create an Mesh Static object that will be used as a building block for generation.
Create a mesh (we use a plane for the road here): on the Menu Bar, click Create —> Primitive —> Plane.
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.
Inherit a material from mesh_base, set all necessary textures and parameters and assign it to the mesh.
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).
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.
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.
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.
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.
- 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:
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.
- Select a slot from those created by you (Sources -> Vector). Slots are designed to organize data into different terrain masks.
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.
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.
On the Sources panel, click + Add Object.
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.
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:
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#
A terrain fragment with roads generated on the basis of vector data using the basic mesh object we created: