Repository navigation
Description
Problem
A Shaded Relief lights the whole map from one azimuth. A ridge or scarp running along the light is lit equally on both sides and vanishes, however prominent it is. Choosing another azimuth just loses other ridges.
Manual relief artists of the Swiss school turn the light locally so that every major landform is lit across. Eduard's manual shading does this, and Marston and Jenny (2015, Improving the representation of major landforms in analytical relief shading, IJGIS) described a way to do it for analytical shading. RustGIS's Shaded Relief has one fixed light.
Proposal
A new setting, Adapt light to landforms (raster.symbology "adapt", degrees 0–45, default 0 = off).
- The DEM is generalised (a Gaussian, 8 cells in the prototype) and each cell's major aspect is read from it.
- The light is turned toward that aspect, or toward its opposite, whichever is nearer, by at most
adaptdegrees. The turn is weighted by the generalised slope, so flat ground keeps the base light. - The turn is smoothed in space (a Gaussian, 4 cells), so the light changes gradually and draws no seams.
The base azimuth stays the user's. adapt only bends it locally.
Choices in this proposal
- Turn toward the major slope's face. A slope lit face-on (or from right behind) is either clearly lit or clearly shaded. A slope lit edge-on goes flat. Turning toward the nearer of the two never flips the light more than
adapt. - Aspect from the generalised DEM. Local gullies would make the light turn every few cells. The major landforms decide.
- Capped at 45° and smoothed. A large turn would bring the light round toward the south in places, where readers tend to see relief inverted. Keeping the cap well below 90° avoids that. I tried 30°.
- Off by default. Existing maps don't change.
Prototype (Python, not RustGIS output)
numpy only. Copernicus DEM GLO-30 of Ouro Preto, a 900 × 900-cell crop (about 27 km), sun 315° / 40°, Z factor 1.5, adapt 30°. The light turned 12° on average, 30° at most. The standard deviation of the shading went from 0.202 to 0.210. The gain is local: the NW–SE scarps, nearly along the light, come out much clearer, and the rest changes little.
DEM: Copernicus DEM GLO-30, © DLR e.V. and Airbus, provided under COPERNICUS by the European Union and ESA.
Cost
It needs one generalised grid and one turn grid per layer and setting, worked out off the frame and kept like the shadow grids (#1796). Per pixel it adds one azimuth read. The generalisation is the same Gaussian as the "generalise" proposal (#3145), so the two could share it.
Alternatives considered
- Multidirectional hillshade (MapLibre's method, already in tile layers). It averages several lights, so no landform vanishes, but every landform loses the single-light depth.
- A second shaded layer with another azimuth, masked. That needs a hand-made mask, and its edges show.
🤖 Generated with Claude Code
Activity