Analytical relief shading requires a Digital Elevation Model (DEM). A DEM is a numerical surface that stores elevation information for specific locations on a natural terrain. DEMs exist in two distinctive types: Grid or TIN (triangulated irregular network).
Digital elevation model of the Matterhorn © DHM25 swisstopo.
A DEM in grid format stores elevations in a regular array, very much like a raster image comprised of pixels. A TIN stores elevations at irregularly distributed points and connects these points with triangles. Hence, the triangles follow the terrains surface more or less closely. Since TINs are more complicated to deal with, simpler relief shading programs generally use grids instead of TINs.
With both kinds of elevations models one can interpolate elevation values for positions where such values don’t exist in the model. This allows software applications to compute shaded relief images at arbitrary resolutions. In addition to the elevation, other characteristics of the terrain can be extracted from a digital elevation model. For relief shading, the most important characteristics are two angles: aspect and slope. Slope is the maximum steepness at a particular location. Aspect is the horizontal direction of this maximum steepness.