This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
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
Materials and Shaders
Rebuilding the Engine Tools
GUI
VR Development
Double Precision Coordinates
API
Animations-Related Classes
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
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

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
  • Data compression support

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.
Notice
The Normal texture is based on the Height data.

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.

Depending on the size and resolution of your landscape, the size of the data can be quite large. You can use lossless and lossy compression options to reduce the size of the .lmap file.

Compression method options:

  • Our Method — recommended. UNIGINE compression method optimized for compressing 2D and 3D textures. It provides better results than LZ4 and Zlib without quality reduction.
  • Zlib — for high compression ratio (can provide up to 2 times higher compression ratio, but takes up to 20 times longer).
  • LZ4 — temporary option, planned to be removed in the upcoming releases.

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.

Select a mask to see its parameters:

Dithering Dither amount enabling you to reduce graphical artefacts caused by insufficient mask's bit depth or increased Mask Contrast value set per-detail. This Dither amount is multiplied by the global dithering amount.
Default Value Default value of the mask enabling you to skip import of single-color masks (e.g., a full white texture), thus lightening streaming load.
Mask by Albedo Select an albedo color of Landscape Layer Maps to be used as an additional filter for the mask.
Notice
Control opacity by using the Alpha channel of the Mask by Albedo color.
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 paint the opacity mask for each terrain component using the Brush Editor or specify it 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.

Notice
Opacity of Landscape Layer Maps that have no underlying layers (i.e. their Order is the lowest) is ignored.

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.

Combined with UNIGINE features for cooperative development (e.g. Node Layer, Node Reference), the system enables multiple artists to develop separate areas and layers of landscape of virtually any complexity simultaneously.

To prepare a world with a Landscape Terrain for collaborative editing via a VCS, follow this workflow:

  1. Prepare node layers:
    1. Create a new Node Layer for each Landscape Layer Map representing a static area of the landscape. For convenience, it is recommended to reset transformation of each Node Layer.
    2. Make each Landscape Layer Map a child to the corresponding Node Layer.
  2. After changing the content or parameters of any Landscape Layer Map, it only needs to save the parent node layer and commit the changed *.node asset and resources via your version control system.
  3. Upon checkout and world reloading, the changes will be applied and visible on workstations of other team members.
  4. Dynamic and repetitive Landscape Layer Maps (such as craters or chunks of tracks) can be saved as Node References.

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.

Adjust streaming settings to achieve appropriate performance of run-time terrain modification.

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. All tiles have the fixed resolution in video memory - 128×128 px.

Unoptimized streaming settings cause noticeable loading of tiles when the camera moves.

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 and Landscape Terrain Optimization articles.

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.

Customizing Terrain Surface#

Integration of static meshes into the landscape is simpler with the use of Terrain Lerp feature.

Enabled Terrain Lerp state of the mesh_base material marks an object to be covered by projected textures of the Landscape Terrain what makes it unnecessary to set up materials for its surfaces.

The feature is suitable for creating any insets such as caves and tunnels through mountains on the terrain. As an example, on the picture below a tunnel is integrated by just cutting some area of the terrain with a decal and replacing it with a mesh with the Terrain Lerp parameter enabled.

A mesh integrated in a terrain with the Terrain Lerp enabled.

Video Tutorial: Landscape Terrain#

Last update: 2023-12-19
Build: ()