[GIS] What would a simple hillshade algorithm be

algorithmgis-principlehillshadetopography

I'm curious how GIS systems actually generate a hill-shade from input data like a raster DEM layer. I'd like to implement my own in software (mostly for fun/learning) but I want to start with a plausible algorithm so I don't waste an incredible amount of time.

Naively, I'd think you could scan the elevation data, calculate the slope from point to point in a given direction (say left to right), then color all of either the positive or negative slopes. If the min and max slopes in the elevation tile were known, it seems like it might also be nice to scale the color based on that.

Is that a plausible way to go about the problem?

Best Answer

It is important to remember that when computing hillshading, you need to have an illumination source. Using the sun as an illumination source may mean that a cell is shaded at noon, when the sun is directly overhead, but not at 4:00 p.m. Without an illumination point, your example seems more like a color coded slope map.

ESRI calculates illumination of each cell relative to its neighboring cells and has better explanations and examples of their algorithm than I can offer:

http://edndoc.esri.com/arcobjects/9.2/NET/shared/geoprocessing/spatial_analyst_tools/how_hillshade_works.htm

Related Question