• No results found

Atmospheric Shadows

In document Shadow Algorithms Data Miner (Page 174-178)

Sunlight scattering in the air causes the atmosphere to glow. This glow is partic- ularly visible in the presence of shadows. As usual, a ray is shot to determine the closest visible surface, and the critical question is not just if the intersection point is in shadow. The segments along the ray (not shadow ray) that are visible from the light are just as crucial (seeFigure 5.14). The information is necessary to acquire atmospheric shadows assuming only a single scattering model for light diffusion. Single scattering assumes that incoming light from the light source reaches a point along the viewing ray and deviates only once in viewing direction. If the ray is not illuminated, then the shading calculations are the same as in the original illumina- tion model, including direct attenuation due to the media. However, with partial illumination, an additional component (atmospheric shadows) is included. In the literature, these techniques are also often referred to as volumetric shadows.

In the subsequent sections, we discuss the three common techniques used to achieve atmospheric shadows: shadow volumes (Section 5.6.1), shadow depth maps (Section 5.6.2), and global illumination (Section 5.6.3).

shadow ray segment in light segment in shadow segment in light L C

Figure 5.14. Shadowing in the presence of light scattering media due to the above illuminated/not-illuminated ray segments.

5.6.1

Shadow Volumes

For each pixel, Max [390] and Nishita et al. [431] use shadow volumes to calculate the exact ray segments that are visible from the light to achieve atmospheric shad- ows, employing a single scattering model. This approach can be extended to voxel occlusion testing (Section 2.5.1), in which the voxel occlusion values that the view- ing ray traverses are used to determine which regions illuminate or shadow the ray segment. The span of the ray segment within each voxel can be trivially computed since it is readily available in voxel traversal algorithms [9]. Similarly, Ebert and Parent [152] also use subdivision grids to accelerate atmospheric shadows.

The above approaches are all CPU-based. James [264] and Biri et al. [51] ap- ply shadow volumes on the GPU where the overlapping volumes are accumulated using frame-buffer blending with depth peeling.

Wyman [648] voxelizes the shadow volumes and conceptually does a 1-bit ver- sion of voxel occlusion testing (the voxel is either lit or shadowed). However, vox- elization occurs in epipolar space, and traversal of the viewing ray can require as lit- tle as a texture lookup on the GPU. Impressive performance numbers are reported for this approach, though there may be bottlenecks residing in the voxelization step because a fairly high voxel resolution is needed to generate good results.

Billeter et al. [49] suggest that a shadow depth map already defines a volume enclosing the directly illuminated space. Thus, a mesh surrounding this space can be created and rendered in real-time with an accurate attenuation without the need for traversing the shadow depth map per sample to determine visibility and atten- uation. However, the complexity of this approach is huge when the resolution of the shadow depth map becomes large and problematic when the resolution is in- sufficient.

5.6.2

Shadow Depth Maps

It is possible to achieve atmospheric shadows from shadow depth maps as well, as- suming a conical atmospheric effect from a spotlight. Instead of comparing depth values from the point to be shaded, the viewing ray is projected to the shadow depth map pixels, and depth comparisons are done per shadow depth map pixel (seeFigure 5.15). An accumulation of the shadow tests determines the amount of shadowing that occurs in the atmospheric effect. However, doing the comparison per shadow depth map pixel can be quite expensive because the viewing ray can potentially extend through the entire shadow depth map. To improve speed, only every (stochastically chosen) nth shadow depth map pixel comparison is done; this, however, can result in noise in the atmospheric shadows. Also note that in or- der for the above approach to work, the Z-depth values stored must be the smallest Z-depth value; thus, alternative Z-depth values and surface IDs cannot be used for avoiding self-shadowing (Section 2.3.4).

The above approach is often referred to as ray marching. However, ray march- ing can also mean that at each point to determine light visibility, ray tracing (shadow rays) can be used instead of sampling shadow depth map pixels, though ray tracing tends to be more expensive. Though the above approach has been known and well implemented in offline rendering solutions since the early 1990s, the real first mention in publication is seen in the paper of Gautron et al. [186].

