Generate Buildings
The Landscape Tool allows procedural generation of buildings based on shapes stored in the vector data sources.
Main Concepts
There are two types of buildings:
- Single-storey buildings that have only one floor.
- Multi-storey buildings that have two or more floors.
- Underground Pedestal always 2 meters under the ground. This value is hardcoded and cannot be changed.
- Pedestal 1 meter high above the ground by default. This value can be changed.
- Ground Floor 3 meters high above the Pedestal by default. This value can be changed.
- The height of Upper Floors is 3 * Number of Upper Floors by default. This value depends on the Ground Floor height (3 by default).
Buildings Texturing
UNIGINE provides a set of built-in materials for the generated buildings: they are inherited from mesh_base and named according the rules. You can also prepare your custom textures and set up materials. However, your textures should meet a set of requirements described below.
There are three types of textures that should be prepared for a building: a texture for a wall with openings (doors and windows), a texture for a solid wall, a texture for the roof. UV map of each part of the building depends on the size of the wall segment that is shown on the texture.
- For Underground Pedestal, Pedestal and Ground Floor, a single texture for a wall with openings is applied. Remember that this texture should also depict the Pedestal and the Underground Pedestal. The texture height should correspond to the height of all these parts (in sum).
Texture With Openings For Ground FloorSolid Texture For Ground Floor
- For Upper Floors, a single texture for a wall with openings is applied as well. The texture height is usually multiple of the height of a single floor. It can be multiple of the two, three, etc. floors height, however, it shouldn't exceed the heights of the Upper Floors part.
Texture With Openings For Upper FloorsSolid Texture For Upper Floors
- If the wall width is less than the height of the texture for a wall with openings, a texture for a solid wall is applied.
- If the wall width exceeds the height of the texture for a wall with openings, the wall is split to 2 UV shells:
- To the first UV shell, a texture for a wall with openings is applied. The width of the UV shell is multiple to the height of this texture.
- To the second one, a texture for a solid wall is applied.
For example, if there is a two-storey building with the floor height of 3 meters, the UV shells for the second floor will be the following:
The texture for a wall with openings 3 meters high, so it will be tiled three times.
- For Roof, two textures should be applied: the base and detail albedo textures. Using the detail texture allows you to diversify colors of the 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 TextureDetail Albedo Texture
Materials Naming
For materials to be correctly applied by the Landscape tool to the generated buildings, the following rules should be kept:
- 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.
The other materials applied to different parts of the same building are inherited from this one. The base material can have any desired name.For this material, a texture depicting the Underground Pedestal, Pedestal and Ground Floor should be used.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:
- _level_1_blank - a material for the Ground Floor wall without doors and windows. Remember that a texture of this material should also depict the Pedestal and the Underground Pedestal.
- _level_2_complex - materials for the Upper Floors walls with doors and windows.
- _level_2_blank - materials for the Upper Floors walls without doors and windows.
- _roof - a material for the Roof.
For example, if you have 2 type of buildings that should have different materials, set up the following hierarchy:
1. Adding a Vector Data Source and Specifying Tags
This step is the same as Adding a Vector Data Source and Specifying Tags for Spline objects.
2. Specifying Parameters of Buildings
On the Sources panel, select the Vector data source type and the following settings will be displayed in the 2.5D Buildings tab of the Parameters panel.
- Add a basic object for generation by clicking Add button at the top of the Parameters panel and specify object's name. You can add as many objects as necessary.
- For each basic object specify the following parameters:
Vector tag The tag to be used for the selected object from the list of the tags specified at the first step. This tag is used to select data from the vector source. Floor number tag The tag that is used to read the number of building floors from the vector source. Floor height The height of a single floor of the generated buildings. The default value is 3 meters. Ground floor offset Height of the Pedestal. The default is 1 meter. Split length 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 exceed or equal to the size of the Play Area, a single static mesh will be generated. For example, if you specify 10000, for each 10000x10000 km cell a separate static mesh will be generated. Min Visibility Minimum visibility distance from the camera when generated objects (ObjectMeshStatic) start to appear on the screen. By default it is -inf. Max Visibility Maximum visibility distance when generated objects (ObjectMeshStatic) are no longer fully visible: they can either disappear completely or start to fade out. By default it is inf. Min Fade Minimum fade distance, over which generated objects (ObjectMeshStatic) fade in until they are completely visible. Along this distance the engine will automatically interpolate 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. Building category tag The tag that is used to read the building category from the vector source. According to values of this tag the buildings are materials. For example, you can specify the type tag here: the buildings of different types (garage, apartments, houses) will have different materials applied. Floors per texture The number of Upper Floors for which a single texture will be applied: - If the texture height is multiple of the height of a single floor, this value should remain 1. The texture will be applied for each floor.
- If the texture height is multiple of 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.
Materials Materials that applied to buildings generated for the basic object: - Building category - the category of buildings for which the material will be applied. Here a value of the Building category tag should be specified.
- Base material - the base material for the specified building category.
- Default - the flag indicating if the material of this building category should be used as the default one. It will be applied when there is no data in the vector source on the building category or no material is specified for the building category.
- Check the objects you added at the previous step to be generated.
If you are going to update some of the existing buildings, check only the changed ones. At that, the other buildings will remain the same after terrain regeneration.
4. Generating 2.5D Buildings
Now you can generate buildings by clicking Generate button and selecting Vector objects option in the Steps window, in this case only vector objects will be generated.
To regenerate some of the existing buildings, check only those objects that should be updated, click Generate and select Vector objects option. Only the specified buildings will be regenerated. At that, the other ones (that haven't been checked) will remain the same.