Real-Time Rendering——7.4.1 Resolution Enhancement分辨率增强 (透视(PSM) 梯形(TSM)光空间透视(LiSPSM) 级联阴影图(CSM))

Similar to how textures are used, ideally we want one shadow-map texel to cover about one image pixel. If we have a light source located at the same position as the eye, the shadow map perfectly maps one-to-one with the screen-space pixels (and there are no visible shadows, since the light illuminates exactly what the eye sees). As soon as the light’s direction changes, this per-pixel ratio changes, which can cause artifacts. An example is shown in Figure 7.15. The shadow is blocky and poorly defined because a large number of pixels in the foreground are associated with each texel of the shadow map. This mismatch is called perspective aliasing. Single shadow-map texels can also cover many pixels if a surface is nearly edge-on to the light, but faces the viewer. This problem is known as projective aliasing [1792]; see Figure 7.16. Blockiness can be decreased by increasing the shadow-map resolution, but at the cost of additional memory and processing. 

 

类似于如何使用纹理,理想情况下,我们希望一个阴影贴图纹理元素覆盖大约一个图像像素。如果我们有一个与眼睛位于相同位置的光源,阴影贴图与屏幕空间像素完美地一对一映射(并且没有可见的阴影,因为光正好照亮眼睛所看到的)。一旦光线的方向改变,这种每像素比率就会改变,这可能会导致伪像。图7.15给出了一个例子。阴影是块状的,定义很差,因为前景中的大量像素与阴影贴图的每个纹理元素相关联。这种不匹配被称为透视混叠。如果一个表面接近灯光的边缘,但面向观察者,单个阴影贴图纹理元素也可以覆盖许多像素。这个问题被称为投影混叠[1792];参见图7.16。可以通过提高阴影贴图分辨率来减少块效应,但代价是增加内存和处理。

Figure 7.15. The image to the left is created using standard shadow mapping; the image to the right using LiSPSM. The projections of each shadow map’s texels are shown. The two shadow maps have the same resolution, the difference being that LiSPSM reforms the light’s matrices to provide a higher sampling rate nearer the viewer. (Images courtesy of Daniel Scherzer, Vienna University of Technology.) 

图7.15。左边的图像是使用标准阴影贴图创建的;右边的图片使用LiSPSM。显示了每个阴影贴图的纹理元素的投影。两个阴影贴图具有相同的分辨率,不同之处在于LiSPSM重组了灯光矩阵,以在更靠近观察者的地方提供更高的采样率。(图片由维也纳工业大学丹尼尔·舍尔泽提供。)

Figure 7.16. On the left the light is nearly overhead. The edge of the shadow is a bit ragged due to a low resolution compared to the eye’s view. On the right the light is near the horizon, so each shadow texel covers considerably more screen area horizontally and so gives a more jagged edge. (Images generated by TheRealMJP’s “Shadows” program on Github.) 

图7.16。左边的灯几乎在头顶上。阴影的边缘有点粗糙,因为与眼睛的视角相比分辨率较低。在右边,光线靠近地平线,所以每个阴影纹理元素在水平方向上覆盖了相当多的屏幕区域,从而产生了更多的锯齿状边缘。(图片由TheRealMJP在Github上的“Shadows”程序生成。)

There is another approach to creating the light’s sampling pattern that makes it more closely resemble the camera’s pattern. This is done by changing the way the scene projects toward the light. Normally we think of a view as being symmetric, with the view vector in the center of the frustum. However, the view direction merely defines a view plane, but not which pixels are sampled. The window defining the frustum can be shifted, skewed, or rotated on this plane, creating a quadrilateral that gives a different mapping of world to view space. The quadrilateral is still sampled at regular intervals, as this is the nature of a linear transform matrix and its use by the GPU. The sampling rate can be modified by varying the light’s view direction and the view window’s bounds. See Figure 7.17.

还有另一种方法来创建灯光的采样模式,使其更接近相机的模式。这是通过改变场景向灯光投射的方式来实现的。通常我们认为视图是对称的,视图向量在截锥的中心。然而,视图方向仅仅定义了视图平面,而没有定义对哪些像素进行采样。定义平截头体的窗口可以在这个平面上移动、倾斜或旋转,创建一个四边形,给出世界到视图空间的不同映射。四边形仍然以规则的间隔被采样,因为这是线性变换矩阵的性质及其由GPU的使用。可以通过改变灯光的观察方向和观察窗的边界来修改采样率。参见图7.17。

