Game Editor (Workbench) Terrain In Engine
Terrain In Engine
Basis of Terrain
Terrain in engine is represented by height map, which must be multiple of the size of the block of terrain.
This size is 33x33 vertexes (32x32 quads ), neighbouring blocks share edges.
This means that total size of terrain is 32x + 1 vertexes (513x513, 1025x1025 etc.)
One block is basis for terrain rendering.
Tile is a area with blocks which are sharing one set of global texture.
The reason for this separation are limits of today HWs, so we have (virtually) global texture much much bigger than today HWs can handle.
Resolution of texture can be set up in Texture Manager in GameEditor.
Example
Terrain of size 513x513 pixels, contain 4x4 tiles, every tile is build-up from 4x4 blocks. Size of texture in tile is for example 2048x2048.
The total resolution of texture in terrain is (4x4)x(2048x2048) texels, so it is 8192x8192 pixels.
Global Textures
There are three Global Textures
Normal Texture
Defines normal vectors of whole terrain ( the main reason why the normals are not on vertexes is LODing of terrain - the intensity of lighting on removed vertexes while LODing ) Normal is in RGB channels, in A channel can be static shadow map which can be generated in GameEditor → Texture Manager.
SuperTexture
Can be original satellite map or it can be generated from actual detail layers of terrain. It's used for displaying landscape from far distance.
Layer Texture
Texture which defines how detail texture coverage the terrain. Detail textures are rendered step by step by channels in this (layer) texture. First will be draw the default texture of block, than others by visibility defined in each of the channels - B, G, R and as last A.
Example
The picture shows example of terrain of 129x129 size, distance between vertexes is 160 unit (5 meters), so the total size of terrain is 645x645 meters.
In total is on terrain 4x4 blocks and 4 tiles, every tile contains 4 blocks.
On the bottom you can see all used global textures. Each texture is compose from 4 (tiles) physical textures.
Shadow map is saved in alpha channel in normal map.