Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and 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
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes

Global Terrain

Global terrain is a virtually limitless terrain representing a certain fragment of Earth's surface generated on the basis of GIS data. This means that appearance of the global terrain object is determined by the accuracy and availability of geospatial data. It should be noted that there are areas of Earth's surface with only low-resolution data available or even no geospatial data at all.

This type of terrain can be successfully used for flight simulators: most of the time the plane remains at a very high altitude and low-resolution data is sufficient. High-resolution data is necessary only around landing and take-off areas.

Notice
  • There can be only one Global Terrain object on the scene.
  • Memory consumption increases significantly when several viewports are used.

Notice
To simulate overhangs and caves use static meshes.

See Also

Terrain Structure

Global terrain is represented by the following data layers:

  • Height data generated on the basis of GIS elevation data.
  • Albedo data generated on the basis of GIS satellite imagery data.
  • Normal data generated on the basis of height data.
  • Masks data generated on the basis of landcover data.

Tiling

Global terrain has a regular grid and is represented as a tileset. Each tile has a fixed size of 128 x 128 pixels. The number of tiles in each dimension (X and Y) is determined by the area size and GIS data resolution. The higher the resolution the more tiles will be generated for the corresponding tileset.

E.g. suppose we have a height data texture with the resolution of 100 meters per pixel for an area of 50 square kilometers. Thus, we need (50000/100) x (50000/100) = 500 x 500 pixels which can be covered by 4 x 4 tiles.

Notice
The maximum number of tiles for each of the data layers is limited to 16384.

The tiles around the viewpoint are loaded automatically according to visibility distance. Visible tiles change as the viewpoint moves along the terrain.

Changing visible tiles while moving the viewpoint.

LODs

A level of detail (LOD) system automatically adapts the available resolution of terrain grid according to the distance and loads corresponding tiles.

Every particular data layer has its own number of LODs. Each LOD of a particular data layer is represented by a separate tileset and has a number of parameters according to data layer type. Each LOD has its own resolution (in meters per pixel) which determines the size of its tileset.

Notice
The maximum number of LODs for each of the data layers is limited to 32.

LODs are loaded and and cleared in accordance with corresponding distances specified in the TerrainGlobal tab. These distances are be used to avoid delays and provide smoothness when switching between LODs as well as to ensure efficient memory use.

Resolution and visibility distance together determine the number of tiles to be loaded around the viewpoint.

Blending of LODs

As it was mentioned, there might be no data available for a more detailed LOD of a certain area. In this case the values of the two adjacent LODs are blended together to provide a smooth look without sharp edges or black holes. Blending is performed by means of linear interpolation on the basis of masks generated by the Landscape Tool for a certain tile.

Notice
Masks are generated only for those tiles that contain the border between areas with different resolution.

Let us consider the following example. Suppose we have two LODs:

  • LOD1 with the resolution of 100 meters per pixel - green area.
  • LOD0 with the resolution of 30 meters per pixel - orange area.
In this case masks will be generated only for the tiles marked with M.

Creating a Global Terrain

You can only create a global terrain object using a Landscape Tool. To do it via UnigineEditor perform the following actions:

  1. Run UnigineEditor.
  2. On the Menu bar, click Windows -> Landscape .

  3. In the Landscape Tool window that opens, do the following:

  4. Right-click on Elevation in the Data Sources section, select Add New... and specify a path to a file with GIS elevation data in the following window.

  5. Right-click on Imagery in the Data Sources section, select Add New... and specify a path to a file with GIS imagery data in the following window.

  6. Select Play area in the Settings section.
  7. Using a global map in the middle of the window move the bounding rectangle to the area that contains specified GIS data.

  8. Specify Play area size so, that it would cover the area with specified GIS data.
  9. Select Files in the Settings section and specify an Output path to store generated terrain data.

  10. Save your settings in an asset using the main menu File - > Save Asset and click Generate button.
  11. Upon completion of generation process a new GlobalTerrain object will be placed on the scene.

See also the Landscape Tool article to learn more.

Terrain Parameters

Global terrain parameters can be adjusted via the TerrainGlobal tab of the Nodes window. Each data layer contains a list of LODs with corresponding parameters.

Height Data

Parameters of a certain LOD of the height data layer can be accessed via the Height tab of the TerrainGlobal tab of the Nodes window.