Figure 7.17. For an overhead light, on the left the sampling on the floor does not match the eye’s rate. By changing the light’s view direction and projection window on the right, the sampling rate is biased toward having a higher density of texels nearer the eye. 

图7.17。对于顶灯,左侧地板上的采样与人眼的速率不匹配。通过更改灯光的视图方向和右侧的投影窗口,采样率偏向于在眼睛附近具有更高密度的纹理元素。

There are 22 degrees of freedom in mapping the light’s view to the eye’s [896]. Exploration of this solution space led to several different algorithms that attempt to better match the light’s sampling rates to the eye’s. Methods include perspective shadow maps (PSM) [1691], trapezoidal shadow maps (TSM) [1132], and light space perspective shadow maps (LiSPSM) [1893, 1895]. See Figure 7.15 and Figure 7.26 on page 254 for examples. Techniques in this class are referred to as perspective warping methods.

在将光的视图映射到眼睛的视图时有22个自由度[896]。对这个解决方案空间的探索导致了几种不同的算法,试图更好地匹配光的采样率和眼睛的采样率。方法包括透视阴影贴图(PSM) [1691],梯形阴影贴图(TSM) [1132],以及光空间透视阴影贴图(LiSPSM) [1893,1895]。示例参见第254页的图7.15和图7.26。这类技术被称为透视扭曲方法。

Figure 7.26. In the upper left, standard shadow mapping. Upper right, perspective shadow mapping, increasing the density of shadow-map texel density near the viewer. Lower left, percentage closer soft shadows, softening the shadows as the occluder’s distance from the receiver increases.Lower right, variance shadow mapping with a constant soft shadow width, each pixel shaded with a single variance map sample. (Images courtesy of Nico Hempe, Yvonne Jung, and Johannes Behr.) 

图7.26。在左上角,标准阴影贴图。右上角,透视阴影贴图,增加观察者附近阴影贴图纹理的密度。左下,百分比更近的软阴影,随着遮光器与接收器的距离增加而使阴影变软。右下,具有恒定软阴影宽度的方差阴影贴图,每个像素都用单个方差贴图样本着色。(图片由Nico Hempe、Yvonne Jung和Johannes Behr提供。)

An advantage of these matrix-warping algorithms is that no additional work is needed beyond modifying the light’s matrices. Each method has its own strengths and weaknesses [484], as each can help match sampling rates for some geometry and lighting situations, while worsening these rates for others. Lloyd et al. [1062, 1063] an- alyze the equivalences between PSM, TSM, and LiSPSM, giving an excellent overview of the sampling and aliasing issues with these approaches. These schemes work best when the light’s direction is perpendicular to the view’s direction (e.g., overhead), as the perspective transform can then be shifted to put more samples closer to the eye.

这些矩阵变形算法的一个优点是,除了修改光线的矩阵之外,不需要额外的工作。每种方法都有自己的优点和缺点[484],因为每种方法都有助于匹配一些几何图形和照明情况下的采样率,而对其他情况下的采样率则更差。Lloyd等人[1062,1063]分析了PSM、TSM和LiSPSM之间的等价性,对这些方法的采样和混叠问题进行了极好的概述。当光的方向垂直于视图的方向(例如,头顶)时,这些方案工作得最好,因为透视变换然后可以移动以将更多的样本放在更靠近眼睛的地方。

One lighting situation where matrix-warping techniques fail to help is when a light is in front of the camera and pointing at it. This situation is known as dueling frusta, or more colloquially as “deer in the headlights.” More shadow-map samples are needed nearer the eye, but linear warping can only make the situation worse [1555]. This and other problems, such as sudden changes in quality [430] and a “nervous,” unstable quality to the shadows produced during camera movement [484, 1227], have made these approaches fall out of favor.

矩阵扭曲技术无法解决的一种照明情况是当灯光在摄像机前面并指向摄像机时。这种情况被称为决斗挫折,或更通俗地称为“车灯前的鹿。”眼睛附近需要更多的阴影贴图样本,但是线性扭曲只会使情况变得更糟。这一问题和其他问题,如质量的突然变化[430]和摄像机移动期间产生的阴影的“紧张的”不稳定质量[484,1227],使这些方法不再受欢迎。

