Lecture
In computer graphics, a height map or heightfield is a raster image used mainly as a discrete global grid in secondary elevation modeling. Each pixel stores values such as surface elevation data for display in three-dimensional computer graphics. A height map can be used in bump mapping to calculate where this three-dimensional data will cast a shadow in a material, in displacement mapping to shift the actual geometric position of points across a textured surface, or for terrain, where the height map is converted into a three-dimensional mesh.
A height map contains a single channel interpreted as the displacement distance, or «height», from the «floor» of the surface, and it is sometimes visualized as grayscale image brightness, where black represents the minimum height and white represents the maximum height. When rendering the map, the designer can specify the amount of displacement per unit of the height channel, which corresponds to the «contrast» of the image. Height maps can be stored on their own in existing grayscale image formats, with or without specialized metadata, or in specialized file formats such as Daylon Leveller, GenesisIV, and Terragen documents.
Separate color channels can also be used to increase detail. For example, a standard 8-bit RGB image can display only 256 shades of gray and, consequently, only 256 heights. By using colors, a larger number of heights can be stored (a 24-bit image can represent 256 3 = 16,777,216 heights (256 4 = 4,294,967,296 if an alpha channel is also used)). This method is especially useful when the height varies only slightly over a large area. When using only grayscale values, since heights must be mapped to only 256 values, the rendered terrain looks flat, with «steps» in certain places.

A height map of planet Earth at a resolution of 2 km per pixel, including ocean bathymetry information, normalized to 8-bit grayscale
Height maps are commonly used in geographic information systems, where they are called digital elevation models.

A height map created using Terragen

The same height map converted into a 3D mesh and rendered using Anim8or
Height maps can be created manually using a classic drawing program or a specialized terrain editor. These editors render the terrain in 3D and allow the user to modify the surface. There are typically tools for raising, lowering, smoothing, or eroding the terrain. Another way of creating terrain is by using a terrain generation algorithm. This can be, for example, a two-dimensional simplex noise function or diffusion-limited aggregation. Another method is reconstructing height maps from real-world data, for example using synthetic aperture radar.
Height maps are widely used in terrain rendering software and modern video games. Height maps are an ideal way of storing digital terrain elevations; compared with a regular polygonal mesh, they require substantially less memory for a given level of detail. Most modern 3D computer modeling programs are able to use data from height maps in the form of terrain, normal, or displacement maps to quickly and accurately create complex terrain and other surfaces.
In the earliest games using software rendering, elements often represented the heights of voxel columns rendered using ray casting. In most newer games, elements represent the height coordinates of polygons in a grid.
Although the terms heightmap and heightfield are often indistinguishable from each other, there is still a small difference between the terms. Heightmap derives from the mathematical term 'map', while heightfield derives from the mathematical term 'vector field'. Heightmap is the more correct description, since most heightfields are not (vector) fields in mathematical terms, but they are always a map (both in mathematical terms and in visual representation).
Comments