In computer graphics, especially three-dimensional (3D) computer graphics, relief mapping is a way to apply a two-dimensional (2D) image to the surface of an object to modify the appearance of its geometry. A relief map is a 2D image in which each image determines the height of the corresponding location on a 3D model or, alternately, is transparent to indicate that there is no geometry at the given point on the model. When the 2D image is texture mapped onto the surface of the 3D object, the rendering engine will modify the geometry of the object and move each point associated with a pixel in the 2D image a certain distance away from its original coordinate by a value that corresponds to its texture pixel. This allows for very subtle amounts of detail that can respond to light, cast accurate shadows and even cover background objects without the need for fine, memory-intensive meshes to construct the geometry. One example of this type of mapping could be applying a satellite photo of the Earth to a sphere, with relief mapping causing the points on the surface of the sphere to be higher where there are mountains and remain flat where there are oceans.
Relief mapping relies on a 2D texture image for the data necessary to render an object. The 2D image is made up of pixels of different colors, and each color is translated into a specific height. Most of these images are in grayscale because it is easy to determine the height of an area when black will equate to no height, pure white will be maximum height, and grays will make up the values in between.
When an object has the 2D texture applied for relief mapping, the location of each pixel is matched to a point in the geometry of the object. If the texture pixel in the image, called a texel, has a value other than zero, then the 3D coordinate of the surface of the model is adjusted by the value of the pixel away from the center of the object in the direction of the surface normal. The amount of movement that each texel unit represents can be set very low so the relief mapping can be used to make only subtle deformities in a surface, or it can be set high so a relief texture map will translate into wildly jagged terrain.
There are many uses for relief mapping in computer graphics, from displaying 2D cartographic maps in 3D to geometrically simulating very detailed textures, such as the woven surface of a sweater. It should be noted that relief mapping is very similar to bump mapping, and some programs actually optimize the mapping at a distance within a scene by reverting to bump mapping. The major difference is that, while some similar surface effects can be achieved, bump mapping never actually causes the geometry of the object to protrude outside of its basic geometric shape. This means that, if a sphere is bump-mapped with an image of mountains, then the viewable surface will accurately render the mountains but the edges of the sphere and the shadow of the sphere will remain perfectly round. The relief mapping technique would actually modify the sphere so its geometry accurately reflects the texture heights.