The idea of adding more samples where the viewer is located is a good one, leading to algorithms that generate several shadow maps for a given view. This idea first made a noticeable impact when Carmack described it at his keynote at Quakecon 2004. Blow independently implemented such a system [174]. The idea is simple: Generate a fixed set of shadow maps (possibly at different resolutions), covering different areas of the scene. In Blow’s scheme, four shadow maps are nested around the viewer. In this way, a high-resolution map is available for nearby objects, with the resolution dropping for those objects far away. Forsyth [483, 486] presents a related idea, generating different shadow maps for different visible sets of objects. The problem of how to handle the transition for objects spanning the border between two shadow maps is avoided in his setup, since each object has one and only one shadow map associated with it. Flagship Studios developed a system that blended these two ideas. One shadow map is for nearby dynamic objects, another is for a grid section of the static objects near the viewer, and a third is for the static objects in the scene as a whole. The first shadow map is generated each frame. The other two could be generated just once, since the light source and geometry are static. While all these particular systems are now quite old, the ideas of multiple maps for different objects and situations, some precomputed and some dynamic, is a common theme among algorithms that have been developed since.

在观看者所在的地方添加更多样本的想法是一个好主意,这导致了为给定视图生成几个阴影贴图的算法。当卡马克在2004年的Quakecon大会上发表主题演讲时,这个想法第一次引起了人们的注意。Blow独立实现了这样的系统[174]。想法很简单:生成一组固定的阴影贴图(可能分辨率不同),覆盖场景的不同区域。在Blow的方案中,四个阴影贴图嵌套在观察者周围。通过这种方式,附近的物体可以获得高分辨率的地图,而远处的物体分辨率下降。Forsyth [483,486]提出了一个相关的想法,为不同的可见对象集生成不同的阴影图。在他的设置中,避免了如何处理跨越两个阴影贴图边界的对象的过渡的问题,因为每个对象有且只有一个阴影贴图与之相关联。旗舰工作室开发了一个融合了这两种想法的系统。一个阴影贴图用于附近的动态对象,另一个阴影贴图用于查看器附近的静态对象的栅格部分,第三个阴影贴图用于整个场景中的静态对象。每帧生成第一个阴影贴图。另外两个可以只生成一次,因为光源和几何体是静态的。虽然所有这些特定的系统现在都很旧了,但是为不同的对象和情况创建多个地图的想法,有些是预先计算的,有些是动态的,是后来开发的算法中的一个共同主题。

In 2006 Engel [430], Lloyd et al. [1062, 1063], and Zhang et al. [1962, 1963] inde- pendently researched the same basic idea.1 The idea is to divide the view frustum’s volume into a few pieces by slicing it parallel to the view direction. See Figure 7.18. As depth increases, each successive volume has about two to three times the depth range of the previous volume [430, 1962]. For each view volume, the light source can make a frustum that tightly bounds it and then generate a shadow map. By using texture atlases or arrays, the different shadow maps can be treated as one large texture object, thus minimizing cache access delays. A comparison of the quality improvement obtained is shown in Figure 7.19. Engel’s name for this algorithm, cascaded shadow maps (CSM), is more commonly used than Zhang’s term, parallel-split shadow maps, but both appear in the literature and are effectively the same [1964].

在2006年,Engel [430]、Lloyd等人[1062,1063]和Zhang等人[1962,1963]独立研究了相同的基本思想。1该思想是通过沿平行于观察方向对视锥体进行切片,将视锥体的体积分成几块。参见图7.18。随着深度的增加,每个后续体积的深度范围大约是前一体积的两到三倍[430,1962]。对于每个视图体,光源可以制作一个紧密包围它的平截头体,然后生成一个阴影贴图。通过使用纹理贴图集或数组,不同的阴影贴图可以被视为一个大的纹理对象,从而最小化缓存访问延迟。图7.19显示了所获得的质量改进的比较。恩格尔将这种算法命名为级联阴影图(CSM),比张的术语平行分割阴影图更常用,但两者都出现在文献中,实际上是相同的[1964]。

