Graphics‎ > ‎3D‎ > ‎Shadows‎ > ‎

Shadow map

Then we code in the shade

A shadow map is calculated for a light and is used to check what other positions in the world are in shadow from that light. It's a made in two steps.

Create the shadow map
The shadow map is a depth map from the view of the light source. In it all the objects that will cast shadows need to be rendered. For a directional light it can be a orthographic projection, for others a perspective one. On depth information so simple shaders that only write depth can be used. The shadow map need to be update each time the light or any of the shadow casting objects move.

Use the shadow map
Calculate the light transform
When rendering a position in the scene transform that position into the space of the shadow map.

Sample shadow map
Used that light space position to check in the shadow map if the current position is in shadow from the shadow map.

If the position in the scene is in shadow ignore the light else include it's values when calculating the light value.


Sparse Shadow Trees - 2016
Cascaded Shadow Mapping

Shadow mapping basics - 2015
Contact-hardening Soft Shadows Made Fast

Deferred Rendering Shadow Mapping - 2013

Directional Shadows Cascaded Maps