Real-Time Shadows CHAPTER 4—— Shadow-Map Sampling

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 modied 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值