Real-Time Rendering——7.1.2 Soft Shadows软阴影

Projective shadows can also be made soft, by using a variety of techniques. Here, we describe an algorithm from Heckbert and Herf [697, 722] that produces soft shadows.The algorithm’s goal is to generate a texture on a ground plane that shows a soft shadow. We then describe less accurate, faster methods.

通过使用各种技术,投影阴影也可以变得柔和。这里,我们描述了Heckbert和Herf [697,722]提出的一种产生柔和阴影的算法。该算法的目标是在地平面上生成一个显示柔和阴影的纹理。然后,我们描述不太准确,速度更快的方法。

Soft shadows appear whenever a light source has an area. One way to approximate the effect of an area light is to sample it by using several punctual lights placed on its surface. For each of these punctual light sources, an image is rendered and accumulated into a buffer. The average of these images is then an image with soft shadows. Note that, in theory, any algorithm that generates hard shadows can be used along with this accumulation technique to produce penumbrae. In practice, doing so at interactive rates is usually untenable because of the execution time that would be involved.

只要光源有区域,就会出现柔和的阴影。近似区域光效果的一种方法是使用放置在其表面的几个点光源对其进行采样。对于这些点光源中的每一个,图像被渲染并累积到缓冲器中。然后,这些图像的平均值是具有柔和阴影的图像。请注意,理论上,任何生成硬阴影的算法都可以与这种累积技术一起使用来生成半影。实际上,以交互速率这样做通常是站不住脚的,因为这会涉及到执行时间。

Heckbert and Herf use a frustum-based method to produce their shadows. The idea is to treat the light as the viewer, and the ground plane forms the far clipping plane of the frustum. The frustum is made wide enough to encompass the occluders.

Heckbert和Herf使用基于平截头体的方法来产生他们的阴影。这个想法是将光视为观察者,地平面形成平截头体的远裁剪平面。平截头体做得足够宽以包围封堵器。

A soft shadow texture is formed by generating a series of ground-plane textures.The area light source is sampled over its surface, with each location used to shade the image representing the ground plane, then to project the shadow-casting objects onto this image. All these images are summed and averaged to produce a ground-plane shadow texture. See the left side of Figure 7.5 for an example.

软阴影纹理是通过生成一系列地平面纹理形成的。面光源在其表面上进行采样,每个位置用于对代表地平面的图像进行着色,然后将阴影投射对象投射到该图像上。所有这些图像相加并平均产生一个地平面阴影纹理。参见图7.5左侧的示例。

Figure 7.5. On the left, a rendering using Heckbert and Herf’s method, using 256 passes. On the right,Haines’ method in one pass. The umbrae are too large with Haines’ method, which is particularly noticeable around the doorway and window.

图7.5。左边是使用Heckbert和Herf方法的渲染,使用了256个通道。右边是海恩斯的方法。用海恩斯的方法,阴影太大了,在门口和窗户周围尤其明显。

A problem with the sampled area-light method is that it tends to look like what it is: several overlapping shadows from punctual light sources. Also, for n shadow passes, only n + 1 distinct shades can be generated. A large number of passes gives an accurate result, but at an excessive cost. The method is useful for obtaining a (literally) “ground-truth” image for testing the quality of other, faster algorithms.

采样区域光方法的一个问题是,它往往看起来像它本来的样子:来自点光源的几个重叠的阴影。此外,对于n个阴影过程,只能生成n + 1个不同的阴影。大量的过程给出了准确的结果,但是成本过高。该方法对于获得(字面上的)“地面实况”图像以测试其他更快算法的质量是有用的。

A more efficient approach is to use convolution, i.e., filtering. Blurring a hard shadow generated from a single point can be sufficient in some cases and can produce a semitransparent texture that can be composited with real-world content. See Figure 7.6. However, a uniform blur can be unconvincing near where the object makes contact with the ground.

更有效的方法是使用卷积,即滤波。在某些情况下,模糊从单个点生成的硬阴影就足够了,并且可以生成可以与真实内容合成的半透明纹理。参见图7.6。然而,在物体与地面接触的地方附近,均匀的模糊可能无法令人信服。

Figure 7.6. Drop shadow. A shadow texture is generated by rendering the shadow casters from above and then blurring the image and rendering it on the ground plane. (Image generated in Autodesk’s A360 viewer, model from Autodesk’s Inventor samples.) 

图7.6。投下阴影。阴影纹理是通过从上方渲染阴影投射器,然后模糊图像并在地平面上渲染来生成的。(图像在Autodesk的A360查看器中生成,模型来自Autodesk的Inventor示例。)

There are many other methods that give a better approximation, at additional cost. For example, Haines [644] starts with a projected hard shadow and then renders the silhouette edges with gradients that go from dark in the center to white on the edges to create plausible penumbrae. See the right side of Figure 7.5. However, these penumbrae are not physically correct, as they should also extend to areas inside the silhouette edges. Iwanicki [356, 806] draws on ideas from spherical harmonics and approximates occluding characters with ellipsoids to give soft shadows. All such methods have various approximations and drawbacks, but are considerably more efficient than averaging a large set of drop-shadow images.

有许多其他方法可以提供更好的近似值,但需要额外的费用。例如,Haines [644]从投影的硬阴影开始,然后用从中心的黑暗到边缘的白色的梯度渲染轮廓边缘,以创建似乎可信的半影。参见图7.5的右侧。但是,这些半影在物理上是不正确的,因为它们也应该延伸到剪影边缘内部的区域。Iwanicki [356,806]借鉴了球谐函数的思想,用椭圆体近似遮挡字符,以产生柔和的阴影。所有这些方法都有各种近似和缺点,但比平均一大组投影图像要有效得多。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

椰子糖莫莫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值