Video Tutorials
Interface
Essentials
Advanced
Полезные советы
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Программирование
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
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

Landscape Terrain

The Landscape Terrain system provides advanced simulation of terrain - the most important object in outdoor scene rendering. Object Landscape Terrain allows reconstructing practically any arbitrary landscape with diverse features:

  • Virtually infinite terrain surface
  • Extreme details up to 1 mm per pixel
  • Adaptive hardware tessellation with displacement mapping
  • Dynamic modification at run time - craters, funnels, trenches
  • Simple and clear API
  • Up to 1024 detail materials
  • Layers system with flexible blending rules
  • Binoculars/scopes support (x20 / down to 1-degree FOV)
  • Optimized rendering and physics performance
  • Support for simultaneous editing by a team of 3D artists
  • Decal-based holes

The Landscape Terrain system is based on the principle of decomposing terrain graphic data that is too large to fit in the graphic memory in its entirety into smaller rectangular sections known as “tiles”. Asynchronous streaming of these tiles makes it possible to render only necessary data at a full level of detail, regardless of the camera's field of view with multiple cameras supported. Flexible streaming settings make it possible to configure terrain rendering even for computers with a limited VRAM capacity.

FOV

Notice
To simulate overhangs and caves, use static meshes.
Warning
DirectX is the recommended graphic API for projects that use the Landscape Terrain system. If you are using OpenGL consider adjusting the render settings.

See Also#

Landscape Terrain Operation#

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

  • Landscape Terrain Object is represented by an infinite plane. It is the main node, which is responsible for visualization and calculations: this object renders geometry and graphic data presented in the world and provides intersection detection settings. Also, it stores detail data.
    Notice
    There can be several Landscape Terrain objects in the scene, but only one of them (active) shall be rendered.
  • Landscape Layer Map nodes store arbitrary graphic data used for rendering (height, albedo, and masks) and represent rectangular terrain layers that can be arranged in the scene and blended with each other, thus composing the landscape.

Graphic data from Landscape Layer Maps and details (original full-size textures and generated mipmaps) are asynchronously streamed and transferred to the main Virtual Texture, based on which the Landscape Terrain is rendered. The Virtual Texture consists of 3 components:

  • Albedo — an RGBA8 texture defining the landscape color data,
  • Normal — an RGBA8 texture, which stands for small details on the landscape surface,
  • Height — an R32F texture defining the height data, according to which the landscape geometry is tessellated.

Output of the Render Textures helper. The Terrain Virtual Texture section contains Landscape-related textures.

Creating a Terrain#

To create a landscape terrain in UnigineEditor perform the following actions:

  1. In the Create menu, select Landscape -> Landscape Terrain. Click somewhere in the Editor Viewport to add the terrain.

    Landscape Terrain is created with a Landscape Layer Map as a child.
  2. Set up Height, Albedo and Masks data for the Landscape Layer Map(s), adjust via Brush Editor.
  3. To add another layer (an inset), click Create -> Landscape -> Landscape Layer Map.

Layer Maps#

Landscape Layer Maps represent rectangular terrain layers. By creating and arranging one or several layer maps you define the look and functionality of the terrain.

Each LandscapeLayerMap node refers to an .lmap asset which stores a set of textures:

  • Heightmap used to generate the geometry of Landscape Terrain,
  • Albedo texture representing color data,
  • Up to 20 single-channel masks.

Albedo and Heightmap are the primary terrain components defining its look and shape, masks provide additional features. Please note that the density of the terrain graphic data is limited by the render parameters regardless of the density of the source textures.

All components of a Landscape Layer Map can be edited via Brush Editor.

Masks#

Landscape Layer Maps can store up to 20 masks composing terrain layers that are not visible directly but can be used in certain graphical and logical tasks.

Landscape Layer Map is designed as a shared data pool, mask data of which can be used to add details to the Landscape Terrain surface, used in logic (e.g. as a landcover classification map) and by other objects as well, such as Grass, for example.

An example of a biome with details based on masks.
Notice
To preview a landscape mask, go to Helpers -> Landscape Masks and choose the desired mask. Also, you can use the render_show_landscape_mask N console command, where N is the index of a mask from 1 to 20.

Masks are named for convenience, names of masks are synchronized with the ObjectLandscapeTerrain currently used. You can rename each mask via both the ObjectLandscapeTerrain parameters (by double-clicking the mask title and typing a new name) and the LandscapeLayerMap parameters in the corresponding Name fields with no reimport required.

Names of masks are synchronized with ObjectLandscapeTerrain.
Notice
Names of masks are stored by Landscape Terrain objects, i.e. names shown in the parameters of a Landscape Layer Map will change in correspondence with the current enabled Landscape Terrain.

Each mask can be represented by a single-channel image. For optimization purposes mask data is stored in blocks - RGBA8 images (each containing 4 masks, one mask per each channel). There are 5 blocks, as the terrain has 20 masks available. Thus, the data of the 9th mask shall be stored in the R-channel of the third block (index = 2). The following parameters display the info on the corresponding mask texture and can be used to access the mask via API:

Mask Texture The index of the mask block used.
Channel The channel of the mask texture used.

Blending Layer Maps#

When overlapping each other, Landscape Layer Maps are blended per component providing convenient development workflow. The following blending modes can be set for each texture of a Landscape Layer Map individually:

  • Additive — data of the layer map is added atop.
  • Alpha Blend — the colors of this layer map and the underlying one are blended.
  • Overlay — added data replaces the data below it.
  • Multiplicative — the albedo colors are multiplied.
