Height Map Assembly
Terrain Assembly System
The terrain is divided into tiles.
Tiles can be of different sizes depending on the distance to the camera.
Regardless of world size, they are all 64 texels.
At highest fidelity a texel is about 1 meter across, while at a distance it could be hundreds of meters across.
The tiles are actually 65 x 65 compressed to 64 x 64 with the overlap to simplify interpolation.
A texture is maintained as a lookup table to identify which texture in the arrays are for which tile.
Tile Map Arrays
As the camera moves around, requests are queued to add new tiles.
A list of tiles is maintained with each tile node addressing an array index for the tiles texture.
The splat, water, normal and diffuse maps use the same system.
This system is designed for large terrains where there will be terrain beyond view and background assembly is an inevitable requirement.
Using this system, as the camera moves closer to a chunk, the chunk will replace the tile with a higher fidelity one.
Likewise, lower fidelity will replace tiles as the camera moves away.
As this is a background process, rapid movement can lead to a delay while the tiles catch up to the camera position.
Travelling at speeds of up to 20 meters per second should be able to keep pace with the updating.
Basically, a Geforce 960 and reasonably new CPU requires 2 seconds per chunk to keep up.
Tile Map Format
The grass, sand and rock are procedurally textured.
The decals are what you'd traditionally call splat tiles.
Decals textured using this system can only blend into grass, sand or rock, not each other.
I think this is a reasonable compromise as I am more focused on the procedural texturing than a large variety of splatted textures.
The normal map is for rock displacement and not the actual normal for the final terrain.
When blending decals, I dont merge colours, a texel is either the decal or it isn't.
Blending is based on the displacement map for that texture (the alpha channel).
This way the gaps between rocks etc blend first, then finally the tops of the objects.
Blending is not interpolated but based on the decal displacement