• No results found

Combining Self-Shadowing and Filtering

In document Shadow Algorithms Data Miner (Page 57-61)

2.3 Shadow Depth Maps

2.3.6 Combining Self-Shadowing and Filtering

Recently, some interesting research into better quality prefiltering of the shadow depth map has surfaced, including the variance shadow map, convolution shadow

Figure 2.11. PCF (top) versus variance shadow mapping (bottom). ©2006 ACM, Inc. In- cluded here by permission [140].

map, and exponential shadow map. These methods use a probabilistic approach and attempt to solve both the filtering and self-shadowing problems within a single algorithm. They also generate superior-quality results.

With the variance shadow map (VSM) [140], instead of storing a depth value per pixel as in the standard approach, each pixel stores the mean μ and mean squared value of a distribution of depths, from which the variance σ2can be de- rived. The mean is computed during an additional prefiltering step of the sur- rounding pixels of the shadow depth map—the softness of the shadow is deter- mined by the size of prefiltering. When shading a particular point, the shadow oc- clusion fraction is computed by applying the one-tailed version of the Chebychev’s inequality theorem, which represents a statistical upper bound for the amount of occlusion:

unoccludedlight= σ 2

σ2+ (∥P − L∥ − μ)2.

The main advantages of this algorithm are that the filtering and self-shadowing problems are solved in a single approach, only a single shadow map pixel is ac- cessed per shading step (thus it is much faster when the filtering region is large), and the shading step should be more pleasing with thin features than percentage- closer filtering [476]. SeeFigure 2.11for a visual example of the quality improve- ment. However, the disadvantages are that the increase in shadow map memory usage doubles over the standard shadow depth map approach and that the upper bound property used as shadow occlusion often makes the shadows less dark than expected, thus making the objects incorrectly appear to float in midair. They also identify a high frequency, light-leaking problem due to large variance cases from large differences in depth values, which can be manually improved through a user- input bleeding factor. SeeFigure 2.12for a visual example of the light-leaking prob- lem. Improvements to the light-leaking problem are achieved by slicing the scene into depth intervals with better depth accuracy, using summed-area tables [334], but this comes at the expense of even larger memory requirements. This requires the user to input the number of depth intervals for acceptable results.

Figure 2.12. Light-leaking problem in the original variance shadow map implementation (left). Slicing into depth intervals reduces the light-leaking problems (right). Image courtesy of Lauritzen and McCool [334].

Very recently, a variation of the VSM can be seen in the work of Gumbau et al. [211] using a cumulative distribution function (CDF), in which the Chebychev’s inequality function is replaced with a Gaussian or power function. Gumbau et al. indicate a reduction in light-leaking problems as compared to VSM but also suggest using a number of depth intervals to resolve these problems.

Convolution shadow mapping (CSM) [11] approximates the shadow occlusion fraction using a 1D Fourier series expansion. Each shadow map pixel is converted into several basis textures instead of a single depth value. During the shading of a point, prefiltered texture samples are used to smooth the shadow result. In other words,

unoccludedlight= [w ∗ f (∥P − L∥, Zn)] (d),

where d represents the shadow map pixel, f the Fourier series expansion, w the filter kernel, and∗ the convolution operator. As compared to the variance shadow map, the convolution shadow map is slower (due to the spontaneous convolution) and uses much more memory (to store the basis textures). However, it does not exhibit the type of light-leaking problems as seen in VSM, although it does exhibit ringing artifacts, which can be manually improved by user inputs on the series expansion order and an absorption factor, respectively.

The above problems led to the proposal of the exponential shadow map (ESM) [13, 496], where an exponential expansion is used instead of the Fourier series expansion—i.e.,

f = exp(−c∥P − L∥) exp(cZn).

This shorter expansion allows the memory requirements to be significantly less than the convolution shadow map and also causes faster convolution computa- tions, and no light-leaking problems, although there is guesswork as to what the appropriate value for c might be, which can change the shadow appearance quite

Figure 2.13.Rendering of the same scene using CSM (left), VSM (center), and ESM (right). Main CSM artifacts are near the stairs where shadows fade, and main VSM artifacts are from the light-leaking problems. Image courtesy of Annen et al. [13].

drastically. An example comparison of the three techniques can be seen inFig- ure 2.13.

In terms of comparisons of the three above approaches, Lv et al. [373] evaluate both VSM and ESM and find that computing both approaches, and then taking the minimum of the occlusion values resolves much of the quality limitations of both. However, this is expensive to implement. Bavoil [43] notes that from a performance perspective, the CSM is much slower, whereas the VSM and ESM are about the same in performance. What is very important is that there are at least one or two additional parameters needed for each approach to manually fix visual artifacts, which can be a hinderance during production. However, with better quality and performance results over standard percentage-closer filtering, these techniques are quite worthwhile, and VSM appears to be the most often adopted technique of the three (VSM, CSM, ESM).

One interesting side effect of solving the self-shadowing and filtering in this manner is that the terminator problem (Section 1.4.1) now rears its ugly head be- cause the bias offset is no longer available to escape the self-shadowing (deeper subdivision is the main workaround). VSM and ESM can also exhibit terminator artifacts slightly differently, with sawtooth effects (seeFigure 2.14). The unexpected artifact from PCF is the bad self-shadowing at the polygon edges: this is due to the drastically different Z-depth values near the polygon edges (when extremely undertessellated), causing incorrect self-shadowing. This can be alleviated with a larger bias value or one of the alternate-Z self-shadowing correction techniques (Section 2.3.4).

Figure 2.14. Terminator problem shown in VSM/ESM (left) and in PCF (right). Image courtesy of Thomas Annen.

In document Shadow Algorithms Data Miner (Page 57-61)