Shadow Map
-
"The scene is first rendered at the point of view of the light, and the result of that image is stored in a image called Shadow Map".
-
It stores the depth map.
-
-
"If the light source doesn't 'see' something, then color the pixel dark".
-
The final result is a pixelated shadow. To improve this, PCF (Percentage Closer Filtering) can be done.
-
4x4 PCF is ok, but adding offsets helps in randomness and makes the effect more natural.
-
-
"You want the shadow area to be smallest as possible, while containing all the objects in the camera's view frustum".
-
-
The following techniques are implemented:
-
Cascaded Shadow Maps
-
Stabilized Cascaded Shadow Maps
-
Automatic Cascade Fitting based on depth buffer analysis, as in Sample Distribution Shadow Maps .
-
Various forms of Percentage Closer Filtering
-
Exponential Variance Shadow Maps (EVSM).
-
-
-
Improved shadows using dithering and temporal supersampling .
Percentage Closer Filtering (PCF)
-
.
Soft-Shadows
-
Usual for area lights.
-
.
-
.
-
We will not do proper shading from this light source, but only compute what percentage of the area of the light is covered.
Raytracing
-
It's the proper way to solve it, but it's costly; the other techniques are approximations.
-
Send rays from the point to the light source.
-
.
-
Approximate the percentage of the area that is visible to the light source, via the ratio of rays that hit the light vs rays that didn't hit the light.
Percentage Closer Soft Shadows (PCSS)
-
Presented at Siggraph in 2005.
-
.
-
The PCF sample varies through out the shadow, so the shadows closer to the object look sharp and far away from the object look smooth.
-
Based on the distance to the object from the floor, you decide what filter you should use.
-
How far the occluder is vs how far the point I want to compute is.
-
It also uses the occluder size.
-
.
-
-
Requires a 'Occluder Search' so a situation like below correctly indicates that should be shadow in that point.
-
The shadow in that points comes from the fact that the left side of the light source blocks the object.
-
.
-
-
As PCSS requires Occluder Search and a PCF with large radius, depending on the situation, this method of soft shadows is not cheap.
-
Is cheaper than tracing rays, tho.
-
-
.
~Other Techiniques
-
Doesn't work with Shadow Maps, as Shadow Maps just gives you a blunt occlusion information.
-
Tries to approximate the PCF / PCSS, for soft-shadows instead of computing it.
-
Variance Shadow Maps (VSM) .
-
-
Convolution Shadow Maps (CSM) .
-
-
Exponential Shadow Maps (ESM) .
-
-
.
-
There are improvements to these methods, trying to solve the problems of these approximations.
Radiance Cascades
-
I saw a video demonstrating the usage of radiance cascades for soft-shadows.