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
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

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.

There are two types of visibility levels of the terrain that depend on the distance:

  • A coarse level is the furthermost from the camera and the least detailed. Textures of that level are always stored in the memory and allow renderer to effectively render extremely large terrains.
  • A refined level is closer to the camera and more detailed. When a terrain is created, its grid is automatically divided into smaller refined chuncks of 257×257 vertices in size (shown in the Refined tab). Each surface has a unique set of textures, which, in fact, are parts cut out from the imported textures. Parameters of each surface can be modified either together or separately.

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.

You need only 1 height map for a whole terrain object.

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

When you add a new layer and load textures for layer, the engine automatically generates arrays of diffuse, normal and specular textures. Arrays consist of textures of all layers.

The size of arrays 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: ()