Figure 7.18. On the left, the view frustum from the eye is split into four volumes. On the right, bounding boxes are created for the volumes, which determine the volume rendered by each of the four shadow maps for the directional light. (After Engel [430].) 

图7.18。在左侧,眼睛的视见体被分成四个体积。在右侧,为体积创建了边界框,它决定了由平行光的四个阴影贴图中的每一个渲染的体积。(引自恩格尔[430]。)

Figure 7.19. On the left, the scene’s wide viewable area causes a single shadow map at a 2048×2048 resolution to exhibit perspective aliasing. On the right, four 1024 × 1024 shadow maps placed along the view axis improve quality considerably [1963]. A zoom of the front corner of the fence is shown in the inset red boxes. (Images courtesy of Fan Zhang, The Chinese University of Hong Kong.) 

图7.19。在左侧,场景的宽可视区域导致一个分辨率为2048×2048的阴影贴图表现出透视走样。在右边,四个1024 × 1024的阴影图沿着视轴放置,大大提高了质量[1963]。红色插图框中显示了围栏前角的缩放。(图片由香港中文大学张帆提供。)

This type of algorithm is straightforward to implement, can cover huge scene areas with reasonable results, and is robust. The dueling frusta problem can be addressed by sampling at a higher rate closer to the eye, and there are no serious worst-case problems. Because of these strengths, cascaded shadow mapping is used in many applications.

这种类型的算法易于实现,能够以合理的结果覆盖巨大的场景区域,并且是健壮的。决斗锥问题可以通过在更接近眼睛的位置以更高的速率采样来解决,并且不存在严重的最坏情况问题。由于这些优点,级联阴影贴图被用于许多应用中。

Figure 7.20. Shadow cascade visualization. Purple, green, yellow, and red represent the nearest through farthest cascades. (Image courtesy of Unity Technologies.) 

图7.20。阴影级联可视化。紫色、绿色、黄色和红色代表最近到最远的瀑布。(图片由Unity Technologies提供。)

While it is possible to use perspective warping to pack more samples into subdi- vided areas of a single shadow map [1783], the norm is to use a separate shadow map for each cascade. As Figure 7.18 implies, and Figure 7.20 shows from the viewer’s per- spective, the area covered by each map can vary. Smaller view volumes for the closer shadow maps provide more samples where they are needed. Determining how the range of z-depths is split among the maps—a task called z-partitioning—can be quite simple or involved [412, 991, 1791]. One method is logarithmic partitioning [1062], where the ratio of far to near plane distances is made the same for each cascade map:

虽然可以使用透视扭曲将更多样本打包到单个阴影图的细分区域中[1783],但标准是为每个级联使用单独的阴影图。正如图7.18所表示的,图7.20从观察者的角度显示的,每张地图所覆盖的区域是不同的。对于更近的阴影贴图,较小的视图体积提供了更多需要的样本。确定如何在地图之间分割z深度范围(一项称为z分区的任务)可能非常简单或复杂[412,991,1791]。一种方法是对数分割[1062],其中对于每个级联图,远平面距离与近平面距离的比率是相同的:

where n and f are the near and far planes of the whole scene, c is the number of maps, and r is the resulting ratio. For example, if the scene’s closest object is 1 meter away􏰕, the maximum distance is 1000 meters, and we have three cascaded maps, then . The near and far plane distances for the closest view would be 1 and 10, the next interval is 10 to 100 to maintain this ratio, and the last is 100 to 1000 meters. The initial near depth has a large effect on this partitioning. If the near depth was only 0.1 meters, then the cube root of 10000 is 21.54, a considerably higher ratio, e.g., 0.1 to 2.154 to 46.42 to 1000. This would mean that each shadow map generated must cover a larger area, lowering its precision. In practice such a partitioning gives considerable resolution to the area close to the near plane, which is wasted if there are no objects in this area. One way to avoid this mismatch is to set the partition distances as a weighted blend of logarithmic and equidistant distributions [1962, 1963], but it would be better still if we could determine tight view bounds for the scene.

