shown in other instead.
Sandworm allows the procedural generation of buildings based on shapes stored in the vector data sources. This article reviews the general workflow. To customize the autogenerated buildings, prepare and use your assets, see the article on Buildings Customization.
1. Adding a Vector Data Source#
Currently, Sandworm allows using only offline vector data sources for the generation.
In the Sources panel, add a new vector data layer.
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.
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.
- In the window that opens, select the set of files to be used as vector data.
When the vector data source is added, its image is displayed atop all the layers in the Preview panel (you may change the order of layers display), and the Vector layer parameters become available.
2. Specifying Filters for Buildings#
A 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: 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 its 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 vector data layers. Select the vector data layer that will share this Filter in the pop-up window. Changes in a shared Filter will affect it in every vector data layer.
- Select a slot from those created by you (Sources -> Vector).
Set an Attribute (or Attributes) for each Filter to filter specific data from the vector source. The required data is filtered using the Attribute values and a suitable operator. Autocomplete is available, and you can type in Attribute names and values.
The available operators are: =, !=, >, <, ANY. ANY generates all the objects that have any value assigned for the selected Attribute.When using > and <, make sure that the selected Attribute type is a number. String comparison may cause issues.
Double-clicking on a value in the table adds it to the Attribute value field.
To add more Attributes, use the button. You can add as many Attributes for one Filter as necessary. It is possible to set AND and OR relations between Attributes in the Filter.
To remove a Filter, use the button to the right of the Attribute expression.
3. Specifying Parameters of Buildings#
In this step, we will set the parameters for buildings to be generated on the terrain according to the filtered data.
On the Sources panel, click + Add Object.
In the drop-down, select the type of object you want to generate according to the slot data. In our case, it is Buildings. Click Import.
Set the following object parameters:
|Object Name||The name of the object that will be displayed in the Sources panel and used in the World Nodes hierarchy after the generation.|
Buildings' generation mode. Two options are available:
|Base Material Attributes||
The name of the column where the building material is specified, in the source data Attributes table. By default, the corresponding OpenStreetMap key is used. You can replace it or add another key using a comma, if necessary.
The name of the column where the number of floors is specified, in the source data Attributes table.
|Roof Type Attributes||
The name of the column where the roof shape is specified, in the source data Attributes table. By default, the corresponding OpenStreetMap key is used. You can replace it or add another key using a comma, if necessary.
|Roof Height Attributes||
The name of the column where the roof height is specified, in the source data Attributes table. By default, the corresponding OpenStreetMap key is used. You can replace it or add another key using a comma, if necessary.
|Roof Unit Size (m)||The size of one side of the square area to which the texture is applied (i.e. one tile).|
|Use Imagery Color||
If disabled, the color from the roof material is used. If enabled, the color from the Imagery source is used as the roof color.
To use the imagery color, the roof material should have the Vertex Color state enabled with Vertex Color Albedo set to RGB.
|Roof Material Attributes||
The name of the column where the roof material is specified, in the source data Attributes table. By default, the corresponding OpenStreetMap key is used. You can replace it or add another key using a comma, if necessary.
|Split Length (km)||
The size of the grid cell by which the generated geometry will be divided. The geometry of each cell is represented as a separate ObjectMeshStatic object. If the specified value exceeds or equals the size of the Export Area, a single Static Mesh will be generated.
For example, if you specify 100 and have a 1000x1000 km area, the buildings will be generated as 10 separate Static Mesh objects, 100x100 km each.
|Min Visibility||Minimum visibility distance from the camera at which generated objects (ObjectMeshStatic) start to appear on the screen. By default, this value is -inf.|
|Max Visibility||Maximum visibility distance at which generated objects (ObjectMeshStatic) are no longer fully visible: they can either disappear entirely or start to fade out. By default, this value is inf.|
|Min Fade||Minimum fade distance, over which generated objects (ObjectMeshStatic) fade in until they are entirely visible. Along this distance, the engine automatically interpolates the level of detail from Alpha of 0.0 (entirely invisible) to 1.0 (entirely visible). Fading-in starts when the camera has reached the minimum visibility distance and is in the full visibility range.|
|Max Fade||Maximum fade distance, over which generated objects (ObjectMeshStatic) fade out until they are entirely invisible. Fading-out starts when the camera has reached the maximum visibility distance and is out of the full visibility range.|
4. Generating Buildings#
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.