To achieve the above approach on the GPU, fixed sampling planes parallel to the viewing direction are used to record atmospheric shadow/visibility from the shadow depth map information [134]. However, this approach can easily result in banding artifacts for the atmospheric shadows. The use of subplanes between the sampling planes are introduced by Dobashi et al. [135], where the need for sub- planes is determined by the intensity of the region between the sampling planes. In this way, the banding artifacts can be reduced without need for a significantly higher number of sampling planes. Mitchell [412] goes over some implemen- tation details of the sampling plane approach using GPU alpha-blended planes,

P2max P2in max P1 P1out P2out in P1 P2in in P1 max P1 P1out P2max C L

shadow depth map

Figure 5.16. Combination of colored semitransparent shadows and colored atmospheric shadows. ©2011 ACM, Inc. Included here by permission [394].

while McGuire and Enderton [394] extend Mitchell’s approach, taking into account attenuation from semitransparent surfaces (seeFigure 5.16). Imagire et al. [257] reduce the number of sampling planes by averaging the illumination over regions near each plane. In general, these approaches require expensive preprocessing and high fill rates.

To reduce the frequency of ray marching in shadowed areas, Wyman and Ram- sey [647] use shadow volumes. On a per-pixel basis, the absence of shadow vol- umes means no ray marching is needed; the presence of shadow volumes indicates regions requiring ray marching. Toth and Umenhoffer [590] avoid the entire ray- marching operation for certain samples and use interleaved sampling to borrow results from neighboring samples. Engelhardt and Dachsbacher [162] use epipolar sampling so they need only ray marching depth discontinuities along the image- space epipolar lines. Baran et al. [34] use a partial sum tree to indicate state changes with respect to the visibility of the ray segments within a canonical configuration, i.e., an orthographic view and parallel lighting situation. Under such situations, the lack of state changes indicates that no ray marching is needed, as the previous ray is identical. Epipolar rectification of the shadow depth map then permits a gen- eral view (e.g., perspective) and lighting (e.g., spot or point light) configurations. Chen et al. [90] extend Baran’s approach to the GPU.

5.6.3

Global Illumination

Rushmeier and Torrance [492] apply zonal methods used in heat transfer to the computation of radiosity (Section 5.10.1). Their method discretizes the medium into small volumes for which the form factors volume/volume and volume/surface are calculated. The shadows are generated with the hemicube extended to a full cube.

5.6.4

Trends and Analysis

In the computation of atmospheric shadows, both shadow depth maps and shadow volumes have their own merits. The choice for hard shadows will likely match the choice for atmospheric shadows due to the ease of code maintenance as well as the ability to avoid any mismatches in the shadow computations, i.e., if shadow volumes are used for hard shadows in the current application, it makes sense to choose the shadow volume approach for atmospheric shadows as well.

The shadow depth map’s CPU ray-marching variation seems to be the most used in industry for offline rendering solutions. This is likely because the shadow depth map is already implemented in the same offline rendering solution, so this capability is an extension. Atmospheric shadows have been seen in film quite often nowadays.

For real-time purposes, Mitchell [413] provides a fast but approximate post- processing approach. Among the shadow depth map variations, the approaches by Baran et al. [34] and Chen et al. [90] seem the most promising. Among the shadow volume variations, the approach by Wyman [648] seems the most promis- ing. However, adoption of the choice of algorithms is unclear at this point.

Note that some of the occlusion culling techniques as discussed in Section 2.3.2 cannot be used as they are, due to the need to account for invisible shadow casters that are visible atmospheric shadow casters. Similarly, shadow depth map varia- tions addressing perspective aliasing (Section 2.3.7) may no longer be appropriate, because the effect of the atmospheric shadows cannot be easily localized to deter- mine ideal resolution. Also note that atmospheric shadows are used more often in conjunction with hard shadows. This is because if soft shadows were involved, not only would the performance be significantly slower, the visual effect of the atmo- spheric shadows would be less pronounced.

In document Shadow Algorithms Data Miner (Page 174-178)