其中n和f是整个场景的近平面和远平面,c是贴图的数量,r是结果比率。例如,如果场景的最近物体是1米away􏰕,最大距离是1000米,我们有三个级联的贴图,那么。最近视图的近平面距离和远平面距离将是1和10,下一个间隔是10到100以保持该比率,最后一个间隔是100到1000米。初始近深度对这种划分有很大影响。如果近深度仅为0.1米,则10000的立方根是21.54,这是一个相当高的比率,例如0.1比2.154比46.42比1000。这将意味着生成的每个阴影贴图必须覆盖更大的区域,从而降低其精度。在实践中,这种划分对接近近平面的区域给出了相当大的分辨率,如果在该区域中没有物体,这是浪费的。避免这种不匹配的一种方法是将分区距离设置为对数和等距分布的加权混合[1962,1963],但如果我们能够确定场景的紧密视图边界,那就更好了。 

The challenge is in setting the near plane. If set too far from the eye, objects may be clipped by this plane, an extremely bad artifact. For a cut scene, an artist can set this value precisely in advance [1590], but for an interactive environment the problem is more challenging. Lauritzen et al. [991, 1403] present sample distribution shadow maps (SDSM), which use the z-depth values from the previous frame to determine a better partitioning by one of two methods.

挑战在于设置近平面。如果离眼睛太远,物体可能会被这个平面夹住,这是一个非常糟糕的伪影。对于过场动画,艺术家可以提前精确地设置这个值[1590],但是对于交互式环境,这个问题更具挑战性。Lauritzen等人[991,1403]提出了样本分布阴影图(SDSM),其使用来自前一帧的z深度值来通过两种方法之一确定更好的分割。

The first method is to look through the z-depths for the minimum and maximum values and use these to set the near and far planes. This is performed using what is called a reduce operation on the GPU, in which a series of ever-smaller buffers are analyzed by a compute or other shader, with the output buffer fed back as input, until a 1 × 1 buffer is left. Normally, the values are pushed out a bit to adjust for the speed of movement of objects in the scene. Unless corrective action is taken, nearby objects entering from the edge of the screen may still cause problems for a frame, though will quickly be corrected in the next.

第一种方法是查看z深度的最小值和最大值,并使用它们来设置近平面和远平面。这是通过在GPU上使用所谓的reduce操作来执行的,其中一系列越来越小的缓冲区由计算或其他着色器进行分析,输出缓冲区作为输入进行反馈,直到剩下1 × 1缓冲区。通常,这些值会被推出一点,以调整场景中对象的移动速度。除非采取纠正措施,否则从屏幕边缘进入的附近物体仍可能导致帧出现问题,尽管在下一帧会很快得到纠正。

The second method also analyzes the depth buffer’s values, making a graph called a histogram that records the distribution of the z-depths along the range. In addition to finding tight near and far planes, the graph may have gaps in it where there are no objects at all. Any partition plane normally added to such an area can be snapped to where objects actually exist, giving more z-depth precision to the set of cascade maps.

第二种方法也分析深度缓冲区的值,制作一个称为直方图的图表,记录z深度沿范围的分布。除了找到紧密的近平面和远平面之外,图中可能有间隙,那里根本没有对象。通常添加到此类区域的任何分区平面都可以捕捉到对象实际存在的位置,从而为级联贴图集提供更多z深度精度。

In practice, the first method is general, is quick (typically in the 1 ms range per frame), and gives good results, so it has been adopted in several applications [1405, 1811]. See Figure 7.21.

在实践中,第一种方法是通用的,快速的(通常在每帧1 ms的范围内),并且给出了良好的结果,因此它已经在几个应用中被采用[1405,1811]。参见图7.21。

Figure 7.21. Effect of depth bounds. On the left, no special processing is used to adjust the near and far planes. On the right, SDSM is used to find tighter bounds. Note the window frame near the left edge of each image, the area beneath the flower box on the second floor, and the window on the first floor, where undersampling due to loose view bounds causes artifacts. Exponential shadow maps are used to render these particular images, but the idea of improving depth precision is useful for  all shadow map techniques. (Image courtesy of Ready at Dawn Studios, copyright Sony Interactive Entertainment.) 

