This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
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 Requirements

The terrain object is a regular 2D grid with the specified step. It has the assigned 32-bit height map with the following bits usage:

  • The height is stored with the 31-bit precision, which provides up to 2^31 height levels
  • 1 bit is used to indicate whether there is a hole in it or not
Notice
To simulate overhangs and caves use static meshes.

See Also

Terrain Size

The size of the terrain is calculated as (power of two + 1) × (power of two + 1), which is equal to the total count of terrain vertices.

  • The maximum size of a terrain is 32769 × 32769
  • The minimum size of a terrain is 257 × 257
Notice
The maximum size of a terrain available in Editor is 16385 × 16385, as it is almost impossible to create terrain textures of such sizes for modern graphics editors. You can still create a terrain of the size of 32769 × 32769 using the UnigineScript create() function.

A terrain dimension along the axis is determined by the (Cells count - 1) * Grid cell step formula.

X size, Y size, Grid cell step and Max height parameters determine the maximum slope angle, i.e. the number of vertices at a given relative altitude. The bigger the grid sizes, the smaller the step and the height, the steeper the terrain slope can be. However, sometimes it is more rational to create very steep cliffs with a separate mesh rather than to set very high density of a terrain grid.

Terrain File Format

Terrain data is stored in the following formats:

  • .ter file stores the meta information about a terrain object, such as bounding box of terrain, bounding boxes of surfaces and whether they are enabled or disabled. It also stores vertices of a coarse level.
  • .terxxxx files store information about heights in terrain surfaces (up to 8×8 maximum), as well as information about holes.

Terrain textures data is stored in the following formats:

  • _d.dds - coarse diffuse map
  • _n.dds - coarse normal map
  • _i.dds - index texture
  • _m.dds - coarse mask texture
  • 00x00_x.dds - per-surface diffuse, normal, index and mask textures. They are stored in a separate folder that is named after the terrain file.
Notice
It is recommended not to archive terrain files, as accessing them in real-time will result in slowing down both rendering (textures and height maps streaming lags) and physics calculations.

Terrain Textures

All of the textures have the following requirements:

Size (power of two + 1) × (power of two + 1) pixels
  • Minimum - 128 pixels.
  • Maximum - 8192 pixels.
Import Formats
  • Targa (.tga)
  • JPEG (.jpg)
  • Portable Network Graphics (.png)
  • Direct Draw Surface (.dds)
  • Photoshop Document (.psd)
  • Portable Pixmap (.ppm)
  • Portable Graymap (.pgm)
  • High Dynamic Range (.hdr)
  • Silicon Graphics Image (.sgi)
  • RGB (.rgb)
  • RGBA (.rgba)
Export Formats
  • Targa (.tga)
  • JPEG (.jpg)
  • Portable Network Graphics (.png)
  • Direct Draw Surface (.dds)
  • Photoshop Document (.psd)
Notice
For height, holes, diffuse, normal and mask textures only.

Height Map

A height map is a gray-scale texture that stores the height values for each point of a terrain, where dark pixels correspond to lower heights and bright pixels correspond to higher heights.

Depending on the methods of a terrain creation, there are several ways of a height map generation:

  • Import (either on creation or while editing). In this case you need to load the height map, created in the external specialized software or exported via UnigineEditor.
  • Creation. In this case you need to create a height map manually by using Terrain Editor.

The following color spaces for a height map are supported:

  • R8 - 256 height gradations
  • R16 - 65536 height gradations
  • RG8 - 65536 height gradations
  • R32F - 2^32 height gradations

Diffuse Texture

A diffuse texture is used to describe basic coloring of the whole terrain.

There is a base diffuse texture, diffuse textures for each layer, and the resulting diffuse texture for the whole terrain.

All of the default diffuse textures are generated automatically. Then, the base texture is imported via the Import tab or created in the Terrain Editor, and a layer texture is loaded via the Layers tab.

Normal Map

A normal map is used to grant correct lighting of a terrain.

There is a base normal texture, normal textures for each layer, and the resulting normal texture for the whole terrain.

All of the default normal textures are generated automatically. Then, the base texture is imported via the Import tab, and a layer texture is loaded via the Layers tab.

Specular Map

A specular map is used to store the light reflectance information.

Specular textures are available only for layers and are loaded in the Layers tab.

Index Texture

Index texture is an RGBA texture that stores a number of a detail material per channel (can have up to 16 channels). It is generated automatically and is changed automatically, if one of the mask texture has been changed.

Warning
The index texture must always be uncompressed.

Mask Textures

A mask is a texture which indicates whether a layer will is visible on that particular area or not.

There is a resulting mask for the whole terrain and separate one channel masks for each layer.

Notice
Mask and index textures must always have the same amount of channels.

Holes Texture

A holes texture is a simple one channel texture that indicates whether there is a hole or not. Black values correspond to holes.

Notice
Holes are cut per vertex and always have squared corners.

Terrain Textures Arrays

Diffuse, normal and specular arrays are generated automatically based on the loaded corresponding textures for layers.

Their sizes can be changed manually in the Layers tab.

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.

Last update: 2017-07-03
Build: ()