i
i
i
i
i
i
i
i
364 9. Global Illumination
Figure 9.29. Percentage-Closer Filtering. On the left, hard shadows with a little PCF
filtering. In the middle, constant width soft shadows. On the right, variable-width soft
shadows with proper hardness where objects are in contact with the ground. (Images
courtesy of NVIDIA Corporation.)
If we could know in advance the distance of the occluder from the
receiver, we could set the area to sample accordingly and approximate the
effect of an area light. One simple, but incorrect, idea is to examine the
shadow map for the occluder location and find the distance between this
location and the receiver. The problem with this naive scheme is that if a
location is not in shadow for the point light, no further processing will be
done. In Figure 9.27, points Q and R are in a penumbra. The distance to
the occluder from point Q is a simple lookup. Point R, however, is fully
lit by the basic shadow map—a simple lookup will fail to find the proper
sample width for this point.
What is needed is a way to find whether a surface location could be
partially affected by any occluder. The distance to the relevant occluder
from the location is key in determining the width of the area to sample.
Fernando [340, 916] attempts a solution by searching the nearby area on
the shadow map and processing the results. The idea is to determine all
possible occluders within this sampled area. The average distance of these
occluders from the location is used to determine the sample area width:
w
sample
= w
light
d
r
− d
o
d
r
, (9.9)
where d
r
is the distance of the receiver from the light and d
o
the average
occluder distance. If there are no occluders found, the location is fully
lit and no further processing is necessary. Similarly, if the location is fully
occluded, processing can end. Otherwise the area of interest is sampled and
the light’s approximate contribution is computed. To save on processing
costs, the width of the sample area is used to vary the number of samples
taken. The drawback of this method is that it needs to always sample
an area of the shadow map to find the occluders, if any. Valient and de
Boer [1287] present a method of processing the shadow map to create a
map in which the distance to the nearest occluder is stored in each texel.