图7.21。深度界限的影响。在左侧,没有使用特殊处理来调整近平面和远平面。在右边,SDSM被用来寻找更紧的边界。请注意每幅图像左边缘附近的窗口框架、二楼花坛下方的区域以及一楼的窗口,在这些地方,由于宽松的视图边界而导致的欠采样会产生伪像。指数阴影贴图用于渲染这些特定的图像,但是提高深度精度的想法对于所有的阴影贴图技术都是有用的。(图片由黎明工作室提供,版权所有索尼互动娱乐。)

As with a single shadow map, shimmering artifacts due to light samples moving frame to frame are a problem, and can be even worse as objects move between cascades. A variety of methods are used to maintain stable sample points in world space, each with their own advantages [41, 865, 1381, 1403, 1678, 1679, 1810]. A sudden change in a shadow’s quality can occur when an object spans the boundary between two shadow maps. One solution is to have the view volumes slightly overlap. Samples taken in these overlap zones gather results from both adjoining shadow maps and are blended [1791]. Alternately, a single sample can be taken in such zone by using dithering [1381].

与单一阴影贴图一样,由于灯光样本在帧与帧之间移动而产生的闪烁伪像是一个问题,当对象在级联之间移动时,情况会变得更糟。各种各样的方法被用来在世界空间中保持稳定的样本点,每种方法都有自己的优点[41,865,1381,1403,1678,1679,1810]。当对象跨越两个阴影贴图之间的边界时,阴影质量可能会发生突然变化。一种解决方案是让视图体积稍微重叠。在这些重叠区域采集的样本收集了两个相邻阴影图的结果,并进行混合[1791]。或者,可以通过使用抖动在这样的区域中获取单个样本[1381]。

Due to its popularity, considerable effort has been put into improving efficiency and quality [1791, 1964]. If nothing changes within a shadow map’s frustum, that shadow map does not need to be recomputed. For each light, the list of shadow casters can be precomputed by finding which objects are visible to the light, and of these, which can cast shadows on receivers [1405]. Since it is fairly difficult to perceive whether a shadow is correct, some shortcuts can be taken that are applicable to cascades and other algorithms. One technique is to use a low level of detail model as a proxy to actually cast the shadow [652, 1812]. Another is to remove tiny occluders from consideration [1381, 1811]. The more distant shadow maps may be updated less frequently than once a frame, on the theory that such shadows are less important. This idea risks artifacts caused by large moving objects, so needs to be used with care [865, 1389, 1391, 1678, 1679]. Day [329] presents the idea of “scrolling” distant maps from frame to frame, the idea being that most of each static shadow map is reusable frame to frame, and only the fringes may change and so need rendering. Games such as DOOM (2016) maintain a large atlas of shadow maps, regenerating only those where objects have moved [294]. The farther cascaded maps could be set to ignore dynamic objects entirely, since such shadows may contribute little to the scene. With some environments, a high-resolution static shadow map can be used in place of these farther cascades, which can significantly reduce the workload [415, 1590]. A sparse texture system (Section 19.10.1) can be employed for worlds where a single static shadow map would be enormous [241, 625, 1253]. Cascaded shadow mapping can be combined with baked-in light-map textures or other shadow techniques that are more appropriate for particular situations [652]. Valient’s presentation [1811] is noteworthy in that it describes different shadow system customizations and techniques for a wide range of video games. Section 11.5.1 discusses precomputed light and shadow algorithms in detail.

由于它的普及,相当大的努力已经投入到提高效率和质量[1791,1964]。如果阴影贴图的平截头体内没有任何变化,则不需要重新计算阴影贴图。对于每个光,阴影投射者的列表可以通过找到哪些物体对光可见,以及这些物体中哪些可以在接收器上投射阴影来预先计算[1405]。由于很难察觉一个阴影是否正确,可以采取一些适用于级联和其他算法的捷径。一种技术是使用低层次细节模型作为代理来实际投射阴影[652,1812]。另一种方法是不考虑微小的封堵器[1381,1811]。更远的阴影贴图的更新频率可能低于一帧一次,理论上这种阴影不太重要。这种想法存在由大的移动物体引起伪像的风险,因此需要小心使用[865,1389,1391,1678,1679]。Day [329]提出了从一帧到另一帧“滚动”远距离贴图的想法,该想法是每个静态阴影贴图的大部分都可以从一帧到另一帧重复使用,只有边缘可能会改变,因此需要渲染。像《毁灭战士》(2016)这样的游戏维护了一个大型的阴影贴图集,只在物体移动的地方重新生成阴影贴图[294]。更远的级联贴图可以设置为完全忽略动态对象,因为这样的阴影对场景的贡献很小。在某些环境下,可以使用高分辨率静态阴影图来代替这些更远的级联,这可以显著减少工作量[415,1590]。稀疏纹理系统(第19.10.1节)可用于单一静态阴影贴图巨大的世界。级联阴影映射可以与烘焙的光照贴图纹理或其他更适合特定情况的阴影技术相结合[652]。Valient的演示[1811]值得注意,因为它描述了各种视频游戏的不同影子系统定制和技术。11.5.1节详细讨论了预计算的光影算法。

