• 沒有找到結果。

Rendering of Light Scattering Effects

3.1 Numerical Methods

Unlike stochastic methods that may take hours to render a single image, many numerical solutions have been developed to accelerate the rendering process, though many still have limitations for real-time rendering applications. A common technique for numerical methods is to use two passes, the first for computing illumination within the medium and the second for rendering the medium.

3.1.1 Shafts of Light and Volumetric Shadows

Shafts of light result from the non-shadow regions of objects in participating media, whereas volumetric shadows result from the shadowed regions of objects in participating media. Illu-minated shafts of light were rendered interactively using virtual planes [Dobashi et al., 2000b], storing incident illumination on rectangular meshes lined up perpendicular to the view ray at regular intervals. The lighting equation used is Nishita’s single scattering integral for point light sources(Equation 2.18) with a visibility term added, seen here:

Ieye = Iobjβ(T ) + Z T

0

F (α)H(t)Ip(t)β(t)dt. (3.1) The notation is as follows: β(t) is the transmittance over distance t, T is the distance from the eye to the nearest object, F (α) is the phase function with phase angle α, H(t) is the visibility function(binary) of scattering point P , and Ip(t) is the intensity of light reaching P .

The key hardware acceleration was the storage of the F (α)Ip(t)β(t) term of the integrand as an illumination pass onto ”virtual planes”, lattice meshes that are lined up

perpendicular to the view ray at regular intervals. Storing the F (α)Ip(t)β(t) term requires projecting a light map onto each ”virtual plane” to calculate part of Ip(t). Ignoring the visibility term H(t) for a moment, the medium can then be rendered by

sampling the integrand at lattice points of every virtual plane

rendering the virtual planes with an additive blending function from back to front (volume rendering)

Only lattice points of the ”virtual planes” are used to sample the integrand to increase efficiency, and Gouraud interpolation is used to evaluate the term at any arbitrary point.

The visibility term of the integrand, H(t), is applied by using the shadow map algorithm when rendering the virtual planes. That is, points on the virtual plane with depth value greater than the corresponding depth in the shadow map will have contribution zero when rendered. Banding problems caused by aliasing due to finite sampling limitations may occur in some situations. Increasing the amount of sampling is the straightforward solution;

however, this quantity is highly dependent upon each scene and varies widely.

3.1.2 Atmospheric Effects

The method of [O’Neil, 2005] can render real-time atmospheric scenes either viewing the earth from space or the ground (like a horizon scene). Single-scattering approximations are adequate for these general atmospheric effects. Thus, this work essentially uniformly sam-ples the atmospheric model for single scattering of Equation 2.19 in the vertex or fragment shader using programmable graphics hardware. To evaluate optical depth terms, a polyno-mial best fit function was found using mathematical analysis software. Precomputed tables in texture memory may be used as well to compute optical depth terms, but polynomial functions were used to avoid texture lookups for hardware without texture lookup capabil-ity in the vertex shader. Furthermore, high dynamic range rendering is demonstrated for sky and terrain rendering. Since sampling is performed in the vertex or fragment shader, the cost of using a loop for sampling can dramatically increase if the scene requires greater accuracy. Otherwise, the method is effective for real-time rendering of atmospheric scenes with non-uniform scattering effects.

3.1.3 Multiple Scattering

Inhomogeneous media

By investigating the effects of multiple-scattering, Premoze et. al developed the point spread function (PSF), which measures the spatial spreading of incident radiance in analytic form [Premoze et al., 2004]. Based upon an analytic multiple scattering term derived from the point spread function, Hegeman et. al developed a lighting model for an inhomogeneous medium with multiple scattering effects at interactive rates [Hegeman et al., 2005], but illumination and medium parameters must be fixed. Other restrictions include the absence of volumetric shadows for objects within the medium. The lighting model uses both analytic and numerical techniques. Descriptions for the development of the point spread function, analytic multiple scattering term, and lighting model with multiple scattering effects follow.

Using measurement analysis, Premoze et. al developed a point spread function that measures the spatial spreading of incident radiance for a given medium in an analytic form [Premoze et al., 2004]. Spatial spreading is described as the effect of a light beam’s broadening as it propagates through a medium. The point spread function has two param-eters, the amount of out-scattering l for a path and the distance S from the origin of the beam, and is given by

w2(l, S)d = < θ2 > lS2

24(1+ < θ2 > (a/b)l2/12, (3.2) where a and b are the absorption and scattering coefficients, respectively, and < θ2 > is the mean square scattering angle. The work of [Premoze 2003] introduced the notion of a Most Probable Path (MPP), such that only paths close to MPPs contribute to a mul-tiple scattering contribution. Also, an alternative method for modeling light scattering is introduced, known as the path integral. The path integral formulation describes an integral over an infinite number of possible paths, for which only out-scattering need be accounted.

Using both the path integral formulation and point spread function, an analytic term for multiple scattering contribution in a strongly forward-scattering inhomogeneous medium is developed. It is based upon the assumption that only paths close to the MPP are added to the contribution. Additionally, curved MPPs are approximated by two linear segments.

The result for the multiple-scattering contribution is The outer integral is an integral over MPPs, each with scattering parameter l. The inner integration is the gaussian-weighted incident radiance in the plane perpendicular to the light direction. c is the extinction coefficient. Ac is a curvature term. PM S is a multiple scattering phase function.

Based upon the above multiple scattering term, Hegeman et. al developed a lighting model for an inhomogeneous medium with multiple scattering effects at interactive rates [Hegeman et al., 2005]. The scene is restricted to static directional light and a static volume. Strongly forward-scattering with mean square scattering angle < θ >2is reasonably assumed. The main contribution of this work was the implementation of the multiple scattering term using graphics hardware and data structures for acceleration. To accomplish this task, a couple of large data structures are created before rendering. A 3D precomputed light volume data structure stored an approximation for the total radiance arriving at each voxel, essentially computing the scattering parameter l of Equation 3.3. A second data structure for accelerated performance, called the LightImage, is a visibility map from the perspective of the volume. A mipmap pyramid is constructed where each level blurs over a different width w. The LightImage essentially computes the inner integral of Equation 3.3.

With these data structures, a technique of volume rendering can be applied to render the medium, effectively sampling the integral for paths close to the view ray. A series of view-aligned planes, whose vertices are assigned texture coordinates corresponding to their intersection with the light volume at regular intervals, are created for each frame and rendered in back-to-front order with an additive blending function.

Cloud Rendering

Based on a two-pass rendering technique employed by [Dobashi et al., 2000a] for clouds under a single scattering assumption, a complete system for real-time cloud rendering [Harris and Lastra, 2001] was developed that used a particle system to model clouds and

precomputed an isotropic multiple forward scattering term in dynamically-generated im-postors during an initial illumination pass. Anisotropic single scattering was accounted for during the second visualization pass. To amortize the cost over many frames, impostors are required to achieve real-time rates. Evaluation of the differential form (Equation 2.13) for the integral light transport equation is done as a recursive operation, where each step attenuates the old radiance and adds the source radiance contribution of the present parti-cle from back to front. The partiparti-cles are rendered using splatting, such that the partiparti-cles are sorted with respect to the light and rendered back-to-front with a recursive blending equation. The method is specifically tailored to scattering seen in clouds. Another limiting factor is the precomputation required, which is dependent upon the scene illumination and scattering properties.

相關文件