Vertex Displacement Mapping or simply Displacement Mapping is a technique allowing to deform a polygonal mesh
using a texture (displacement map) in order to add surface detail. The principle is not new, it is even the basis of number of
terrain generation algorithms (see the Terrain Generator GLUT project).
The new thing is the use of the GPU to achieve in real time the mesh deformation.
Update: November 5, 2006:
The displacement mapping involves a graphics controller that allows to access at least to one texture unit inside the vertex shader.
The access to a texture inside the vertex shader is called Vertex Texture Fetching. The shader model 3.0 imposes that at
least 4 texture units are accessible inside the vertex shader. Currently, only the graphics controllers based on nVidia
Geforce 6, Geforce 7 and higher support the Vertex Texture Fetching. ATI graphics controllers do not support the
Vertex Texture Fetching even for the latest high-end models such as the X1950XTX (for more explanation see here: ATI X1900XTX and VTF).
Update: November 22, 2006:
It seems that there are some problems with the Forceware graphics drivers 91.xx and 93.xx.
The older drivers (84.xx) or the latest (96.xx) work properly
(see the following topic for more detail: Vertex Displ. Mapping on Demoniak3D Forum).
Update: September 30, 2008:
Vertex texture fetching is now available on radeon: ATI Catalyst 8.10 Fixes the Displacement Mapping Bug in OpenGL @ Geeks3D.
The GPU Caps Viewer tool will allow you to quickly know the number of accessible
texture units inside a vertex shader :
Fig. 1 - Number of Texture Units Inside a Vertex ShaderThis information can be get in OpenGL using the constant:
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB.
Figure 2 shows the rendering of the project that comes with this tutorial (available at the end of this page).
We will use the Demoniak3D platform in order to quickly code the displacement mapping demo.
Fig. 2 - DEMO_displacement_mapping.xmlThe different demos use the GLSL (OpenGL Shading Language) for shaders coding.