Terrain: Terrain Entity – Arma Reforger

From Bohemia Interactive Community
Revision as of 16:31, 15 June 2022 by Lou Montana (talk | contribs) (Lou Montana moved page Arma Reforger:Terrain: Definitions to Arma Reforger:Terrain: Terrain Entity without leaving a redirect: Better name)
Jump to navigation Jump to search

TerrainEntity (abbreviated as TE in this document), class GenericTerrainEntity, is responsible for rendering terrain mesh and its textures.

Internally, TE is split into blocks and tiles and supports TE supports non-rectangular shapes of terrain as well, by clicking on "="(equal sign) user may set different grid size for X and Z axis.

A world can have 0 to 1 terrain - multiple terrains (e.g in order to avoid terrain size limitation) is not supported.

Visualization of Blocks & Tiles can be turned on from debug menu (holding ⊞ Win + Alt), Render → Terrain menu → Block's/Tile's bounding boxes.
Like any other entity, the Terrain entity must always be placed completely within world's bounds (world entity).

In case any part of terrain entity is sticking out of bounds rendering glitches may appear(eg. missing terrain blocks).

It is recommended (mandatory!) to place it at the 0,0,0 position!

Vertex

(Plural: vertices)

Block

A block is the smallest part of TE which gets LODed, as opposed to the Real Virtuality engine where terrain LODing was done on tiles level.

1 block = 1 draw call

Even though surface mask (for rendering detail surfaces) is split and mapped per tile, a limit of maximum 5 detail surfaces is being applied to blocks.

Enfusion engine currently supports 5 LODs per block.

Each block consists of 32x32 faces (33x33 vertices) down to 2x2 faces (3x3 vertices)

Tile

A tile may consist of 1 up to 32 blocks.

When the camera is close to a tile typically (if provided) terrain texture (satellite imagery), normal map and surface mask (detail surfaces) are being drawn. These textures are mapped per tile.

Once the camera is far enough from a tile so only terrain texture + normal map (no detail surfaces) are drawn, the whole tile is rendered as 1 draw call (all blocks are merged to one mesh, blocks doesn't even have to be in the last LOD). In the case camera is so far away that all blocks are in the last LOD the terrain mesh can be precalculated and does not have to be merged per frame.

Terrain Grid Size

Count of terrain faces in rows/columns, remember that 512 faces is 513 vertices, this necessary to keep in mind when importing heightmaps.

Grid Cell Size

Distance between two neighboring terrain vertices. The lower the value, the higher the detail of terrain.

Increasing/decreasing this value affects the final size of terrain.

Terrain Size

The terrain's total size is Terrain Grid Size multiplied by Grid Cell Size.

Heightmap

The terrain's heightmap is internally in 16 bits integer format and the height scale value is the difference between minimum delta, so e.g. difference between 100 and 101 in internal representation is 0.0315 as default. This value shows the maximum possible height of terrain, 0.03125 × 65535 (the 16 bit value) = ~2048 meters range.

Changing this value affects elevation range (the vertical range of the terrain).

The lower the value, the higher the precision, but smaller vertical range (and vice-versa).