In
computer graphics
Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
, a heightmap or heightfield is a
raster image
upright=1, The Smiley, smiley face in the top left corner is a raster image. When enlarged, individual pixels appear as squares. Enlarging further, each pixel can be analyzed, with their colors constructed through combination of the values for ...
used mainly as
Discrete Global Grid in
secondary elevation modeling. Each pixel stores values, such as surface
elevation
The elevation of a geographic location (geography), ''location'' is its height above or below a fixed reference point, most commonly a reference geoid, a mathematical model of the Earth's sea level as an equipotential gravitational equipotenti ...
data, for display in
3D computer graphics
3D computer graphics, sometimes called Computer-generated imagery, CGI, 3D-CGI or three-dimensional Computer-generated imagery, computer graphics, are graphics that use a three-dimensional representation of geometric data (often Cartesian coor ...
. A heightmap can be used in
bump mapping to calculate where this 3D data would create shadow in a material, in
displacement 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 one
channel interpreted as a distance of
displacement
Displacement may refer to:
Physical sciences
Mathematics and physics
*Displacement (geometry), is the difference between the final and initial position of a point trajectory (for instance, the center of mass of a moving object). The actual path ...
or "height" from the "floor" of a surface and sometimes
visualized as
luma of a
grayscale
In digital photography, computer-generated imagery, and colorimetry, a greyscale (more common in Commonwealth English) or grayscale (more common in American English) image is one in which the value of each pixel is a single sample (signal), s ...
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 specialized
metadata
Metadata (or metainformation) is "data that provides information about other data", but not the content of the data itself, such as the text of a message or the image itself. There are many distinct types of metadata, including:
* Descriptive ...
,
or in specialized
file format
A file format is a Computer standard, standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary format, pr ...
s such as Daylon Leveller,
GenesisIV and
Terragen 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, 256
3 = 16,777,216 heights can be represented (256
4 = 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 in
geographic information system
A geographic information system (GIS) consists of integrated computer hardware and Geographic information system software, software that store, manage, Spatial analysis, analyze, edit, output, and Cartographic design, visualize Geographic data ...
s, where they are called
digital elevation model
A digital elevation model (DEM) or digital surface model (DSM) is a 3D computer graphics representation of elevation data to represent terrain or overlaying objects, commonly of a planet, Natural satellite, moon, or asteroid. A "global DEM" refer ...
s.
Creation
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 2D
simplex noise function or by
diffusion-limited aggregation. Another method is to
reconstruct
Reconstruction may refer to:
Politics, history, and sociology
*Reconstruction (law), the transfer of a company's (or several companies') business to a new company
*''Perestroika'' (Russian for "reconstruction"), a late 20th century Soviet Union ...
heightmaps from real world data, for example using
synthetic aperture radar
Synthetic-aperture radar (SAR) is a form of radar that is used to create two-dimensional images or 3D reconstruction, three-dimensional reconstructions of objects, such as landscapes. SAR uses the motion of the radar antenna over a target regi ...
.
[Kirscht, Martin, and Carsten Rinke]
"3D Reconstruction of Buildings and Vegetation from Synthetic Aperture Radar (SAR) Images."
MVA. 1998.
Use
Heightmaps are widely used in
terrain rendering
Terrain cartography or relief mapping is the depiction of the shape of the surface of the Earth on a map, using one or more of several techniques that have been developed. Terrain or relief is an essential aspect of physical geography, and as su ...
software and modern
video game
A video game or computer game is an electronic game that involves interaction with a user interface or input device (such as a joystick, game controller, controller, computer keyboard, keyboard, or motion sensing device) to generate visual fe ...
s. 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 of
bump
Bump or bumps may refer to:
Arts and entertainment
* Bump (dance), a dance from the 1970s disco era
* ''BUMP'' (comics), 2007-08 limited edition comic book series
Fictional characters
* Bobby Bumps, titular character of a series of American si ...
,
normal, or
displacement
Displacement may refer to:
Physical sciences
Mathematics and physics
*Displacement (geometry), is the difference between the final and initial position of a point trajectory (for instance, the center of mass of a moving object). The actual path ...
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 of
voxel
In computing, a voxel is a representation of a value on a three-dimensional regular grid, akin to the two-dimensional pixel. Voxels are frequently used in the Data visualization, visualization and analysis of medical imaging, medical and scient ...
s rendered with
ray casting
Ray casting is the methodological basis for 3D CAD/CAM solid modeling and image rendering. It is essentially the same as ray tracing (graphics), ray tracing for computer graphics where virtual light rays are "cast" or "traced" on their path from th ...
.
In most newer games, the elements represent the height coordinate of
polygons in a mesh.
Rendering software
*
Terragen – terrain renderer
*
Picogen – terrain renderer and heightmap creation tool
* Materialize – Free PBR (
Physically Based Rendering
Physically based rendering (PBR) is a computer graphics approach that seeks to render images in a way that models the lights and surfaces with optics in the real world. It is often referred to as "Physically Based Lighting" or "Physically Based ...
) creation tool
Generating software
{{main, Scenery generator#Software
Trivia
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).
See also
*
3D scanner
3D scanning is the process of analyzing a real-world object or environment to collect three dimensional data of its shape and possibly its appearance (e.g. color). The collected data can then be used to construct digital 3D models.
A 3D scanner ...
*
Digital elevation model
A digital elevation model (DEM) or digital surface model (DSM) is a 3D computer graphics representation of elevation data to represent terrain or overlaying objects, commonly of a planet, Natural satellite, moon, or asteroid. A "global DEM" refer ...
*
Draw distance
Draw, drawing, draws, or drawn most commonly refer to:
* Draw (terrain), a terrain feature formed by two parallel ridges or spurs with low ground in between them
* Draw (tie), in a competition, where competitors achieve equal outcomes
* Drawi ...
*
Range imaging
*
Texture splatting
References
External links
POV-Ray : Documentation : 2.4.1.5 Height Field:3DGrayscale - Understanding 3D Heightmaps Computer graphics data structures