Creating several separate shadow maps means a run through some set of geometry for each. A number of approaches to improve efficiency have been built on the idea of rendering occluders to a set of shadow maps in a single pass. The geometry shader can be used to replicate object data and send it to multiple views [41]. Instanced geometry shaders allow an object to be output into up to 32 depth textures [1456].

创建几个单独的阴影贴图意味着为每个贴图运行一些几何体。许多提高效率的方法都是基于这样的想法,即在一个过程中将遮挡器渲染到一组阴影贴图中。几何着色器可用于复制对象数据,并将其发送到多个视图[41]。实例化几何体着色器允许对象输出到多达32个深度纹理中[1456]。

Multiple-viewport extensions can perform operations such as rendering an object to a specific texture array slice [41, 154, 530]. Section 21.3.1 discusses these in more detail, in the context of their use for virtual reality. A possible drawback of viewport-sharing techniques is that the occluders for all the shadow maps generated must be sent down the pipeline, versus the set found to be relevant to each shadow map [1791, 1810].

多视口扩展可以执行诸如将对象渲染到特定纹理阵列切片[41,154,530]的操作。第21.3.1节在它们用于虚拟现实的上下文中更详细地讨论了这些。视口共享技术的一个可能的缺点是,所有生成的阴影贴图的遮挡器必须沿着管道发送,而不是与每个阴影贴图相关的集合[1791,1810]。

You yourself are currently in the shadows of billions of light sources around the world. Light reaches you from only a few of these. In real-time rendering, large scenes with multiple lights can become swamped with computation if all lights are active at all times. If a volume of space is inside the view frustum but not visible to the eye, objects that occlude this receiver volume do not need to be evaluated [625, 1137]. Bittner et al. [152] use occlusion culling (Section 19.7) from the eye to find all visible shadow receivers, and then render all potential shadow receivers to a stencil buffer mask from the light’s point of view. This mask encodes which visible shadow receivers are seen from the light. To generate the shadow map, they render the objects from the light using occlusion culling and use the mask to cull objects where no receivers are located. Various culling strategies can also work for lights. Since irradiance falls off with the square of the distance, a common technique is to cull light sources after a certain threshold distance. For example, the portal culling technique in Section 19.5 can find which lights affect which cells. This is an active area of research, since the performance benefits can be considerable [1330, 1604]

你自己目前正处于全世界数十亿个光源的阴影中。光只从其中的几个到达你。在实时渲染中,如果所有灯光始终处于活动状态,具有多个灯光的大型场景可能会被计算淹没。如果空间体积在视见平截头体内,但肉眼不可见,则不需要评估遮挡该接收器体积的物体[625,1137]。比特纳等人[152]从眼睛中使用遮挡剔除(第19.7节)来找到所有可见的阴影接收器,然后从光的角度将所有潜在的阴影接收器渲染到模板缓冲遮罩。这个遮罩编码了从光线中可以看到哪些可见的阴影接收器。为了生成阴影贴图,他们使用遮挡剔除来渲染光线中的对象,并使用遮罩来剔除没有接收器的对象。各种剔除策略也适用于灯光。由于辐照度随着距离的平方而下降,所以常见的技术是在某个阈值距离之后剔除光源。例如,19.5节中的入口剔除技术可以发现哪些光线影响了哪些单元。这是一个活跃的研究领域,因为其性能优势非常可观[1330,1604]

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

椰子糖莫莫

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

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

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

打赏作者

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

抵扣说明:

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

余额充值