Chapter 3 Background Knowledge
3.3 In-Scattering
( ) ( )
(
ex ab sc .
3.3 In-Scattering
There is one important thing, i.e. a scattered photon has to go somewhere. Some photons that are scattered from other place can add light to a ray. The phenomenon is in-scattering, where light which was originally headed in a different direction is scattered into the path of a light ray and adds to its radiance.
Just as there are a wide variety of BSDF models to describe scattering from surfaces, the scattering phase function () gives the probability of scattered light going in the direction()to the viewing direction as shown in Figure 3.5.
Figure 3.5 The light ray shots to a particle and reflects to eyes
Since this is a probability function, integrated over the entire sphere of directions is 1.
1 )
(
d (7)Looking at a single inscattering event as shown in Figure 3.6.
Figure 3.6 A single inscattering event
The solid angle patch of incoming directions d is infinitesimal. () is a phase function and L(i) is the incoming radiance from the patch. We get
d
Li( )( )( ) which is the inscattered radiance from the patch. We can derive the total radiance added by this inscattering event.
4 )
( ( ) ( )d
Li (8)
Considering the situation of Figure 3.3, the result is that the radiance added due to inscattering over an infinitesimal path dx is:
4 ) ( ) ( )
( dx L ( ) ( )d
dLinscatter sc i (9)
sc dx
) (
is the volume that catches the inscattering radiance, and dL(inscatter) is the amount of radiance which is added by inscattering.
We combine the Eq. 1, Eq. 4 and Eq. 9. Considering absorption, out-scattering, and in-scattering, we derive the following.
The solution to which is:
'
X is the distance along the ray at which we are evaluating the radiance. The formulation has two parts – one multiplicative (extinction) and one additive (in-scattering).
Chapter 4 Algorithm
We develop a novel real-time analytical volumetric shadows algorithm based on Wyman et al. [2] and Pegoraro et al. [3] [4]. A new sampling method is applied to the shadow region. We use a simplified analytical radiative transport equation to speed up the algorithm. We first create the frontmost shadow polygon and the final shadow polygon from the eye view and shadow map from the light view. Next, the scene is separated into two phases: “Render Scene” (No participating media, a general scene) and “Render Scattering Effect” (Only render participating media effects), as shown in Figure 1.3. In this way, we can avoid expensive radiative computation in the original scene.
We can compute the radiance and volumetric shadowing effects in the downsampling scene of the “Render Scattering Effect” phase. When we compute volumetric shadows, we use ray-marching in the shadow region. Then we use the shadow map to identify illuminated samples, as shown in Figure 1.6. Finally, we use the simplified analytical radiative transport equation and the proposed sampling method for each light sample (such as the samples between d2 and d3 in Figure 1.6).
The “Render Scene” phase is a general rendering process, which includes soft shadows.
As a result, we upsample the image in the “Render Scattering Effect” phase and combine it with the resulting image of the “Render Scene” phase by using a bilateral filter.
The following sections are structured as follows. In Section 4.1, we describe types of samples in a scene and the details of our sampling method. In Section 4.2, we derive the radiative transport equation. In Section 4.3, we derive the analytical formulation of radiative transport equation. Finally in Section 4.4 we describe the detail of reformulation of analytical radiative transport equation.
4.1 Shadow Region
A sample has three types, type 1 : not in a shadow region, type 2: in a shadow region and in the dark region of a shadow region, type 3 : in a shadow region and in the illuminated region of a shadow region, as shown in Figure 4.1.
Figure 4.1 Region R1 : Shadow Region,
samples between d1 and d2 : in the dark region of a shadow region, samples between d2 and d3: in the illuminated region of a shadow region, samples between d3 and d4 : in the dark region of a shadow region.
Considering a ray from an eye-pixel, we first use the shadow volume data to determine whether the ray passes through shadow regions or not. If not, we just compute radiance from the surface point to the eye as shown in Figure 4.2.
Figure 4.2 We do not sample in this situation, we only get the position of the surface point and the eye, then compute radiance by our simplified radiative transport equation.
If a ray passes through the shadow region, the radiance is the summation of three parts : the radiance from the eye to the frontmost shadow polygon, the radiance in a shadow region, and the radiance from the final shadow polygon to a surface point, as shown in Figure 4.4. In this thesis, we want to compute the radiance in a lit region for a ray. We get two intersection points of a lit region and a ray. Then we compute radiance by our proposed simplified radiative transport equation as shown in Figure 4.5. As a result, the final radiance is the summation of all orange segments of a ray.
In order to determine the lit regions in a shadow region, we use ray marching.
Then we apply shadow map to identify lit samples(between d2 and d3) as shown in Figure 1.6. Finally, we use our sampling method to determine the lit regions by these samples.
Now we describe our proposed sampling method. There are four sampling situations when a ray passes through the shadow region, as shown in Figure 4.3. We define “startPos” as the first sample of a lit region, “endPos” as the final sample of a lit region, “litType_before” as the type of the previous sample, and “litType_current”
as the type of the current sample. We do the following steps repeatedly until the ray passes out the shadow region. Then we obtain all lit regions ([startPos,endPos]
represents a lit region) in the shadow region.
Algorithm 4.1
(a) dark to lit (b) lit to lit
(c) lit to dark (d) dark to dark
Figure 4.3 P1 point : previous sample, P2 point : Current sample
Figure 4.4 L1 line: the part of the eye to the frontmost shadow polygon, L2 line: the part in a shadow region,
L3 line: the part of the final shadow polygon to a surface point
Figure 4.5 The orange segment represents lit region of a ray, these colorful points are intersection points of lit regions and a ray
Figure 4.6 We shot a ray from the eye Xa to the surface point Xb, h is the distance from the light to the given ray and Xh is the coordinate of its projection onto it
We use the shadow volume data to determine whether a ray passes through shadow regions or not. In implementation, we define the distances: “front distance” : the distance between the eye and the P1 point, as shown in Figure 4.7, distance “final distance” : the distance between the eye and the P2 point and distance “surface distance” : the distance between the eye and the P3 point. Then, we use the Algorithm 4.2 to determine the situation of a ray.
Algorithm 4.2
Figure 4.7 P1: the intersection point of the frontmost shadow polygon P2: the intersection point of the final shadow polygon
P3: the intersection point of the surface
4.2 Radiative Transport Equation
In this section, we derive the formulation of radiative transport equation.
Consider Eq. 11. We change symbols to fit the Figure 4.6.
where Lb is the original light intensity.
Because we focus on single-scattering, we only consider light radiance of the light source in a certain angle.
where h is the distance from the light to the given ray and Xh is the coordinate of its projection onto it. etdistance(x,light) is the ratio of light radiance that is decreased by absorption and out-scattering.
Defining Lm as the medium radiance, Eq. 14 becomes
(16)
This is the final formulation of a radiative transport equation.
4.3 Analytical Approach to Scattering
We rewrite variables
h x
u x h and Hth, Lm of Eq. 16 becomes
(17)
We rewrite variables vu 1 u 2 and wu 1 u 2 based on Pegoraro et al.
[20]. Then we get two reformulations of Eq. 17 and a combined formulation.
According to the relation of Xa , Xb and a light position as shown in Figure 4.6, we choose the fit formulation to compute radiance.
))
4.3.1 First Analytical Formulation
Let vu 1 u 2 where v(0,1,), then Eq. 17 becomes
(18)
Assume the phase function is isotropic,
Based on Pegoraro et al. [20], we derive the following,
) and imaginary part respectively.
Using the Eq. 20, Eq. 19 can be rewritten as follows
If the phase function is anisotropic, we use an expansion into a Taylor series.
Then Eq. 18 becomes
N n
Based on Pegoraro et al. [20] and using Eq. 20, we derive the following,
1
Using the Eq. 23, Eq. 22 can be rewritten as follows
)
4.3.2 Second Analytical Formulation
Similar to Eq. 20 and Eq. 23, we can derive the following,
)
We assume that the phase function is isotropic,
If the phase function is anisotropic, we use an expansion into a Taylor series. Similar to Eq. 23, we can derive the following,
i
Using the Eq. 28, Eq. 25 can be rewritten as follows
4.3.3 Combined Formulation We split the Lm of Eq.16,
(30)
The first part uses the second formulation to compute radiance, the second part uses the first formulation.
According to the coordinate of light’s projection onto a ray, we determine which formulation we use, as shown in Figure 4.8.
Figure 4.8 Xh1 : a coordinate is smaller than Xa and Xb
Xh2 : a coordinate between Xa and Xb, Xh3 : a coordinate is bigger than Xa and Xb
If it is Xh1, we use the second formulation (Eq. 27 or Eq. 29), or it is Xh3, we use the first formulation (Eq. 21 or Eq. 24), or it is Xh2, we use the combined formulation
4.4 Reformulation
In this section, we focus on the combined formulation. The combined formulation requires four evaluations of the complex-valued exponential integral Ei with the parameters Va, Vh, Wb, and Wh as shown in Figure 4.9.
Figure 4.9 Each square represents an evaluation of the complex-valued exponential integral Ei.
In Figure 4.9, the detail of each square show in Figure 4.10.
Figure 4.10 A blue square represents the same evaluation of i0 and i1
An orange square represents the same evaluation of j0 and j1
We want to find a relation to reduce the evaluations of the complex-valued exponential integral Ei. Consider Figure 4.10. We derive a relation as shown in Eq.
31.
We can reformulate the formulations of Figure 4.9 by using Eq. 32.
Figure 4.11 There are only three evaluations of the complex-valued exponential integral Ei
We propose a method to reduce one evaluation of the complex-valued exponential integral Ei, as shown in Figure 4.11. This reduction can speed up our proposed algorithm.
Chapter 5
Implementation and Results
Our algorithm works on the screen space. We shot a ray for each pixel, and then compute the radiance by using our proposed algorithm. Each pixel gets the radiance by using our algorithm. In this thesis, the complex-valued exponential integral Ei, as shown in Figure 4.9, is an expensive computation. Based on Pegoraro et al. [20], we can estimate the value of the complex-valued exponential integral Ei. We use texture- array to store shadow polygons and texture buffer to store shadow maps, then transfer them to GPU. Our algorithm uses them to check light regions of shadow regions in GPU.
We implement our algorithm on a desktop PC with Intel Core 2 Quad CPU 2.66GHz, 4G RAM, and NVIDIA Geforce 9800GT video card. All results are rendered at 1024 x 1024 pixels. Figures 5.1 and 5.2 show four scenes rendered by our algorithm. Figure 5.1(a) is the result in the “Render Scattering Effect” phase. Figure 5.1(b) is the result in the “Render Scene” phase. Figure 5.1(c) is the final result.
Figure 5.1(d)(e)(f) and Figure 5.2 are similar. Figure 5.3 shows the result about the anisotropic phase function, we use Rayleigh phase function, ()43
1cos2
, andcompare with the isotropic phase function.
(a)scattering effect
(b)general scene
(c)combined result
(d)scattering effect
(e)general scene
(f)combined result
Figure 5.2 Final results (Left) YeahRight (Right) Many objects (a)scattering effect
(b)general scene
(c)combined result (f)combined result
(e)general scene (d)scattering effect
Figure 5.3 (Left) Anisotropic phase function (Right) Isotropic phase function
Table 5.1 shows the performance of our implementation. If the scene contains many light regions in shadow regions, the computation cost is expensive. For example, the wire mesh results in the situation as shown in Figure 5.4.
Table 5.1 frame rates with various scenes
scene FPS Anisotropic phase function Isotropic phase function
Donut & dragon 6 23
Dragon 12 24
YeahRight 6 17
Many objects 8 18
Figure 5.4 dark and light regions are interlaced
Chapter 6
Conclusions and Future Work
In this thesis, we propose a novel method of single scattering for volumetric shadows by using simplified analytical radiative transport equation and our sampling method. Our result can achieve real-time when we use the isotropic phase function, interactive when we use anisotropic phase function. We obtain an accurate evaluation of the radiative transport equation by Pegoraro et al. [20]. And we use the reformulation in Chapter 4.4 and our sampling method to speed up our algorithm.
There are some limitations. If an object is complex like the wire mesh in a scene, the computation cost is expensive. Every light region needs the complex computation of the radiative transport equation, as shown in Figure 5.4. We use the radiative transport equation by Pegoraro et al. [20], restricting us to use point light or spotlight.
In the future we would like to apply our method to other types of light source. Other possible extension would be multiple scattering. One could think about multiple scattering that use point-spread function (PSF) [21] to generate a practical result.
Hegeman et al. [22] propose a method that produces high quality imagery at interactive frame rates.
References
[1] Sun, B., Ramamoorthi, R., Narasimhan, S., and Nayer, S. 2005. A practical analytic single scattering model for real time rendering. ACM Transactions on Graphics 24(3), 1040-1049.
[2] Wyman, C., Ramsey, S., 2008. Interactive volumetric shadows in participating media with single-scattering. IEEE Symposium on Interactive Ray Tracing,87-92 [3] Pegoraro, V., Parker, G.,S., 2009. An analytical solution to single scattering in homogeneous participating media. Proceedings of the 30th Eurographics Conference,28(2),329-335
[4] Pegoraro, V., Schott, M., Parker, G., S., 2009. An analytical approach to single scattering for anisotropic media and light distributions. Proceedings of the 35th Graphics Interface Conference,71-77
[5] Hoffman, N., Preetham, A., 2002. Rendering outdoor light scattering in real time.
Proceedings of Game Developer Conference
[6] Crow, Frank, 1977. Shadows algorithms for computers graphics. Computer Graphics, Vol 11, no.3, (SIGGRAPH 1977)
[7] Cowley, Les, available online at
http://www.sundog.clara.co.uk/atopics/phenom.htm.
[8] Dobashi, Y, Yamamoto, T, Nishita, T, 2002. Interactive rendering of
atomospheric scattering effects using graphics hardware. Graphics Hardware, 99-107
[9] Imagire, T, Johan, H, Tamura, N, and Nishita, T, 2007. Anti-aliased and
real-time rendering of scenes with light scattering effects. The Visual Computer, 23(9), 935-944
[10] Max, N, 1986. Atmospheric Illumination and shadows. Computer Graphics (SIGGRAPH 86), Vol 20, no.4, 117-124
[11] Biri, V, Arques, D, Michelin, S, 2006. Real time rendering of atmospheric scattering and volumetric shadows. Journal of WSCG, 14, 65-72
[12] James, R, 2003. Graphics programming methods, chapter True volumetric shadows, pages 353-366. Charles River Media
[13] Mesh, R, 2001. Hardware-accelerated real-time rendering of gaseous phenomena.
Journal of graphics tools, 6(3), 1-16
[14] Cerezo, E, Perez-Cazorla, F, Pueyo, X, Seron, F, Sillion, F, 2005. A survey on Participating media rendering techniques. The Visual Computer, 21(5), 303-328 [15] Blinn, F, J, 1982. Light reflection functions for simulation of clouds and dusty
surfaces. SIGGRAPH, 16(3), 21-29
[16] Nishita, T, Miyawaki, Y, Nakamae, E, 1987. A shading model for atmospheric scattering considering luminous intensity distribution of light sources.
SIGGRAPH, 21(4), 303-310
[17] Willis, J, P, 1987. Visual simulation of atmospheric haze. Computer Graphics Forum, 6(1), 35-42
[18] Hoffman, N, Preetham, J, A, 2002. Rendering outdoor light scattering in real time. ATI White Paper
[19] Lecocq, P, Michelin, S, Arques, D, Kemeny, A, 2000. Mathematical approximation for real-time lighting rendering through participating media.
Pacific Graphics, 400-401
[20] Pegoraro, V, Schott, M, Parker, G, S, 2009. An analytical approach to single scattering for anisotropic media and light distributions. Proceedings of Graphics Interface, 324, 71-77
[21] Premoze, S, Ashikhmin, M, Ramamoorthi, R, Nayer, S, 2004. Practical rendering of multiple scattering effects in participating media. Eurographics Symposium on Rendering
[22] Hegeman, K, Ashikhmin, M, Premoze, S, 2005. A Lighting Model for General Participating Media. Symposium on Interactive 3D Graphics