Notice
Heightmap supports only the Additive and the Alpha Blend modes.

Additionally, it is possible to specify an opacity mask for each texture (provided the Data Filling mode is set to From Tileset). For this purpose, specify a texture and its channel to be treated as the opacity mask for the corresponding texture:

The order of blended layers matters, use the higher Order value for layer maps that should be on top.

Layer maps can vary in density and size, so it is easy to create insets of different quality and modify the terrain surface at run time.

Collaborative Editing#

Blending of separate layer maps makes the Landscape Terrain system friendly for collaborative editing. A team of 3D artists can design separate layer maps simultaneously and develop a large landscape piece by piece without conflicts.

In addition to other UNIGINE features for cooperative development (e.g. Layer, Node Reference), different parts of scenes of virtually any complexity can be developed simultaneously by multiple artists.

Run-Time Modification#

Vehicles leaving tracks while moving or even an excavator digging trenches are easy to implement. Two ways of run-time terrain modification are available:

  • By adding layers. Spawn new Landscape Layer Maps representing chunks of trenches or pits to modify the terrain surface. This way is similar to using Decals: each layer is a separate node, so you can control each modification separately. Furthermore, using Landscape Layer Maps implies no data density limits, enabling you to achieve realistic results with high-quality insets.

  • By modifying terrain buffers. Low-level terrain CPU- or GPU-based modification via API is as simple as 1, 2, 3:
    1. Set the desired area, and the Engine copies a part of terrain data for this area to a buffer.
    2. Modify the buffer as you want (height, color, masks, or all of them at once).
    3. Upon completion the Engine pastes the buffer back to the terrain replacing old data.

    For more details on performing run-time CPU- and GPU-based modification, please refer to the Landscape Class article.

Tiling and Streaming#

A scene may contain thousands of Landscape Layer Maps, so the full-size graphic data of the Landscape Terrain may be too large to fit in the video memory in its entirety. Instead all resources are decomposed into smaller rectangular sections — tiles of variable density depending on the distance to the camera.

Individual tiles are asynchronously loaded into the main virtual texture when necessary — only if currently seen by the camera — from the lowest to the highest available MIP level.

Thus, the Landscape Terrain detail level and performance are highly affected by the number of viewports and their resolution. When developing a project using a Landscape Terrain, performance and memory consumption should be considered and tuned for the set of cameras and screen resolution of the target platform.

Flexible streaming settings make it possible to configure terrain rendering even for computers with a limited VRAM capacity, but these settings depend on the content used (distances, level of detail, etc.) and requirements (the number of cameras and viewports, etc.) and are to be adjusted for each project individually.

For more details on configuring streaming settings, please refer to the Configuring Visualization and Performance article.

Details#

Landscape Terrain Object stores visual settings for 20 detail masks intended for reaching better level of visual quality in close up views. Details represent arbitrary albedo, roughness and height (displacement) data, so you can drastically improve the look of the landscape terrain. Details are applied according to masks of Landscape Layer Maps.

Notice
If your project requires detection of collisions with the terrain surface, you should keep in mind that Details don't participate in Intersection and Collision Detection, so it's not recommended to apply intense displacement using details since visual inconsistency may appear.

Detail settings available in ObjectLandscapeTerrain parameters allow defining the detail visual appearance, adding up to 1024 details to a mask and defining the material of each detail.

Detail parameters are available on the Node tab of the ObjectLandscapeTerrain parameters.

For more information on adding details, please refer to the Configuring Details article.

Intersections and Collisions#

The Landscape Terrain system provides intersection and collision detection with the terrain surface the same way as for usual meshes. To enable collisions and/or intersection detection for a landscape:

  • Turn on the Collider Object flag on the Node tab.
  • Switch to the Surface tab and enable the Intersection and Collision flags, configure the bit masks.
  • For landscape layer maps that should take part in collisions and intersections enable the corresponding Collision and Intersection flags.
Notice
Details don't participate in Intersection and Collision Detection.

Intersections are detected with a variable precision, starting from a lower value and ending up with a higher one.

Normally there's no need to modify these values. In case of intersection detection errors you can open Landscape Terrain parameters and try tweaking start and end precision values and enable cubic filtering of textures for optimum balance, but be careful as it may significantly affect performance and accuracy:

Collision Bicubic Filter Enables bicubic filtering of textures for collision detection.
Intersection Bicubic Filter Normal Enables bicubic filtering of the normal texture for intersection detection.
Intersection Bicubic Filter Height Enables bicubic filtering of the height texture for intersection detection.
Intersection Precision Begin Starting precision of intersection detection.
Intersection Precision End Ending precision of intersection detection.

Decal-Based Holes#

In some cases you may need to cut out an area of the terrain surface. For this purpose the Decal-Based Holes feature is supported by Landscape Terrain.

Make sure the Holes feature is enabled and place any decal (orthographic, projected or a mesh one) with the decal_terrain_hole_base material assigned over the desired location:

  1. In the Create menu, select Landscape -> Hole Projected (or another one). Click in the Editor Viewport to add the decal.

  2. Adjust the transform and material parameters of the decal.

This will create a hole in the Landscape Terrain surface.

A decal-based hole with a circle mask applied.

Accurate intersection with decal-based terrain holes is supported, enabling collision detection as well as all corresponding Editor features such as selection, snapping to surface, etc.

Notice
Intersection and collision accuracy significantly depends on the terrain polygon count. The higher the number of polygons, the higher the accuracy.

Video Tutorial: Landscape Terrain#

Last update: 10.07.2020