• 沒有找到結果。

Chapter 1 Introduction

1.1 Motivation

Realistic rendering is of concern to the movie and gaming industries. However, efficiently simulating accurate radiance transport in participating media is a challenging task until today. Computer graphics make simplifying assumptions about scenes to maintain interactivity. One common assumption limits light interactions to surfaces, ignoring contributions from light scattered by particles in the air, which means that radiance is constant along rays between surfaces. However, there are many real-world situations where this assumption is inaccurate, like scattering from particles in the air, fog, a shaft of light or volumetric shadows.

Recently introduced interactive methods, Sun et al. [1], more realistically account for single scattering effects. However, these approaches ignore volumetric shadowing where occluders block light from scattering in shadow regions. Volumetric effects have been well studied in the context of offline rendering. While Monte-Carlo techniques or volumetric photon mapping produces volumetric effects, these methods require extensive computation. Wyman et al. [2] propose an algorithm to obtain volumetric shadows, and compute radiance by Sun et al. [1]. Compare to Sun et al. [1], Pegoraro et al. [3] produce a robust result. Pegoraro et al. [3] present a novel analytical approach to single scattering in isotropic participating media. Furthermore, Pegoraro et al. [4] present an analytical approach to single scattering in anisotropic

participating media. However, the computation of the analytical approach is more expensive than other approaches in volumetric shadows.

In our approach, based on Wyman et al. [2] and Pegoraro et al. [3] [4], we propose a new sampling method in the shadow region and reduce analytical radiative transport equation. The FPS of Pegoraro et al. [4] is low in the volumetric shadowing scene which contains anisotropic media. In our approach, the performance can be interactive in the same situation. Compare to other real-time approach, our approach sacrifices few performance to obtain a better result, but it is still real-time in isotropic media, interactive in anisotropic media.

Researchers have proposed a number of methods for interactive volumetric shadows. These methods fall into three categories, based on shadow volumes, ray marching, or volume slicing. The methods based on shadow volumes may produce an artifact as shown in Figure1.1. The methods based on volume slicing and ray marching produce aliasing as shown in Figure1.2.

Figure1.1 The region between

d2 and d3 is too dark

Figure1.2 Ray marching produce aliasing

Our approach uses shadow volume to detect shadow regions. Then we use ray marching to avoid the artifact as shown in Figure1.1, and reduce ray marching costs by using our sampling method and simplified analytical radiative transport equation.

The performance is real-time in most scenes. The result is better than other real-time volumetric shadowing techniques.

1.2 System Overview

Figure1.3 The system overview

Figure 1.3 gives an overview of our system. First, user creates shadow map from the light view, and shadow volume. The Shadow volume is not tradition; user just creates the frontmost shadow polygon and the final shadow polygon from the eye view. To enter the core of our system, the scene is considered into two parts, “Render Scene” (No participating media, a general scene) and “Render Scattering Effect”

(Only render participating media effects) as shown in Figure 1.4.

Figure 1.4 (Left) Only render participating media effects, (Right) a general scene

The “Render Scattering Effect” step is the core of our algorithm. First, we downsample the scene, because the way can reduce radiative computation. Second, we shot rays like ray marching. Third, we use the shadow volume data to determine the shadow region as shown in Figure 1.5. Fourth, especially for the sample in the shadow region, we use shadow map to determine whether the sample is in the shadow or not, as shown in Figure 1.6.

So, a ray can be separated into two parts, in and out a shadow region respectively. Every ray computes radiance by simplified radiative transport equation, and combines our sampling method in the shadow region.

The “Render Scene” step is a general rendering, like phong lighting model.

The “Bilateral filter” step combines the image of the “Render Scattering Effect” step and the image of the “Render Scene” step by using a bilateral filter.

The major contributions of this thesis are as follows: First, we apply a new sampling method to volumetric shadows to speed up the radiative computation.

Second, we speed up the algorithm to real-time in most scenes. Third, our approach has a better result than other approaches for interactive volumetric shadows.

Figure 1.5 Shadow region Figure 1.6 d1~d2, d3~d4 : in shadows d2~d3 :not in shadows

1.3 Thesis Organization

The rest parts of this thesis are structured in the following manner. Chapter 2 reviews the related work in volumetric shadows and scattering. Chapter 3 introduces background knowledges of the radiative transport equation. Chapter 4 describes the major concept of our real-time analytical volumetric shadows algorithm. Chapter 5 provides the implementation details. Chapter 6 shows the result of our algorithm and comparison with previous works. We also give some discussion in this chapter.

Finally, we conclude our work and propose some future works in the Chapter 7.

Chapter 2

Related Works

In this chapter, we survey previous works on volumetric shadows and scattering.

2.1 Volumetric Shadow

Shadow and fog play an important role in computer graphics. Volumetric shadow is an effect which combines shadow and fog. Crow [6] proposes a concept about the shadow polygon. Cowley [7] combines shadows and fog to produce the shafts of light through the trees, or the god-rays from the clouds. Dobashi et al. [8]

propose a solution that sample the scene, using quads parallel to the image plane, to generate volumetric type effects as shown in Figure 2.1. These quads cut through a 3D representation of the participating media. However, using fewer quads increases aliasing as shown in Figure 1.2. Imagire et al. [9] solve the problem by averaging illumination over regions near each quad.

Figure 2.1 The result of Dobashi et al. [8]

Max [10] presented an approach which used the shadow volume geometry to determine the regions of lit and unlit atmosphere and used depth sorted shadow volumes to accumulate in scatter along each eye-pixel ray. Methods using shadow volumes [11, 12, 13] identify shadowed segments of viewing rays that do not contribute to in-scattering. But the methods do not guarantee correct results when the shadow geometry used overlaps, as shown in Figure 1.1. To solve the problem, it requires repeated depth peeling to sort shadow quads. However, the way adds sorting costs to the rendering time. Wyman et al. [2] propose an algorithm that combine Sun et al. [1] with ray-marching. This method can handle light-shafts and anisotropic light distributions.

2.2 Scattering

Scattering effects arise from participating media, such as smoke, haze, and fog.

Several techniques have been proposed in computer graphics for rendering participating media. Cerezo et al. [14] provide a survey of the methods for scattering.

Blinn [15] introduces an analytical model for homogeneous media. Max [10] proposes to evaluate the air-light integral by fitting Hermite cubic polynomials.

Nishita et al. [16] propose a method based on ray-marching. Dobashi et al. [8]

propose a method based on volume-slicing. These methods are based on Riemann sums prompt to under-sampling artifacts. Willis [17] presents a simple model for homogeneous media considering a constant in-scattering term. Hoffman et al. [18]

present a simple model for single atmospheric scattering of directional sun light in the constant and exponentially decreasing media respectively. Considering point light

sources in homogeneous media, Lecocq et al. [19] present an angular formulation of the radiative transport equation (RTE). The resulting RTE is expanded into a Taylor series. Our approach only expands the phase function into a Taylor series. Biri et al.

[11] combine the angular formulation of the RTE and volumetric shadows as shown in Figure 2.2.

Figure 2.2 The result of Biri et al. [11]

Sun et al. [1] rederive Lecocq [19]’s RTE using a different notation and perform an additional linear change of variable to simplify it further. The air-light integral value stores a table via precomputation. Pegoraro et al. [20] propose a closed-form solution to the air-light integral in anisotropic media and a combined formulation of the air-light integral which allows both anisotropic phase functions and light distributions.

The method can implement on shaders. Compare to Lecocq et al. [19] and Sun et al.

[1], the quality of the results is better as shown in Figure 2.3.

Lecocq et al. [19] Sun et al. [1] Pegoraro et al. [20]

Figure 2.3 Visualization of the absolute error mapped to hue (from blue to red)

Dobashi et al. [8] and Pegoraro et al. [20] show methods for achieving scattering effects at interactive rates. These methods are quite powerful but too slow to be used in games. The method which Hoffman et al. [18] proposed is appropriate for use in games. However, the accuracy of the result is lower than Dobashi et al. [8] and Pegoraro et al. [20].

Chapter 3

Background Knowledge

In this chapter, we will introduce some background of the radiative transport equation which is related to our work. Radiative transfer is the physical phenomenon of energy transfer in the form of electromagnetic radiation. The propagation of radiation through a medium is affected by absorption, emission and scattering processes. The radiative transport equation describes these interactions mathematically.

A particle can interact with light hitting it in one of two ways: the particle can scatter the light or it can absorb it. Particles may also emit light on their own – we will ignore this phenomenon. Light interact with particles as shown in Figure 3.1

Figure 3.1 Absorption and out-scattering reduce radiance, emission and in-scattering add radiance

Absorption – the reduction in radiance due to the conversion of light to another form of energy, such as heat

Emission – energy that is added to the environment from luminous particles

Scattering – how light heading in one direction is scattered to other directions due to collisions with particles

3.1 Absorption

A particle’s absorption of light can be quantified by its absorption cross sectionab(). We can see in Figure 3.2, the particle effectively behaves like a sphere.

Figure 3.2 Absorption effect

Looking at the cross section of this sphere, we have an area which absorbs the incident irradiance at each point. The total absorbed flux is the incident irradiance integrated over the cross section area, ab() . We define the absorption coefficient:ab() abab(), ab is a certain volume density of particles.

We define a box with an area “A” perpendicular to the light ray direction, and a small depth dx in the ray direction as shown in Figure 3.3.

Figure 3.3 microcosmic light effect

The Volume of this box is Adx, so the aggregate absorption cross section area in the box isab()Adx. We assume that dL() is the amount of radiance which is absorbed,

) (

L is the radiance traveling a distance dx through the media. We can derive a proportional relation.

A Adx L

dL ab( )

) (

)

(

 (1) The radiance L()(x) can be found by solving the differential equation in Eq. 1.

ab x

e L x

L

()

( ) 

(0) () (2)

) ( 0

L is the radiance at point 0.

Eq. 2 assumes that ab() is constant. If it is spatially variant, we can derive the following.

x ab xdx

e L x

L

0

' ' ) (

) ( 0 )

(

( )

(3)

3.2 Out-Scattering

Similar to absorption, a particle’s out-scattering of light can be quantified by its scattering cross sectionab(). We can see in Figure 3.4, the particle scatter light out of a ray and reduce its radiance.

Figure 3.4 The out-scattering effect

As we did for absorption, we define the scattering coefficient:sc() scsc(),sc is a certain volume density of particles. Like a situation for absorption, we can derive a proportional relation.

A Adx L

dL sc( )

) (

)

(

 (4) If we assume that sc() is constant, we can derive the following.

sc x

e L x

L()( ) (0) () (5) If sc() is spatially variant, we can derive the following.

x sc xdx

e L x

L

0

' ' ) (

) ( 0 )

(

( )

(6)

Because absorption and out-scattering decrease radiance, we can add the coefficients for absorption and out-scattering. The result is the extinction coefficient,

) ( ) ( )

(

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,

Assume the phase function is isotropic,

相關文件