L3DT documentation
Large 3D terrain generator

Texture splatting

Texture splatting is a technique by which the texture of an object is calculated at run-time from a set of base textures and a set of alpha maps or a suitable mathematical function. For a good discussion of how texture splatting works, please refer to this GameDev article by Nate Glasser.

Splatting has several advantages over using pre-calculated textures:

  • You can, in principle, achieve unlimited texture resolution.
  • By calculating textures on-the-fly, you obviate the need to store and manage 10s - 1,000s of Mb of high-res pre-calculated textures.
  • You can easily modify textures at run-time (eg. adding burn-marks on ground, etc).

Splatting is standard for most commercial computer games these days. Some nice examples include Far Cry by UbiSoft, and World of Warcraft by Blizzard Entertainment.

John Carmack's id Software has moved away from texture splatting in their most recent games, in favour of extremely large pre-calculated textures (so-called 'MegaTextures'). Of course, L3DT supports this too (see high resolution textures).

Generating alpha maps

L3DT can export the alpha maps used to generate the terrain textures (see the user-guide for the “how?” part). To illustrate the meaning of these maps, consider the image below:

A blended texture.

This texture was blended from 9 different textures, including 4 for grass, 3 for rock, 1 for dirt, and 1 for sand. The individual alpha maps are shown below:

steep grass coastal grass pebbles
beach sand rock slope grass (normal)
cliff face,
u/w rock
lush grass lake mud

L3DT can export the alpha layers as individual greyscale images, as shown above, but it can also combine the layers into the colour channels of RGB and RGBA images, thereby packing up to 4 alpha layers into each image (see below).

However, using the above 3 alpha map images (and the 9 corresponding ground textures) will strain contemporary GFx cards, particularly if they're rendering other things as well (detail maps / light maps/ bump maps / etc). You can reduce the number of images required by combining the alpha layers of similar land types (see 'Combine alpha layers' wizard). The image below is the combined alpha map in which all grass texture alphas were packed into the green channel, rock is in blue, and sand/mud is in the red channel. Using this alpha map you then only need 4 textures in GFx memory when rendering; one for grass, one for rock, one for sand/mud, and the alpha map itself. The result won't look as good at run-time (since all the grass will look the same), but it will render a whole lot quicker.

A combined alpha map.

L3DT can also split the alpha maps into tiles (using mosaic maps) so that, for example, that the alpha maps for a 4096×4096 pixel map can be split into an 8×8 set of 512×512 image files. This may be particularly useful when rendering very large maps, where you would not want to hold all textures in memory at once.

l3dt/algorithms/splatting.txt · Last modified: 2013/08/21 17:20 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki