平行分割阴影映射 (PSSM)
The Parallel-Split Shadow Mapping (PSSM) is an advanced shadow mapping technique, alleviating the some of the problems produced by the standard shadow map.平行分割阴影贴图(PSSM)是一种先进的阴影贴图技术,可减轻标准阴影贴图产生的一些问题。
The idea of PSSM consists in splitting the view frustum into depth layers parallel to the view plane and rendering independent shadow maps for the split parts. Depending on the distance from the viewer, the points being mapped need different sampling frequency. It is hard to provide the sufficient sampling density in the whole range due to the complexity of the scene geometry. However, the splitting of the view frustum into smaller parts with different depth ranges optimizes the distribution of texture pixels and provides the increased sampling rates. PSSM的思想在于将视锥平视体拆分为与视平面平行的深度层,并为拆分部分渲染独立的阴影贴图。根据与观察者的距离,被映射的点需要不同的采样频率。由于场景几何的复杂性,很难在整个范围内提供足够的采样密度。但是,将视锥的视图分成不同深度范围的较小部分可以优化纹理像素的分布并提供更高的采样率。
PSSM creationPSSM创建#
There are 4 basic steps in creating the parallel-split shadow map.创建平行分割阴影贴图有4个基本步骤。
Step 1. Splitting the view frustum into several depth parts.第1步。将视锥平视分为几个深度部分。#
The positions splitting the view frustum into parallel parts along the z axis are adjusted according to the chosen split algorithm and practical requirements of the application. The shadow map with higher resolution will be used for the part nearest to the viewer, and the ones with the lower resolutions for the parts further distanced.根据所选的分割算法和应用程序的实际需求,调整将视锥的视线沿z轴拆分为平行部分的位置。分辨率最高的阴影贴图将用于距离观看者最近的部分,分辨率较低的阴影贴图用于距离更远的部分。
Depending on the chosen parameters the distribution of the split parts can be small, when they are compact and densely positioned, and large, with split parts bigger and more stretched.根据选择的参数,当拆分部分紧凑且密集放置时,拆分部分的分布可以很小,而拆分后的部分则更大,并且拉伸程度更大。
Step 2. Splitting the light's frustum.第2步。分裂光的视锥。#
As in standard shadow mapping, it is necessary to know the light's view to calculate projection matrices when generating the shadow map. The light's frustum is split into several parts covering the corresponding view frustum split parts. It also includes the objects potentially casting shadows onto the part though being outside of it.与标准阴影贴图中一样,在生成阴影贴图时,必须了解灯光的视图才能计算投影矩阵。灯光的视锥分离成几个部分,覆盖了相应的视锥视分离部分。它也包括那些可能在其外部投射阴影的对象。
The range scale specifies the exact extension of the light's frustum split parts. For example, choosing the larger scale allows the high objects (like trees or houses) to cast shadow onto the scene even if they are not directly included in it.范围标度指定光源的视锥拆分部分的确切扩展。例如,选择较大的比例可以使较高的对象(例如树木或房屋)将阴影投射到场景上,即使它们没有直接包含在其中。
Step 3. Rendering PSSMs.步骤3.渲染PSSM。#
Each shadow map is sequentially rendered with appropriate resolution and parameters for each split part.每个阴影贴图都以适当的分辨率和参数顺序地用于每个分割部分。
Step 4. Synthesizing Shadows.步骤4.合成阴影。#
With the PSSMs generated, the shadow effects can be synthesized for the whole scene. The algorithm is the same as used in standard shadow mapping. The only difference is selecting the correct shadow map from PSSMs when determining if a pixel is shadowed.生成PSSM后,可以为整个场景合成阴影效果。该算法与标准阴影映射中使用的算法相同。唯一的区别是在确定像素是否有阴影时从PSSM中选择正确的阴影贴图。
Advantages and Disadvantages的优点和缺点#
Compared to the standard shadow mapping technique the parallel-split shadow mapping has the following advantages, which are important for large-scale virtual environments:与标准阴影映射技术相比,并行拆分阴影映射具有以下优点,这对于大规模虚拟环境很重要:
- Significant reducing of the aliasing errors due to increased sampling frequency in texture space.由于增加了纹理空间中的采样频率,显着减少了混叠误差。
- Successful handling of the dueling frusta case, when the light and view directions are nearly opposite.当光线和视线方向几乎相反时,成功处理了决斗的视锥细胞情况。
- Fully exploiting available shadow map resolution while implementing better dynamic shadowing effects.在实现更好的动态阴影效果的同时充分利用可用的阴影贴图分辨率。
- Split scheme that does not require expensive scene analysis.不需要昂贵的场景分析的拆分方案。
There also appear some difficulties by practical implementation of the PSSM:通过PSSM的实际实施还存在一些困难:
- Multiple rendering passes are required for generating shadow maps and synthesizing shadows, trading performance cost for quality: in typical cases the number of polygons rendered using PSSM technique is much bigger compared to a standard shadow map.生成阴影贴图和合成阴影需要多次渲染,以牺牲性能为代价进行质量转换:在典型情况下,与标准阴影贴图相比,使用PSSM技术渲染的多边形数量要大得多。
- Storage strategy should be carefully chosen, otherwise, it can place considerable demand on the available interpolators.应该仔细选择存储策略,否则,它会对可用的插值器产生相当大的需求。
- The splitting planes in PSSM introduce discontinuities that can interfere with texture filtering. PSSM中的分裂平面引入了不连续性,可能会干扰纹理过滤。