This page has been translated automatically.
Unigine Basics
1. Introduction
2. Managing Virtual Worlds
3. Preparing 3D Models
4. Materials
5. Cameras and Lighting
6. Implementing Application Logic
7. Making Cutscenes and Recording Videos
8. Preparing Your Project for Release
9. Physics
10. Optimization Basics
11. PROJECT2: First-Person Shooter
13. PROJECT4: VR Application With Simple Interaction
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.

Creating a Landscape

So far, the car has been moving on the test plane. However, the game needs a vast and variegated open space with various, so let's add a landscape to the scene.

For this purpose we'll use terrain — a special type of geometry object designed for creating landscapes. The main object for working with landscape in UNIGINE is Landscape Terrain. It is optimized for vast areas and uses the material with specific texture blending to realistically simulate natural and artificial surfaces: soil, rocks, asphalt, paving stones, etc. Typically, it serves as the foundational element for open-world games, providing a basis for static geometry placement and character movement.

The Landscape Terrain system is represented by two types of nodes:

  • Object Landscape Terrain — a virtual object ensuring the terrain rendering.
  • One or several Landscape Layer Map objects — layers with the terrain graphic data. The layer system allows you to combine and mix layer data in different order, as well as to place high-detailed layers of small size over large low-detailed layers (the so-called inset).

To create a terrain, you need a set of the following textures created in third-party software:

  • Height map — terrain height data
  • Albedo — colored terrain surface texture
  • Masks — a set of masks that can be used to arrange plants and apply additional detail
  • Albedo, Roughness, and Height textures for each additional detail

You can model a fairly simple terrain by drawing it manually using the UnigineEditor's built-in landscape editor. However, realistic natural terrains are usually created in specialized software such as: Quadspinner Gaea, World Machine, World Creator, SideFX Houdini, etc. Using these tools, you can simulate a suitable landscape and get a set of textures that define the shape and color of the terrain for the game engine.

Terrain in Quadspinner Gaea

Terrain in Quadspinner Gaea

For this tutorial, you can use the ready-made textures available in the race/terrain folder.

  1. In the menu, select Create → Landscape → Landscape Terrain and add it to the scene. Two new nodes will appear in the world hierarchy: ObjectLandscapeTerrain — the terrain itself, and LandscapeLayerMap — the layer with data. The standard terrain layer is represented by a colorless plane with the size of 1000×1000 m. The ground_plane test plane can be disabled for convenience.
  2. Set the Size of this layer to 5000 × 5000 m.
  3. Find the ready-made terrain textures in the race/terrain folder. In the Parameters tab of LandscapeLayerMap, click the + button in the Landscape field to create and apply a new *.lmap asset that will store data of our terrain layer.

  4. In the import settings, for Data Filling select From Tileset and add the source textures for the terrain:

    1. Height map in the Heightmap field. Here you also need to set the terrain layer height Max: 1000 meters.
    2. Albedo texture in the Albedo Color field.
    3. Each of the 6 masks from the race/terrain folder is added to an individual slot in the Masks section. For easier customization, we recommend to name each mask accordingly.

    4. Click Reimport Data to load the selected textures.

Landscape Terrain has the Collision and Physics Intersections options enabled by default (your can check this by selecting the ObjectLandscapeTerrain node and viewing the Surfaces tab in parameters), so the car will be able to drive on it without any problems.

Details#

No matter how large the textures used for the surface are, the data density still won't be enough for a terrain 5 kilometers on a side. The data density is too low when viewed from the surface.

One solution is to split the original high-resolution textures into a set of tiles and use them for creating a terrain. However, even with a total resolution of 65536×65536 pixels (8×8 tiles with the size of 8192×8192 each), the density of the texels will barely exceed 13 pixels per meter. This is also not enough.

For high detailing of the surface we use terrain details — additional materials that can be mixed based on the terrain masks: the grass mask defines where the detailed grass texture will be located, the same is done for rocks, soil, sandstone, etc.

Notice
To view the terrain masks, go to Helpers → Show Landscape Data.

Select the ObjectLandscapeTerrain node and go to the Details parameter section. You can add as many details as you want for each mask:

  1. After selecting a mask, click "+" on the panel to add a detail layer.

  2. Then click "+" on the detail material panel to add a new editable material.
  3. In the race/terrain/details/textures folder there is a set of textures to recreate different natural surfaces. Use the Albedo, Roughness and Height textures to make each masked area look unique.
  4. Pay specific attention to the following parameters:

    • Size — the size of one tile of the detail. Higher values increase the layer size.
    • Scale — the intensity of the height displacement. Higher Scale values make the geometry irregularities more protruding.

Customizing details is a completely artistic task. Usually at least one detail layer needs to be assigned to each mask in order to cover the entire terrain surface. Detail layers, as well as masks, can be swapped if a different order of layers is required.

For convenience, the project already contains ready-made materials for the details (race/terrain/details) that are to be assigned to the detail layers in the corresponding masks.

After customizing the details, the data density is much higher and the terrain looks more natural.

Notice
All terrain components, and masks in particular, can be edited using the built-in landscape editor. Switch to Landscape Paint Mode, select a layer to paint on, a terrain component (Albedo, Height, or one of the masks) and a brush, and try editing it manually by painting on the terrain surface. To save changes, simply switch back to Object Mode.

Vegetation#

To diversify the landscape, let's add vegetation. Use the ready-made tree and grass assets from the race/vegetation folder.

Adding trees:

  1. Right-click on the trees_clutter.node asset from the trees folder, select Place as Node Content in the context menu and add the asset content to the scene.
  2. In the World Nodes window, drag the trees_clutter node to ObjectLandscapeTerrain to make the trees children of the terrain, and reset the position to align the trees with the terrain (the terrain itself and the LandscapeLayerMap node are also located in the origin).

  3. Trees (the trees_clutter node) are represented by the Mesh Clutter object that arranges polygonal meshes procedurally on a rectangular area according to the the specified parameters. In addition, this node is a child of the terrain object and the Intersection option is enabled in the object settings, so the trees automatically follow the surface of the terrain.
  4. In the object settings, find the Mask Terrain parameter: use it to select the terrain mask that will be used to arrange procedural trees. It can be the Grass mask or any other mask at your choice.
  5. Rendering multipolygonal trees at a great distance from the camera can significantly impact performance. To address this, the Grass object is added as a child node to the trees to handle rendering of impostors. This object has the same settings as the Mesh Clutter object, ensuring that each tree is replaced by its "photo" when viewed from a distance. In the Mask Terrain parameter of the Grass object's settings, select the same mask in the first of the four lists (since impostors only use one type of texture out of four possible) that was selected in the previous step.

Add the contents of the grass/grass_clutter.node asset in the same way to generate grass on the terrain surface. Grass is also represented by Mesh Clutter objects (grass_close, grass_far) that procedurally arrange bunches of polygonal grass.

Last update: 2024-04-19
Build: ()