TerrainGlobal parameters, Height tab.
  • Enabled - enable or disable the current height LOD.
  • Intersectable - enable or disable intersection detection for the current height LOD.
  • Collidable - enable or disable collision detection for the current height LOD.
  • Viewport - viewport mask for the current height LOD.
  • Intersection - intersection mask for the current height LOD.
  • Collision - collision mask for the current height LOD.
  • Path - path to a folder, in which the current height LOD is stored.
  • Visibility distance - the distance starting from which the tiles of the current height LOD become visible.
  • Load distance - the distance starting from which the tiles of the current height LOD are loaded into memory.
  • Clear distance - the distance starting from which the tiles of the current height LOD are removed from memory.
  • Video memory usage - memory consumption of the current height LOD.

Albedo Data

Parameters of a certain LOD of the albedo data layer can be accessed via the Albedo tab of the TerrainGlobal tab of the Nodes window.

TerrainGlobal parameters, Albedo tab.
  • Enabled - enable or disable the current albedo LOD.
  • Viewport - viewport mask for the current albedo LOD.
  • Path - path to a folder, in which the current albedo LOD is stored.
  • Visibility distance - the distance starting from which the tiles of the current albedo LOD become visible.
  • Load distance - the distance starting from which the tiles of the current albedo LOD are loaded into memory.
  • Clear distance - the distance starting from which the tiles of the current albedo LOD are removed from memory.
  • Video memory usage - memory consumption of the current albedo LOD.

Normal Data

Parameters of a certain LOD of the normal data layer can be accessed via the Normal tab of the TerrainGlobal tab of the Nodes window.

TerrainGlobal parameters, Normal tab.
  • Enabled - enable or disable the current normal LOD.
  • Viewport - viewport mask for the current normal LOD.
  • Path - path to a folder, in which the current normal LOD is stored.
  • Visibility distance - the distance starting from which the tiles of the current normal LOD become visible.
  • Load distance - the distance starting from which the tiles of the current normal LOD are loaded into memory.
  • Clear distance - the distance starting from which the tiles of the current normal LOD are removed from memory.
  • Video memory usage - memory consumption of the current normal LOD.

Masks Data

Parameters of a certain LOD of the masks data layer can be accessed via the Masks tab of the TerrainGlobal tab of the Nodes window.

TerrainGlobal parameters, Masks tab.
  • Enabled - enable or disable the current masks LOD.
  • Viewport - viewport mask for the current masks LOD.
  • Path - path to a folder, in which the current masks LOD is stored.
  • Visibility distance - the distance starting from which the tiles of the current masks LOD become visible.
  • Load distance - the distance starting from which the tiles of the current masks LOD are loaded into memory.
  • Clear distance - the distance starting from which the tiles of the current masks LOD are removed from memory.
  • Video memory usage - memory consumption of the current masks LOD.

Terrain Data Storage Format

Generated terrain data is stored in the specified folder with the following structure:

Notice
You can extract data from .UTS tileset files using the TilesetFile console tool.
  • detail masks
    • lod0
      • data.uts + data.utsh - tileset containing details data for all tiles of the terrain LOD.
      • masks.uts + masks.utsh - tileset containing mask layout data for the details terrain LOD.
  • heights
    • lod0
      • data.uts + data.utsh - tileset containing height data for all tiles of the terrain LOD.
      • masks.uts + masks.utsh - tileset containing mask layout data for the height terrain LOD.
  • imagery
    • lod0
      • data.uts + data.utsh - tileset containing imagery data for all tiles of the terrain LOD.
      • masks.uts + masks.utsh - tileset containing mask layout data for the imagery terrain LOD.
  • normals
    • lod0
      • data.uts + data.utsh - tileset containing normals data for all tiles of the terrain LOD.
      • masks.uts + masks.utsh - tileset containing mask layout data for the normals terrain LOD.
  • landcover masks for each type of generated landcover objects stored in separate folders with the corresponding names.
  • vector_data masks for each type of generated vector objects stored in separate folders with the corresponding names.

Global Terrain Physics Simulation

The terrain takes part in physics simulation if it has a standard surface_base property assigned. Collisions with physical bodies use the most detailed LOD 0 and are handled within a set distance, where simulation of physics is in effect.

Physical interaction can also be enabled for each of the height LODs by setting collision and intersection flags and masks.

Notice
To provide the most accurate collision detection use the most detailed LOD.

Collisions are calculated for untesselated terrain geometry which may differ from the rendered geometry that is seen. Thus, in certain cases objects may seem "flying" above the terrain surface.

Notice
Hardware tesselation is controlled by the GPU, not the engine. Therefore, tesselated geometry may vary.
Last update: 2017-10-20