• No results found

Soft Shadow Basics

In document Shadow Algorithms Data Miner (Page 119-124)

4.2.1

Computing the Soft Shadow Integral

In Section 1.2.2, recall that a fraction in the range of [0,1] is multiplied with the light intensity, where 0 indicates umbra, 1 indicates fully lit, and all values in between indicate penumbra. This statement is actually incorrect, and thus it is important to understand the nature of the integral that must be evaluated in order to compute the soft shadow resulting from the direct illumination of an extended light source. The correct integral of the irradiance E at a receiving (illuminated) surface element dA can be expressed as follows:

E= ∫ Ae

V(L cos θ cos ϕ πr2 ) dAe,

where V is the binary visibility of an emitting surface element dAe on the light source, and the remainder of the equation is the irradiance over a surface element as if fully lit.

Ideally, if the domain of integration can be reduced to the fragments of the extended light that are visible from the point to be shaded (i.e., the points on Ae for which V is 1), then the integral reduces to a direct illumination integral over precisely these fragments. Unfortunately, as will be seen in back-projection algo- rithms [141, 561], determining these fragments is a difficult problem in itself, as visibility must be evaluated for each fragment dAefor any visible 3D point. Thus a common simplification for the computation of the integral is to assume that it is separable, and to integrate visibility and irradiance separately. Many of the soft shadow algorithms presented inChapter 4will assume this separation of the visi- bility term. This gives rise to the following approximation of the irradiance:

E= [∫ Ae VdAe] [∫ Ae L cos θ cos ϕ πr2 dAe] .

Note that whereas this approximation will generate soft shadows, the accuracy of the results will not necessarily be reliable, especially in cases where the solid an- gle subtended by the light source is large (e.g., the light source is large and/or close to the receiving surface) or the extended light’s normal is close to perpendicular to the surface’s normal. The inaccuracies from the decoupling of the irradiance integrand and of the visibility factor will be most evident when the parameters θ, ϕ, and r vary greatly over the domain of the integrand and the visibility function V is not constant. For example, inFigures 4.1and4.2, the same fraction of the linear light’s length is occluded from the point to be shaded. However, whether the shadowing function is evaluated outside or inside the irradiance integral leads to different results, as the solid angle formed by the visible parts of the light is quite different.

linear light 50% occluded 50% occluded P P occluder occluder receiver a b b

Figure 4.1.The same occlusion fraction of an extended light source may not result in the same illumination value.

The appeal of such a simplification is great, given that an analytic solution can be computed for the non-shadowed illumination integral [430, 465, 578] for spe- cific reflection models and that some algorithm can be used to approximate the visibility of the light (i.e., the integral of V over Ae). The approximation is also simpler for radiosity solutions (see Section 5.10.1), for some direct illumination al- gorithms [550, 669], for sampling criteria in the final gathering of penumbrae [504], and may also be applied to specular integrands. However, care must be taken that the artifacts resulting from such an approach are reasonable. This being said, such approximations are more than acceptable in several visually plausible situations. In fact, the differences are not visually discernable in many situations and applica- tions, thus explaining their popularity.

Another approximation consists of computing individual shadows and then combining them. This remains an approximation, as the combined occlusion (also

Figure 4.2.In the top row: shading without shadowing (left), and shading with a constant shadowing fraction (50%) for all pixels (right). In the bottom row: shading with correct pixel-wise shadowing fraction (50%, but within the integral) from an occluder at the center of the light source (left), and to the right side of the light source (right).

Figure 4.3. The shadow cast by a set of objects can be quite different than the combined shadows of each individual object. Image courtesy of Hasenfratz et al. [227], ©Eurographics Association 2003. Reproduced by permission of the Eurographics Association.

called occluder fusion) can be quite different than summing up occlusion factors for each individual shadow. This is illustrated for a simple case inFigure 4.3and for an actual 3D rendering inFigure 4.4.

Figure 4.4. In the top row: correct shadow cast by the left occluder only (left), and by the right occluder only (right). In the bottom row: combined shadows as the maximum occlu- sion of the two individual shadows (left), and correct shadows from both occluders (right).

4.2.2

Generic Algorithmic Approaches

From an algorithmic standpoint, the most straightforward approach to consider soft shadow generation from extended lights is to apply any existing hard shadow algorithm for a point light source and simulate the extended light shadow with many point lights, where each point light represents a small region of the extended light. This is actually the basis for the approach by Haeberli [218], Brotman and Badler [71] (Section 4.5.4), for distribution ray tracing [108] (Section 4.7.1), and Herf and Heckbert’s [240] approach (Section 4.4.1), among others. However, just a straightforward implementation of multiple point source simulation tends to be very slow, often requiring a large amount of memory for the shadowing structures, and usually results in separation or banded results, i.e., there are noticeable shadow boundaries from the point sources (seeFigure 4.5as an illustration of this separa- tion/banding artifact (left) versus smooth soft shadows (right)). This produces a very low-quality result because our human visual system is very sensitive to and unforgiving of banding artifacts. Banding from multiple point sources is reduced if ● Many such point sources are used, e.g., Herf and Heckbert [240] use as many as 256–1024 point sources to simulate an extended light, which results in slow rendering times. The difficult question becomes then how many point sources are sufficient, and this question is barely addressed at all in the liter- ature.

● Some low-discrepancy, nonuniform, or stochastic sampling patterns are em- ployed, as in distribution ray tracing techniques (see Section 4.7.1). Such pat- terns usually result in noise (to mask the banding artifacts), and our human visual system is a lot more accepting of noise than banding.

Figure 4.5. Treating soft shadows as an averaging of hard shadows from multiple point sources can result in shadow bands (left), but ultimately converges to proper soft shadows (right). Image courtesy of Hasenfratz et al. [227], ©Eurographics Association 2003. Repro- duced by permission of the Eurographics Association.

● Some filtering, interpolation, or blending is done between the multiple sam- ples.

Due to the above performance and banding issues, multiple point sources have not been the only approach explored in the literature. Many of the algorithms that are discussed in this chapter tend to start off from a hard shadow preprocess, then perform operations to approximate soft shadows. This can be seen in plateau shadows (Section 4.4.2), z-difference penumbra approximation (Section 4.5.1), mi- cropatches (Section 4.5.2), silhouette detection-based solutions (Section 4.5.3), penumbra wedge implementations (Section 4.6.3), single-ray analytic solution (Section 4.7.3), and ray tracing depth images (Section 4.7.4). Because the results are approximated from a hard shadow standpoint, the results are not physically correct but can be visually pleasing to different degrees.

For further performance reasons, the concepts of an inner penumbra and an outer penumbra are introduced (see Figure 4.6). The inner penumbra is the soft shadow region inside the umbra produced from a single representa- tive point source. Algorithms computing just the inner penumbra usually re- sult in undersized shadows. The outer penumbra is the soft shadow region out- side this umbra, and algorithms computing just the outer penumbra usually re- sult in oversized shadows. This distinction is useful in some approximations be- cause certain algorithms compute for performance reasons only the outer penum- bra [452, 220, 83, 646] or just the inner penumbra [254, 309]. Physically accurate results should produce both inner and outer penumbrae.

point light square light occluder umbra outer penumbra inner penumbra

In document Shadow Algorithms Data Miner (Page 119-124)