shown in other instead.
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
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
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.
All of the textures have the following requirements:
|Size||(power of two + 1) × (power of two + 1) pixels
For height, holes, diffuse, normal and mask textures only.
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
A diffuse texture is used to describe basic coloring of 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.
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.
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 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.
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.
A holes texture is a simple one channel texture that indicates whether there is a hole or not. Black values correspond to holes.
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.
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.