in this chapter, we will concentrate on sampling error introduced in the initial sampling phase (i.e., undestanding) and present several methods to improve sampling. one of the simplest methods is to fit the frustum of the light source to the view frustum (Section 4.1). is is also a requirement for the more advanced
methods, for example, warping the shadow map to achieve a better parametrization
(Section 4.2) or partitioning the shadow map globally (Section 4.3) or locally
(Section 4.4) in order to spendmore shadow-map samples where they are needed.
Even higher quality can be achieved by calculating shadows for the exact viewsample
locations visible in the nal image (Section 4.5). Alternatively, the reconstruction
algorithm can be improved to provide smoother edges (Section 4.6). Finally,
temporal aliasing as well as sampling accuracy can be improved by temporal
reprojection of shadow-map samples (Section 4.7).
4.1 fitting
one of the most straightforward ways in which the shadow-map sampling rate can be improved is to make sure that no shadow-map space is wasted. especially in out-door senes, if a single shadow map is used for the whole scene, then only a small part of shadow map will actually be relevant for the view frustum. thus, fitting or focusing techniques, introduced by Brabec et al. [Brabec02a], fit the shadowmap frustum to encompass 包含 the view frustum.
in order to produce correct results, we need to include all objects in the shadow map that potentially cast a shadow on objects (receivers) in the view frustum. therefore, the first step is to find potential shadow receivers (PSRs).
Finding Potential Shadow Receivers
We want to exclude receivers outside the viewing cone of the light source, outside the view frustum, and outside the scene bounding box (especially for large view frusta), as these objects can never receive a shadow that is visible in the final image. the volume of PSRs is thus given by the intersection of light frustum L, view frustum V, and scene bounding box S:
Focusing on PSRs in Shadow-Map Space
the focusing extent on the shadow map can be easily calculated from PSR when working directly in (post-perspective) shadow-map space. One computes the bounding rectangle (xmin, ymin), (xmax , ymax) of the vertices of PSR projected onto the shadow map. It is applied through a scale/translate matrix F (in a way, an “inverse” viewport matrix) that maps this bounding rectangle to the range [−1, 1] in each coordinate:
where sx = 2/(xmax − xmin), ox = −(sx(xmax + xmin))/2 are the scale and offset values for x; the values for y are analogous.the matrix F is then simply multiplied with the view-projection matrix of the light source to obtain the final shadow matrix. Since we work in post-perspective light space, we automatically include all
potential shadow casters.e reason is that in post-perspective space, all light rays
are parallel to the z-axis, which is not modied by the tting matrix F. us, if an
object blocks a light ray to a shadow receiver in the focused region, it is itself part
of the focused region in the x, y-plane.
Note that for standard shadowmapping, a fixed orientation of the shadowmap is usually assumed. However, most algorithms to improve sampling error (in particular, those in Sections 4.2 and 4.3) require the shadow-map up vector to be aligned with the view vector, so that the view-frustum near plane is found at the bottom of the shadow map and the far plane at the top.