This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
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.

Terrain

A Terrain is a console tool for creating a Unigine-native terrain from a height map, and vice versa. (Created terrain objects can be loaded into the engine via the Load option.)

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

Command Line Options

A Terrain tool recognizes the following command line options:

  • -o NAME — name of the output file.
  • -n NAME — name of the output normal map. It is created from a height map to illuminate the terrain.
  • -s STEP — step for the terrain grid. The default is 1 unit.
  • -h HEIGHT — maximum height of the terrain. The default is 1 unit. (Make sure that you set this value as low as possible.)
  • -d DISTANCE — distance to the first LOD tile of the terrain. The default is infinity (no optimization).
  • -t THRESHOLD — flatness threshold to optimize rendering of flat areas of the terrain. The default is 0 (no optimization).

Input and Output Formats

All mesh formats that can be converted into Unigine meshes are supported. A list of such formats is available here: Supported File Formats.

The following output formats are supported:

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

The height map needs to be of a power-of-two + 1 size (such as 257 × 257 or 513 × 1025). The possible formats are the following:

  • R8 - a simple height map with 256 height gradations.
  • R16 - a height map with 65536 height gradations.
  • RG8 - a height map with 65536 height gradations.
Notice
A height map created from a terrain is of the R16 format.

The height map can have the following extensions:

  • Direct Draw Surface (DDS)
  • Targa (TGA)
  • Portable Network Graphics (PNG)
  • PhotoShop Document (PSD)
  • Portable pixmap format (PPM)
  • Portable graymap format (PGM)
  • JPEG (JPG)

Usage

On Windows the syntax would be:

  • To create a terrain from the height map:
    Shell commands
    terrain_x86.exe heightmap.png -o terrain_name.ter
  • To create a height map from the terrain object:
    Shell commands
    terrain_x86.exe terrain_name.ter -o heightmap.png

On Linux and Mac OS X the syntax would be:

  • To create a terrain from the height map:
    Shell commands
    terrain_x86 heightmap.png -o terrain_name.ter
  • To create a height map from the terrain object:
    Shell commands
    terrain_x86 terrain_name.ter -o heightmap.png

Step-by-Step Example for Windows

To create a terrain object form a height map, you need to do the following:

  1. Open the command-line console. For that, click Start→>Run and type cmd. Click OK.
  2. Specify a tool to be run. For Windows, it would be:
    Shell commands
    terrain_x86.exe
  3. Specify a hight map from which the terrain will be created.
    Shell commands
    terrain_x86.exe "D:\Raw\heightmap.tga"
  4. Specify a name and path to the created terrain.
    Shell commands
    terrain_x86.exe "D:\Raw\heightmap.tga" -o "D:\UnigineSDK\data\my_terrain.ter"
  5. Specify a name of the normal map to light the terrain.
    Shell commands
    terrain_x86.exe "D:\Raw\heightmap.tga" -o "D:\UnigineSDK\data\my_terrain.ter" -n "D:\UnigineSDK\data\normal_n.dds"
  6. Now we need to specify terrain options. For example, set the grid step to 0.5 units.
    Shell commands
    terrain_x86.exe "D:\Raw\heightmap.tga" -o "D:\UnigineSDK\data\my_terrain.ter" -n "D:\UnigineSDK\data\normal_n.dds" -s 0.5
  7. Set the maximum height your terrain has. For example, 70 meters.
    Shell commands
    terrain_x86.exe "D:\Raw\heightmap.tga" -o "D:\UnigineSDK\data\my_terrain.ter" -n "D:\UnigineSDK\data\normal_n.dds" -s 0.5 -h 70
Last update: 2017-07-03
Build: ()