This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources in this article. Unsourced material may be challenged and removed. Find sources: "Heightmap" – news ·newspapers ·books ·scholar ·JSTOR(December 2009) (Learn how and when to remove this message) |


Incomputer graphics, aheightmap orheightfield is araster image used mainly asDiscrete Global Grid insecondary elevation modeling. Each pixel stores values, such as surfaceelevation data, for display in3D computer graphics. A heightmap can be used inbump mapping to calculate where this 3D data would create shadow in a material, indisplacement mapping to displace the actual geometric position of points over the textured surface, or for terrain where the heightmap is converted into a 3D mesh.
A heightmap contains onechannel interpreted as a distance ofdisplacement or "height" from the "floor" of a surface and sometimesvisualized asluma of agrayscale image, with black representing minimum height and white representing maximum height.When the map is rendered, the designer can specify the amount of displacement for each unit of the height channel, which corresponds to the “contrast” of the image.Heightmaps can be stored by themselves in existing grayscale image formats, with or without specializedmetadata,or in specializedfile formats such as Daylon Leveller,GenesisIV andTerragen documents.
One may also exploit the use of individual color channels to increase detail. For example, a standard RGB 8-bit image can only show 256 values of grey and hence only 256 heights. By using colors, a greater number of heights can be stored (for a 24-bit image, 2563 = 16,777,216 heights can be represented (2564 = 4,294,967,296 if the alpha channel is also used)). This technique is especially useful where height varies slightly over a large area. Using only grey values, because the heights must be mapped to only 256 values, the rendered terrain appears flat, with "steps" in certain places.

Heightmaps are commonly used ingeographic information systems, where they are calleddigital elevation models.
Heightmaps can be created by hand with a classical paint program or a special terrain editor. These editors visualize the terrain in 3D and allow the user to modify the surface. Normally there are tools to raise, lower, smooth or erode the terrain. Another way to create a terrain is to use a terrain generation algorithm. This can be for example a 2Dsimplex noise function[1] or bydiffusion-limited aggregation.[2] Another method is toreconstruct heightmaps from real world data, for example usingsynthetic aperture radar.[3]
Heightmaps are widely used interrain rendering software and modernvideo games. Heightmaps are an ideal way to store digital terrain elevations; compared to a regular polygonal mesh, they require substantially less memory for a given level of detail. Most modern 3D computer modelling programs are capable of using data from heightmaps in the form ofbump,normal, ordisplacement maps to quickly and precisely create complex terrain and other surfaces.
In the earliest games using software rendering, the elements often represented heights of columns ofvoxels rendered withray casting.In most newer games, the elements represent the height coordinate ofpolygons in a mesh.
Although the terms heightmap and heightfield are often indistinguishable from each other, there is still a small difference in the terms. Heightmap comes from the mathematical term 'map' and heightfield comes from the mathematical term 'vector field'. Heightmap is the more correct description because most heightfields are not a (vector) field in mathematical terms but they are always a map (in mathematical terms as well as in the visual representation).