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
Art Samples
Tutorials

Generating Buildings

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.

Sandworm allows procedural generation of buildings based on shapes stored in the vector data sources. This article reviews the general workflow as well as the main concepts of the buildings composition to give a deeper understanding of how the assets should be prepared.

Main Concepts#

For the sake of generation of buildings, we differentiate between the following two types of buildings:

  • Single-storey buildings, which have only one floor
  • Multi-storey buildings, which have two or more floors

Conceptual representation of single-storey and multi-storey buildings
  • Underground Pedestal is always 2 meters down from the terrain level. This value is hardcoded and cannot be changed.
  • The Pedestal height is defined by the Ground floor offset value and is 1 meter high above terrain by default.
  • The Ground Floor height is defined by the Floor Height value and is 3 meters high by default.
  • The height of Upper Floors equals Number of Upper Floors * Floor height.

Buildings Texturing#

UNIGINE provides a set of built-in materials for generated buildings: they are inherited from mesh_base and named according to the rules. You can also create your custom textures and set up materials. However, your textures should meet a set of requirements described below.

There are four types of textures that should be prepared for a building: a texture for the basement, a texture for the wall with openings (doors and windows), a texture for the solid wall, and a texture for the roof. The UV map of each part of the building depends on the size of the wall segment that is shown on the texture.

Notice
Textures for walls differ depending on the part of the building they are applied to: if a texture is applied to Basement, it should depict Pedestal and Underground Pedestal.
  • For Underground Pedestal and Pedestal, a single texture for a wall is applied. The texture height should correspond to the height of all these parts (in sum).

    Texture for Underground Pedestal and Pedestal (Basement)
  • For the Ground Floor, an individual texture is applied. The texture height should correspond to the Ground Floor height.

    Texture with openings for Ground Floor
    Solid texture for Ground Floor
  • For Upper Floors, a single texture for a wall with openings is applied. The texture height is usually a multiple of the Floor Height. It can be a multiple of the two, three, etc. Floor Height, however, it shouldn't exceed the height of the Upper Floors part.

    Texture with openings for Upper Floors
    Solid texture for Upper Floors
  • If the wall width is less than the Floor Height, a segment of the texture with openings does not fit into this space properly, and the texture for a solid wall is applied.
  • If the wall width is more than the Floor Height, the wall surface is split into two parts:

    • The first part is tiled with a texture with openings. Its width is multiple of the Floor Height.
    • The second part, where the texture with openings does not fit, is tiled with the solid texture.

    For example, we have a two-storey building with the Floor Height of 3 meters. The sufrace of the second floor wall is 10.5 meters wide and is divided as follows:

    The texture for a wall with openings is applied to each 3*3 meters segment (based on the Floor Height value). For the rest of the wall, the solid texture is applied.

  • For Roof, two textures should be applied: the base and detail albedo textures. Using the detail texture allows you to diversify colors of roofs with the same material: set up details rendering (blending, masking, UV mapping, shading parameters of the texture) for the Roof material to achieve the required result.

    Base albedo texture
    Detail albedo texture

Materials Naming#

For materials to be correctly applied by Sandworm to the generated buildings, follow these rules:

  • Each building category should have a separate base material inherited from mesh_base. This material is used as the material for the Ground Floor wall with doors and windows.

    Notice
    For this material, a texture depicting the Ground Floor should be used.

    The other materials applied to different parts of the same building are inherited from this one. The base material can have any desired name.

    Notice
    When specifying parameters of the buildings, only the base material is specified: its child materials are loaded automatically.
  • Materials for the other parts of the building should be inherited from the parent material described in the previous paragraph and use the following name postfixes:

    • _basement — a material for Pedestal and Underground Pedestal.
    • _level_1_blank — a material for Ground Floor wall without doors and windows.
    • _level_2_complex — materials for Upper Floors walls with doors and windows.
    • _level_2_blank — materials for Upper Floors walls without doors and windows.
    • _roof — a material for Roof.

For example, if you have 2 types of buildings that should have different materials, set up the following hierarchy:

Hierarchy of materials for buildings

1. Adding a Vector Data Source#

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

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

      Slots

    • Clicking on + Add Layer provides the toolset for uploading vector data.
  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.

2. Specifying Filters for Buildings#

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

Filters are created as follows:

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

    Double-click on the tag to specify a tag name. To remove a tag use 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 be applied to it in all vector data layers.

  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 values and suitable operator. Autocomplete is available. You can type in attribute names and values.

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

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

3. Specifying Parameters of Buildings#

In this step, we are going to set the parameters for buildings that will be generated on the terrain according to the filtered data.

  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 Buildings. 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.
Floor Number Name

The name of the column where the number of floors is indicated, from the Attributes table.

Floor Height (m) The height of a floor in the generated buildings. The default value is 3 meters.
Ground Floor Offset (m) The height of pedestal. The default value is 1 meter.
Split Length (km)

The size of the grid cell by which the generated geometry will be divided. Geometry of each cell is represented as a separate ObjectMeshStatic object. If the specified value exceeds or equals to 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.

Floors Per Texture

The number of Upper Floors for which a single texture is applied:

  • If the texture height corresponds to the height of a single floor, this value should remain 1. The texture will be applied for each floor.
  • If the texture height corresponds to the height of two/three/etc. floors, this value should be set to 2/3/etc. The texture will be applied for every two/three/etc. floors.
  • If the texture height is equal to the height of the Upper Floors part, this value should be equal to the number of Upper Floors.
Base Material Material applied to the buildings tagged to the basic object. The default material for buildings is already set. If you want to change it to a custom materal, ensure that the materials are named correctly.
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 completely 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 completely visible. Along this distance, the engine automatically interpolates the level of detail from alpha of 0.0 (completely invisible) to 1.0 (completely 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 completely invisible. Fading out starts when the camera has reached the maximum visibility distance and is out of the full visibility range.

4. Generating Buildings#

Now you need to configure the output settings and generate (or regenerate) the terrain that contains these buildings by clicking the Generate button.

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