UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials

TerrainRelax

TerrainRelax is a console tool for baking flattened height maps.

Just like interactive Flatness option of the Terrain object, it allows to optimize rendering of level terrain areas by merging them into one large polygon. However, unlike Flatness option, baking the hight map with flattened polygons allows for proper intersections with the optimized relief. Grass, WorldClutter and WorldCluster will not have any visual artifacts when applied to the flattened terrain.

To invoke TerrainRelax, run terrainrelax_x86.exe (in Windows) or terrainrelax_x86 (in Linux) from a command-line console (the 64-bit version has x64 postfix).

How It Works

TerrainRelax tool works in the following way:

  1. As an input file, a height map (in R8, RG8 or R16 format) is specified.
  2. Other command line options are specified.
  3. TerrainRelax flattens heights according to the specified threshold and outputs the flattened height map.

Command Line Options

The following command line options are recognized:

  • -o NAME — name of the output file.
  • -t THRESHOLD — height between the polygons (measured in in heights gradations rather then units). If the height difference between two polygons of the terrain is smaller or equal to this value, the polygons are merged into one. The higher the flatness threshold value, the larger terrain polygons are and the less detailed the relief is. The default is 0.

Height Map Formats

The following image formats are supported for height maps:

  • Portable Network Graphics (PNG)
  • PhotoShop Document (PSD)
  • Direct Draw Surface (DDS)

An input height map can be in R8, RG8 or R16 format; the output image will be of the same one.

Usage

The syntax for Windows is:

Shell commands
terrainrelax_x86.exe OPTIONS FILE

The syntax for Linux is:

Shell commands
terrainrelax_x86 OPTIONS FILE

Type of an output file is determined based on its extension (see the -o option).

Example

The following creates a flattened height map:

Shell commands
terrainrelax_x86.exe -t 32 file.png
Last update: 2017-07-03