Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity...

26
CS174b Computer graphics Radiosity Handout Radiosity Overview In order to create realistic images, one must understand the properties of light and the human visual system. This handout attempts to characterize the prop- erties of light and visual perception in order to provide a firm basis for the development of image synthesis algortihms. 1 Radiometry Radiometry is the study of the physical measurement of electromagnetic energy. Since light is simply one form of electromagnetic energy, the field of radiometry offers many theories and algorithms regarding the properties of light. 1.1 Radiance One of the most fundamental quantities that radiometry brings to image syn- thesis is radiance. Radiance is the power per unit projected area perpendicular to the ray, per unit solid angle in the direction of the ray and is denoted L(x, ω). We note that radiance is a function of five independant variables, three specify position and two specify direction. Radiance is extremely useful in image syn- thesis in that all other radiometric quantities can be calculated from it. We can now define the differential flux contained within a small beam as: dΦ= L(x, ω) cosθ dω dA (1.1) Where θ is the angle between the surface normal and the beam direction, is the differential solid angle of the beam, and dA is the differential cross-sectional area of the beam. It is important to note that the radiance in the direction of a ray is constant along the ray. This can be shown by considering the total flux contained within a differential pencil of light (see Figure 1): dΦ= L 1 1 dA 1 = L 2 2 dA 2 (1.2) 1

Transcript of Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity...

Page 1: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

CS174b Computer graphics Radiosity Handout

Radiosity

Overview

In order to create realistic images, one must understand the properties of lightand the human visual system. This handout attempts to characterize the prop-erties of light and visual perception in order to provide a firm basis for thedevelopment of image synthesis algortihms.

1 Radiometry

Radiometry is the study of the physical measurement of electromagnetic energy.Since light is simply one form of electromagnetic energy, the field of radiometryoffers many theories and algorithms regarding the properties of light.

1.1 Radiance

One of the most fundamental quantities that radiometry brings to image syn-thesis is radiance. Radiance is the power per unit projected area perpendicularto the ray, per unit solid angle in the direction of the ray and is denoted L(x, ω).

We note that radiance is a function of five independant variables, three specifyposition and two specify direction. Radiance is extremely useful in image syn-thesis in that all other radiometric quantities can be calculated from it. We cannow define the differential flux contained within a small beam as:

dΦ = L(x, ω) cosθ dω dA (1.1)

Where θ is the angle between the surface normal and the beam direction, dω isthe differential solid angle of the beam, and dA is the differential cross-sectionalarea of the beam.

It is important to note that the radiance in the direction of a ray is constantalong the ray. This can be shown by considering the total flux contained withina differential pencil of light (see Figure 1):

dΦ = L1 dω1 dA1 = L2 dω2 dA2 (1.2)

1

Page 2: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

Figure 1: Invariance of radiance within a pencil of light

but since dω1 = dA2/r2 and dω2 = dA1/r

2, we can define:

T = dω1 dA1 = dω2 dA2 =dA1 dA2r2

(1.3)

T is the throughput of the beam. Note that the throughput is purely a functionof the geometry of the beam, therefore it directly follows that:

L1 = L2 (1.4)

1.2 Irradiance

Another important quantity related to radiance is irradiance. Irradiance, E,is the radiant energy per unit area incident on a surface.

E =

Ω

Li cosθ dω (1.5)

We can define the term cosθ dω to be the projected solid angle. This quantitycan be thought of as the projection of the differential area on the surface of asphere onto the base of the sphere (see figure Figure 2). One can note that theintegral of this projected solid angle is simply the area of the base of the unithemisphere, π.

1.3 Radiosity

Radiosity, B, is similiar to irradiance. However, instead of computing the energyincident on a surface, radiosity is the energy per unit area exiting a surface.

2

Page 3: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

Figure 2: Projected Solid Angle

B =

Ω

Lo cosθ dω (1.6)

1.4 Radiant Intensity

While the above quatities are extremely useful in categorizing the transport oflight between surfaces, they all prove to be inadequate in describing the energydistribution of point light sources. We can easily overcome this problem bysimply defining a new radiometric quantity, radiant intensity. The flux in asmall beam of of differential solid angle dω is given by:

dΦ ≡ I(ω)dω (1.7)

3

Page 4: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

Where I is the radiant intensity of the light source (power per solid angle)

The total flux of the light source is given by:

Φ =

Ω

I(ω)dω (1.8)

For an isotropic point light we can see that:

I =Φ

4π(1.9)

One can now determine the irradiance on a differential surface caused by a pointlight source by determining the solid angle of the differential area from the viewof the light source. This gives:

E = Idω

dA=Φ

cosθ

|x− xs|2

(1.10)

Where x denotes the position of the surface element and xs denotes the positionof the light source. From this equation, one can easily see the 1/r2 fall-off ofthe inverse square law.

2 Rendering Equations

One may now ask, given these radiometric quantities, how does one categorizethe distribution of light in a given envionment? In the following sections, wewill derive the rendering equation, a unified equation of light transport for agiven environment as well as a simplified version of this equation known as theradiosity equation. We begin by examining how to mathematically categorizethe reflection of light from surfaces.

2.1 Bidirectional Reflectance Distribution Functions

Given a certain amount of light incident on a surface, we wish to calculate theamount of light reflected in a given direction. The amount of light reflected ina direction ωr is proportional to the incident irradiance from the direction ωi.More succintly:

dLr(ωr) ∝ dE(ωi) (2.1)

4

Page 5: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

The exact amount that this incident irradiance is scaled by is called the bidi-rectional reflection distribution function (BRDF). The BRDF if the ratio ofreflected radiance in the direction ωr to the differential irradiance in the direc-tion ωi that creates it.

fr(ωi → ωr) ≡Lr(ωr)

Li cosθ dωi(2.2)

If the BRDF is physically-based, then the incident and reflected directions areinterchangeable.

fr(ωi → ωr) = fr(ωr → ωi) (2.3)

One can also note that the BRDF is a high dimensional function (4 dimensionalfor the two directions and another 3 if the BRDF varies with position). However,if the BRDF is isotropic (rotating the surface about its normal does not changethe BRDF), the dimensionality of the BRDF can be reduced. An isotropicsurface implies:

fr((θi, φi + φ)→ (θr, φr + φ)) = fr((θi, φi)→ (θr, φr)) (2.4)

From this, one can see that an isotropic BRDF has only three degrees of freedomfor direction (and possibly three for position).

One can see that adding light from one incident direction has no effect onthe amount reflected from other incident directions. The linearity of reflectionallows one to express the total amount of light reflected by a surface in a givendirection by the hemispherical integration over all possible incident directions.This is known as the reflectance equation:

Lr(ωr) =

Ωi

fr(ωi → ωr)Li(ωi) cosθ dωi (2.5)

2.1.1 Mirror Reflection

We now derive the BRDFs for two common reflection models, mirror reflectionand pure Lambertian diffuse reflection. For a perfect mirror, all of the incomingirradiance is reflected along the mirror direction:

θr = θi

φr = φi ± π

Lr(θr, φr) = Li(θi, φr ± π)

5

Page 6: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

One can express this with the following BRDF:

fr,mirror =δ(θr − θi)

cosθiδ(φr − (φi ± π)) (2.6)

The above function shows that, even for relatively simple reflection models,the BRDF can be infinite. Many times, it is easier to use a quantity rangingfrom 0 to 1, representing the percent of reflection. This leads to the notion ofreflectance. Reflectance is defined as the ratio of reflected flux to incident flux:

dΦrdΦi

=

Ωr

Lr(ωr) cosθr dωr

Ωi

Li(ωi) cosθi dωi

(2.7)

=

Ωr

Ωi

fr(ωi → ωr)Li(ωi) cosθi cosθr dωi dωr

Ωi

Li(ωi) cosθi dωi

(2.8)

While the reflectance now is bounded from 0 to 1, it also now depends on theincoming radiance distribution, Li. This restriction can be removed if Li isassumed to be constant (uniform and isotropic). It can then be removed fromthe integrals yielding a relationship between reflectance and the BRDF:

=

Ωr

Ωi

fr(ωi → ωr) cosθi dωi dωr

Ωi

cosθi dωi

(2.9)

2.1.2 Lambertian Diffuse Reflection

In the diffuse reflection model, light is assumed to be scattered equally in alldirections (independent of incident direction). This means that the BRDF isconstant, giving:

Lr,diffuse =

Ωi

fr,diffuse Li(ωi) cosθi dωi

6

Page 7: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

= fr,diffuse

Ωi

Li(ωi) cosθi dωi

= fr,diffuse E (2.10)

The above equation shows that the reflected radiance is constant (the same inall directions). This immediately leads to a simplified equation for the radiosity:

B = π Lr,diffuse (2.11)

Since the reflected radiance is constant, one can show that the reflectivity isalso constant:

ρdiffuse =

Ωr

Lr(ωr) cosθr dωr

Ωi

Li(ωi) cosθi dωi

=

Lr,diffuse

Ωr

cosθr dωr

E

=π Lr,diffuse

E

= π fr,diffuse (2.12)

And the reflectance is related to the radiosity by:

ρdiffuse =B

E(2.13)

2.2 The Rendering Equation

The last concept needed for the development of a comprehensive rendering equa-tion is the ability to compute the incident radiance distribution at a point, orthe illumination model. Local illumination models examine only the currentsurface and light sources, while global models consider the entire environmentto compute the incident radiance. We will begin with a look at local models,followed by a derivation of global models and conclude by incorporating theseinto the unifying rendering equation.

7

Page 8: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

2.2.1 Local Illumination

Local illumination models depend solely on the properties of the light sourcesand the surface to be shaded. For this reason, local models cannot be usedto determine many lighting features such as shadows, reflections, and colorbleeding. Since local models have no concept of the surrounding environment,it is assumed that all of the light reaches the surface. In order to derive thelocal model for point light sources, we restate the reflectance equation and theirradiance from a point light source:

Lr(ωr) =

Ωi

fr(ωi → ωr)Li(ωi) cosθ dωi (2.14)

E =Φ

cosθ

|x− xs|2

(2.15)

The radiance from the point light source can then be expressed as

Li(ωi) =Φ

1

|x− xs|2δ(θi − θs)δ(φi − φs) (2.16)

Where (θs, φs) defines the direction to the light source. Substituting this intothe reflectance equation yields

Lr(ωr) =Φ

cosθ

|x− xs|2fr(ωr, ωs) (2.17)

This is the model used by most 3D graphics hardware. These equations can beextended to handle light sources with arbitrary distributions, directional lights,and even area lights. However, local models cannot deal with global phenomenain the environment such as inter-reflection and shadowing. These issues are dealtwith through global illumination models.

2.2.2 Global Illumination

Since global illumination models deal directly with the interaction of differentsurfaces in the environment, one must first derive how the radiance reflectedfrom one surface affects the radiance at another surface. Since radiance is in-variant along a ray, the incident radiance at a point x′ caused by radiance fromanother point x is

Li(x′, ωi) = Lo(x, ωo) V (x, x

′) (2.18)

8

Page 9: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

Where ωi is the direction vector from x′ to x and ωo is the opposite direction

vector (from x to x′). V (x, x′) represents the visibility of the points x and x′.It has the value 1 if both x and x′ are mutally visible and 0 otherwise. There-fore, the incoming radiance from a point x′ along a ray is simply the outgoingradiance from the visible point x along that ray.

Looking back at the reflectance equation, we see that we have an equationinvolving the spherical integral around a point. However, we wish to understandhow each surface affects the radiance of the other surfaces. We must convert thisspherical integral to an integral over all surfaces. This can be done by relatingthe solid angle subtended by a surface to its surface area

dωi =cosθo dA

|x− x′|2

(2.19)

Forming the projected solid angle then yields

dωi cosθi dA =cosθi cosθo|x− x′|

2dA = G(x, x′) dA (2.20)

The term G(x, x′) is called the geometry term in that it only depends on thegeometry of the scene (not the distribution of light). G(x, x′) is defined as

G(x, x′) = G(x′, x) =cosθi cosθo|x− x′|

2(2.21)

Using the above equations, we can now write the reflectance equation as

L(x′, ω′) =

S

fr(−ω, x′, ω′) L(x, ω) G(x, x′) V (x, x′)dA (2.22)

This equation expresses the outgoing radiance from a point x′ in the directionω′ by the contributions from all other surface points x weighted by the BRDF,the geometry function and the visibility function. The equation can be repara-materized as follows

L(x′ → x′′) =

S

fr(x→ x′ → x′′) L(x→ x′) G(x, x′) V (x, x′)dA (2.23)

Here, the directions have been implicitly defined by source and destinationpoints. This equation has a fairly simple physical interpretation: The radi-ance sent from x′ to x′′ is simply the amount of radiance sent from all other

9

Page 10: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

visible points x in the scene to the point x′ and then reflected to the point x′′.

The only other source of radiance that must be added to this equation to derivethe complete rendering equation is the amount of radiance directly emitted fromx′ to x′′. Adding this term yields the rendering equation introduced by Kajiya[Kaj86]

L(x′ → x′′) = Le(x′ → x′′)

+

S

fr(x→ x′ → x′′)L(x→ x′)G(x, x′)V (x, x′)dA (2.24)

2.3 The Radiosity Equation

Under the assumption that all surfaces are Lambertian diffuse reflectors, therendering equation can be simplified greatly. This is the radiosity assumptionwhich leads to the following radiosity equation:

L(x′ → x′′) = Le(x′ → x′′) +

S

fr(x→ x′ → x′′)L(x→ x′) G(x, x′) V (x, x′) dA

L(x′ → x′′) = Le(x′ → x′′) + fr(x

′)

S

L(x→ x′) G(x, x′) V (x, x′) dA

L(x′ → x′′) = Le(x′ → x′′) +

ρ(x′)

π

S

L(x→ x′) G(x, x′) V (x, x′) dA

B(x′)

π=E(x′)

π+ρ(x′)

π

S

B(x)

πG(x, x′) V (x, x′) dA

B(x′) = E(x′) + ρ(x′)

S

B(x)G(x, x′) V (x, x′)

πdA (2.25)

Note that E(x) is now the energy per unit area emitted by the surface (not theirradiance).

3 Solving the Radiosity Equation

After deriving the radiosity equation, one can note several interesting featuresof the equation. First, the unknown, radiosity, appears on both the left side of

10

Page 11: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

the equation as well as under the integral on the right. This is an extremelydifficult equation to solve and rarely has a closed form solution. Additionally,the function space of the radiosity function is infinite (an infinite number ofvalues are required to completely specify the function). This can be seen bynoting that solving the radiosity equation for one point, does not tell us any-thing about the neighboring locations. Therefore, solving the radiosity equationrequires either solving the equation for the exact functional form, or computingthe radiosity at infinitely many points.

3.1 Finite Element Methods

Since both solving for an exact functional form as well as solving for infinitemany radiosity values seem unattractive, one must approximate the radiosityequation by a simpler formula before attempting to solve the equation. Finiteelement methods provide a method for performing this approximation. Finiteelement methods approximate a complicated function by a linear sum of a finitenumber, n, of simpler basis functions, Ni(x), each of which have finites support.The domain of the function is subdivided into a mesh of elements each contain-ing one or more nodes. The mesh and nodes organize the areas of support forthe basis functions.

In the case of radiosity, the domain that is divided is the set of all surfaces inthe environment. This leads to an approximation of the radiosity function

B(x) ≈ B(x) =n∑

i=1

BiNi(x) (3.1)

There are many different basis functions to choose from. The most commonlyused in radiosity is the constant basis function

Ni(x) =

0 if x is outside element i1 if x is inside element i

(3.2)

3.2 Error Metrics

Ideally, we would like the approximation, B(x) to aggree with the actual ra-diosity solution B(x) everywhere. In general, this is not possible since theapproximation, B(x), is restricted to the finite dimensional space defined by thelinear sum of the basis functions. Therefore, given a set of basis functions, thetask is to find the coefficients Bi that minimize some error metric defined forthe function.

11

Page 12: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

The true error is defined by the difference between the true and approximatesolutions

ε(x) = B(x) − B(x) (3.3)

This error metric is impractical to use since it requires the knowledge of thetrue solution. Instead, one can substitute the approximate solution B(x) intothe radiosity equation

B(x) = E(x) + ρ(x)

S

B(x′) G(x, x′) dA′ (3.4)

and define the residual to be the difference between the two sides

r(x) = B(x) −E(x)− ρ(x)

S

B(x′) G(x, x′) dA′ (3.5)

This is equivalent to applying the operatorK to the negation of the actual error,where K is defined by the radiosity transport

Kb(x) = b(x)− ρ(x)

S

b(x′) G(x, x′)dA′ (3.6)

Where KB(x) = E(x). We can note that the exact solution will make r(x) zeroeverywhere. Additionally, though B(x) is restricted to a finite function space,r(x) is not. Similar techniques to those used above allow us to project the resid-ual into a finite function space. The goal then becomes finding a solution thatminimizes the finite dimensional residual.

Similar to the approximation of the radiosity function, we wish to approximatethe magnitude of the residual by a linear sum of finite support functions. Thesefinite support functions are called weighting functions and the technique isknown as a weighted residual method. The weighted residual is then definedas

|r(x)| =n∑

i=1

| < r(x),Wi(x) > | (3.7)

The residual norm can be minimized by finding a solution that makes each ofthe n terms ( < r(x),Wi(x) > ) zero. The next sections discuss two choicesof weighting functions, point collocation and Galerkin method, and how theyaffect the radiosity solution.

12

Page 13: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

3.2.1 Point Collocation

The easiest weighting functions consist of point sampling delta functions

Wi(x) = δ(x− xi) (3.8)

This is equivalent to requiring the solution to be exact at a given set of pointsxi. However, r(x) can still be nonzero between these points. As the number ofpoints is increased, the residual is increasingly restricted. Generally, the points,xi, are selected to be the locations of the nodes in the radiosity solution. Thisis known as point collocation.

For n nodes, there are n constraints that must be met (n places where theresidual is driven to zero), and this results in a system of n simultaneous linearequations

B(xi)−E(xi)− ρ(xi)

S

B(x′) G(xi, x′) dA′ = 0 (3.9)

Substituting for B yields

n∑

j=1

BjNj(xi)−E(xi)− ρ(xi)

S

n∑

j=1

BjNj(x′) G(xi, x

′) dA′ = 0 (3.10)

Factoring out the unknowns Bj gives

n∑

j=1

Bj

Nj(xi)− ρ(xi)

S

Nj(x′) G(xi, x

′) dA′

−E(xi) = 0 (3.11)

Which can be expressed in matrix-vector from as

KB = E (3.12)

Where the element of the matrix K are given by

Kij = Nj(xi)− ρ(xi)

S

Nj(x′) G(xi, x

′) dA′ (3.13)

13

Page 14: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

Note that these coefficients are independent of the radiance distribution in thescene and depend solely on the geometry and materials in the scene. This meansthat these coefficients can be precalculated for the scene before any radiositycalculations begin.

3.2.2 Galerkin Method

The previous method of point collocation forces the radiosity solution to beexact at the nodes points only. Alternatively, the weighted residuals methodallows one to force the weighted integrals of the residual to be zero. This canbe expressed by

< Wi(x), r(x) >=

S

Wi(x)r(x)dA = 0 (3.14)

Substituting for r(x) gives

0 =

S

Wi(x)B(x)dA

S

Wi(x)E(x)dA −

S

Wi(x)ρ(x)

S

B(x′)G(x, x′)dA′dA (3.15)

TheGalerkin Method chooses the same weighting functions as basis functions(Wi(x) = Ni(x)). This gives

0 =

S

Ni(x)B(x)dA

S

Ni(x)E(x)dA −

S

Ni(x)ρ(x)

S

B(x′)G(x, x′)dA′dA (3.16)

Expanding B and solving for the unknowns Bj gives

n∑

j=1

Bj

S

Ni(x)Nj(x)dA−

S

Ni(x)ρ(x)

S

Nj(x′)G(x, x′)dA′dA

14

Page 15: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

S

E(x)Ni(x)dA = 0 (3.17)

Note that this can again be expressed as a system of linear equations in matrixform

KB = E (3.18)

Where the elements of K are now given by

Kij =

S

Ni(x)Nj(x)dA −

S

Ni(x)ρ(x)

S

Nj(x′)G(x, x′)dA′dA (3.19)

And the elements of E are

Ei =

S

E(x)Ni(x)dA (3.20)

3.3 Constant Radiosity Elements

While the derivations in the previous two sections are valid for any basis func-tions, several simplifications can be made if constant basis functions are chosen.

Using the Galerkin Method with constant basis functions yields several drasticsimplifications. The fact that the basis functions are non-overlapping and canonly take on values of 1 or 0 reduces the first term in equation equation (3.17)as follows

S

Ni(x)Nj(x)dA = δijAi (3.21)

By similar reasoning, the emmission term reduces to

S

E(x)Ni(x)dA = EiAi (3.22)

where Ei represents the average emission per area of element i.

15

Page 16: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

Additionally, since the basis functions have unit value within the element andare zero otherwise, the domain of integration can be limited to the areas of thecorresponding elements:

S

Ni(x)ρ(x)

S

Nj(x′)G(x, x′)dA′dA = ρi

Ai

Aj

G(x, x′)dAjdAi (3.23)

Substituting these simplifications back into equation (3.17) yields

n∑

j=1

Bj

δijAi − ρi

Ai

Aj

G(x, x′)dAjdAi

−EiAi = 0 (3.24)

Divding by Ai and moving terms gives

n∑

j=1

Bj

δij − ρi

1

Ai

Ai

Aj

G(x, x′)dAjdAi

= Ei (3.25)

or more succintly

n∑

j=1

Bj [δij − ρiFij ] = Ei (3.26)

where Fij is defined as

Fij =1

Ai

Ai

Aj

G(x, x′)dAjdAi (3.27)

Fij is called the form factor and represents the fraction of energy leaving ele-ment i that arrives directly at element j.

The classical discrete radiosity equation is found by rearranging terms to arriveat

Bi = Ei + ρi

n∑

j=1

BjFij (3.28)

16

Page 17: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

This equation is somewhat hard to interpret physically. We can convert thisequation to a more physically intuitive form by multiplying through by Ai

BiAi = EiAi + ρi

n∑

j=1

BjFijAi (3.29)

and noting the reciprocity between form factors

FijAi = FjiAj (3.30)

to derive

BiAi = EiAi + ρi

n∑

j=1

FjiBjAj (3.31)

The physical interpretation of this equation is that the total power leaving ele-ment i, BiAi, is equal to the power emmitted from the surface, EiAi, plus thepower reflected from the surface. The power reflected from the surface dependsupon the power leaving all other elements that arrives directly at element i,FjiBjAj and the reflectivity of the surface, ρi.

3.4 Matrix Solutions

The previous sections described how to approximate the radiosity equation bya system of linear equations of the form

KB = E (3.32)

where the matrix K can be separated into the difference of an almost diagonalmatrix, M , and the product of the matrices P and F

[M − PF ]B = E (3.33)

For constant radiosity elements, M is simply the identity matrix I. The matrixP is a diagonal matrix of the elements’ reflectivities, and the matrix F is thematrix of form-factors.

There are several interesting features to notice about the matrix K

• Size: Generally, the matrix will be square and n x n, where n is the numberof basis functions used to approximate the radiosity function.

17

Page 18: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

• Sparsity: In general, the matrix will be more full than sparse. The ijthelement of K will be zero only if the reflectivity of the surface is zero (thesurface is completely black) or if the elements are completely invisible toeach other (Fij then becomes zero). However, many times it is possibleto determine completely independent sets of elements (elements in a setdo not interact with elements outside of the set – such as two completelyseparate rooms) causing the matrix to become block diagonal. At thispoint, the matrix can be separated into two smaller matrices and eachsolved separately.

• Symmetry: The matrix K is not symmetric in general since kij 6= kji.However, one can make a transformation to the system to make the matrixK symmetric. Since FijAi = FjiAj , one can premultiply the ith row(equation) by Ai to enforce symmetry. This allows one to use solutiontechniques that rely on the matrix K being symmetric.

• Diagonal Dominance: A matrix is diagonally dominant if the absolutevalue of the diagonal element is greater than or equal to the sum of theabsolute values of the off-diagonal elements. More formally

n∑

j=1,j 6=i

|Kij | ≤ |Kii| ,∀i (3.34)

This can be shown to be true for constant radiosity elements, since Kiiis one and the sum of form factors is by definition equal to one and thereflectivities must be less than or equal to one (in a physically correctsystem).Diagonal dominance is useful in that it ensures convergence for manyiterative methods (such as Gauss-Seidel in the following section).

• Spectral Radius: The spectral radius is a specific matrix norm that mea-sures the size of the largest eigenvalue. This indicates the speed at whichiterative methods will converge. Lower values for the spectral radius in-dicate faster convergence. For the radiosity problem, one can see thatif the reflectivities of the objects are increased, then more iterations arerequired to converge. This is because more and more light reflects aroundthe scene. The mathematical result is that the spectral radius approaches1.

• Condition: The condition number of a matrix indicates how sensitive thesolution is to small perturbations. For the radiosity problem, the matrixis usually well conditioned.

The following sections will examine iterative techniques to solve the radiositymatrix equation.

18

Page 19: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

3.4.1 Gauss-Seidel

In iterative methods, an initial approximation of the solution is made, and thencontinually updated using the matrix equation until the approximation con-verges to within a tolerence of the true solution.

The simplest iterative scheme, Jacobi Iteration, updates the one entry in thesolution approximation by assuming all of the other entries are correct. Thematrix equation is solved for the entry to be updated and the current estimatesare used to update it. For the radiosity solution, one step, or element update,consists of the following equation

B(k+1)i = Ei −

j 6=i

KijB(k)j

Kii(3.35)

Note that the superscripts indicate the iteration number.

A slightly more complex method, the Gauss-Seidel Iteration, uses the mostrecently computed solution vector at each step, rather than using the solutionvector calculated at the previous iteration. This yields the following formula foreach step of the radiosity solution

B(k+1)i = Ei −

i−1∑

j=1

KijB(k+1)j

Kii−

n∑

j=i+1

KijB(k)j

Kii(3.36)

One update step of the Gauss-Seidel algorithm involves updating a single radios-ity value, Bi, by summing the contributions from all other radiosity elements,Bj , weighted by the appropriate reflectivities and form factors (in row i). Thisis physically equivalent to gathering the light from all other elements to computethe updated estimate Bi.

3.4.2 Progressive Refinement

The Gauss-Seidel algorithm updates a single radiosity value, Bi, by consideringall of the contributions on row i. An alternative approach is to update all el-ements due to a single radiosity element’s contributions along a column. Thisis equivalent to shooting out the energy from a patch Bi to all other patchesweighted by the reflectivity and form factors given in column i.

Cohen et al. describe a variation on this type of algorithm known as progressiverefinement. At each step, the patch containing the largest amount of unshotradiosity is chosen to “shoot” its radiosity to all other elements (weighted by

19

Page 20: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

the appropriated column coefficients). By choosing the element with the largestunshot radiosity, the algorithm is able to use the element that will cause thegreatest change in scene as a whole. This allows the approximation to approachthe true solution after only a few steps.

Pseudocode for the progressive refinement algorithm is given below.

Progressive Refinement

forall iBi = Ei;∆Bi = Ei;

while not convergedfind i such that ∆BiAi is largest;forall elements j

∆rad = ∆Bi ρjFji;∆Bj = ∆Bj +∆rad;Bj = Bj +∆rad;

∆Bi = 0;Display the image using the current values of Bi;

The following figure shows the a comparison of the two techniques.(Figure 5.7)

4 Hierarchical Radiosity

One can see from the following sections that the cost of solving the discreteradiosity equation depends heavily on the number of elements since the interac-tion between each pair of elements must be computed. This is expensive sincefor each interacting pair, a costly form factor computation must be performed.One way to reduce this computational load is to reduce the number of elements.An alternative to this approach is to reduce the number of relationships (formfactors) computed. For instance, two groups of elements separated by a largedistance may approximate the interaction between all pairs of individual ele-ments by a single value computed once for the two groups. This requires ahierachy of elements as well as a hierarchy of interaction and is the topic ofhierarchical radiosity.

Consider the following physical example. Image a room with a table supportingseveral small objects. Light reflected from the table top affects the illuminationof a wall in the room. However, the illumination of the wall will not vary sig-nificantly if the objects on the rearranged. Noting this, the contribution of thetable top to the wall can be represented by a single average value, as oppossed

20

Page 21: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

to computing individual contributions from many small table top elements.

However, when the table top is rendered in the final image, the variation in illu-mination must capture all the small lighting details upon its surface (shadows,etc.). These details will be lost if the illumination arriving at the table is averageover the entire surface by treating the table top as a single receiving element.This shows that the radiosity should be represented by at least two levels ofsubdivision, coarsely for when the surface acts as an illumination source, andfinely when it acts as a receiver. This observation inspired the two-level hierar-chical radiosity algortihm.

4.1 Two-Level Hierarchical Radiosity

The two-level method for radiosity (Cohen et al.) divides surfaces based on theobservation of the previous section. Two levels of the hierarchy are created:coarsely subdivided patches to represent when the surfaces act as are sources ofillumination, and a finer subdivision of the patches into elements for when thesurfaces act as receivers. Elements can be adaptively subdivided, but patchesare specified a priori by the user.

The steps of the algorithm are as follows:

1. Divide the surfaces into m patches and n smaller elements (m << n).

2. Calculate the m x n element-to-patch form factors.

3. Calculate the m x m patch-to-patch form factors by area averaging theelement to patch form factors. For patch i to patch j, the form factor is:

Fij =∑

q∈i

FqjAqAi

(4.1)

4. Solve the m x m system for the patch radiosities:

Bi = Ei + ρi

m∑

j=1

BjFij (4.2)

5. Back solve for element radiosities, by expressing the element radiosity asthe sum of contributions from each patch:

Bq = Eq + ρq

m∑

j=1

BjFqj (4.3)

21

Page 22: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

6. If the radiosity of neighboring elements is widely varying, the elementscan be adaptively subdivided. New element-to-patch form factors arecomputed only for the new elements. The element radiosity can then becalculated from the original patch radiosities. This step can be performedrepeatedly until a satisfactory solution is found.

While the two-level hierarchy reduces the number of form factor computations,it does impose certain restrictions. First, The groupings of elements into patchesis static. That is, the elements in the group are assumed to act similarly for allinteractions in the scene (with other patches near to the group as well as faraway). Secondly, the patches cannot be grouped together, only elements. Thisresults from the distinction made between sources and receivers. Finally, theuser is required to specify the patch level subdivision. These limitations will beaddressed in the multi-level hierarchy of the next section.

4.2 Multi-Level Hierarchical Radiosity

In order to remedy the aforementioned problems, Hanrahan et al. generalizedthe two-level hierarchy to multiple levels. This allow receivers as well as sourcesto be computed at the appropriate levels of detail. The multilevel hierarchystructure resmebles that of a quadtree, with each parent node subdividing intofour child nodes.

Within this hierachy, nodes at any level may be linked. This linking structurerepresents the shooting interaction from all leaf nodes under the source node toall leaf nodes under the destination node. Therefore, energy can be shot fromany node in the hierarchy to any other node in the hierarchy. Since these non-leaf nodes represent groups of leaf nodes, the energy received by a non-leaf nodemust later be inherited by the leaves. These groupings, as well as the ability toshoot from/to any node in the hierarchy, will reduce the total number of formfactors that need to be calculated. In fact, it can be shown that only O(n) formfactors need be computed for a given error.

Unlike previous algorithms, multi-level hierarchical radiosity does not explicitlybuild a matrix. Instead, the surfaces are subdivided and the links are built asneeded. The links represent the interaction of one set of elements to anotherset. Therefore, the links hold the form factors while the quadtree nodes holdthe radiosity and emission values.

The basic structure of the hierarchical algorithm is given below.

BasicHierachicalRad(float Fǫ)forall(surfaces p) p → Bs = p → E;

22

Page 23: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

forall(surface pairs (p,q))RefinePatch(p,q,Fǫ);

while(not converged)forall(surfaces p) Gather(p);forall(surfaces p) PushPull(p);

The hierarchical algorithm begins by calling RefinePatch to subdivide the sur-faces and create the appropriate links. The pseudocode for RefinePatch is givenbelow.

RefinePatch(Quadnode *p, Quadnode *q, float Fǫ)Quadnode *r;if(Oracle1(p,q,Fǫ))

Link(p,q);else

if(Subdiv(q))foreach(child r of q) RefinePatch(p,r,Fǫ);else if(Subdiv(p))foreach(child r of p) RefinePatch(r,q,Fǫ);elseLink(p,q);

Oracle1(Quadnode *p, Quadnode *q, float Fǫ)Quadnode *r;if(p → Area < Aǫ AND q → Area < Aǫ))

return TRUE;if(estimateFormFactor(p,q) < Fǫ)

return TRUE;return FALSE;

RefinePatch begins by asking an oracle function whether or not the two patchesshould be linked. If so, it simply calls Link(p,q) which actually builds a linkdata structure and computing the appropriate forrm factor. Otherwise, theRefinePatch function tries to subdivide the receiving patch, q, with the Sub-div procedure. Subdiv will return whether or not hte patch can be subdivided(usually based on minimum area or maximum quadtree depth criteria) and sub-divides if necessary. Therefore, if q can be subdivided, RefinePatch does so, andcalls itself recursively on the newly created child patches. If q cannot be sub-divided, this process is attempted on patch p. If this fails, the algorithm mustcreate a link between patches p and q.

Now that the environment has been properly subdivided and the appropriatelinks created, the radisoity system can be solved. This consists of calling two

23

Page 24: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

functions, Gather and PushPull, until the system converges. The pseudocodefor these functions is given below.

Gather(QuadNode * p)QuadNode *q;Link *L;

p→ Bg = 0;foreach( gathering link L of p)

p→ Bg += p→ ρ * L→ Fpq * L→ q → Bs;

foreach(child r of p)Gather(r);

PushPull(QuadNode *p, float Bdown = 0.0)float Bup, Btemp;

if(p is a leaf)Bup = p → E + p → Bg +Bdown ;

elseBup = 0;foreach(child r of p)Btemp = PushPull(r, p→ Bg +Bdown);Bup += Btemp *

r→Areap→Area

p → Bs = Bup;return Bup;

The Gather function gathers the energy over all incoming links. The shootingradiosity at one end of the link (Bs) is converted to gathered radiosity (Bg) atthe other end.

The PushPull function tells the other nodes in the tree about energy gatheredat other nodes node the previous gather step. It does so by first pushing all ofthe received energy down the tree to the children (so children know all the en-ergy that was received above them), and then pulling the resulting energy backup the quadtree via area averaging (so parents know about the energy of allnodes below them). One can see that on the way down, the gathered radiosityis accumulated (in Bdown). Once a leaf is reached, it adds its own emmissionand gathered radiosity and returns it up the tree. On the way back up the tree,these child radiosities are area averaged to compute the value for the parentnodes. Finally, these computed radiosity values are stored in Bs to prepare forthe next gathering step.

24

Page 25: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

4.2.1 Progressively Refining the Hierarchy

The hierarchical radiosity algorithm described above makes decisions about sub-division and link creation based solely on the geometry of the system. This sys-tem does not take into account how much energy will eventually travel accrossthese links. We could do better if we also refine these links (and subdivisions)after we have some idea of the energy transfer between the elements. The pseu-docode for a progressively refined hierachical solution is given below.

HierarchicalRad(float BFǫ)Quadnode *p, *q;Link *L;forall(surfaces p) p→ Bs = p→E;forall(surface pairs (p,q)) RefinePatch(p,q,BFǫ);while(not converged)

forall(surfaces p) Gather(p);forall(surfaces p) PushPull(p);forall(links L)RefineLink(L,BFǫ);

The only addition to the previous algorithm, is that now we adaptively refine thelinks (and therefore the subdivision) as the solution progresses. The pseudocodefor refining the links is as follows:

RefineLink(Link *L, float BFǫ)int subdivision = FALSE;Quadnode *p = L→p;Quadnode *q = L→q;

if(Oracle2(L, BFǫ))subdivision = TRUE;unlink(L);if(Subdiv(q))foreach(child r of q) Link(p,r);elseforeach(child r of p) Link(r,q);

return subdivision;

When refining a link, one simply asks an oracle if the link needs to be refined(Oracle2). If so, the algorithm attempts to subdivide node q and link with thenewly created children. If node q cannot be subdivided, node p is tried. Finally,if neither node q or p can be subdivided, or if the oracle decideds not to refine

25

Page 26: Radiosity Overview 1 Radiometry - polytechniquepeyre/cours/x2004tms/radiosity_tutorial.pdfRadiosity Overview In order to create realistic images, one must understand the properties

the link, the function simply exits.

The Oracle2 function plays an important role in that it decides when to refine agiven link. Refining too often will result in excess computation while refining toolittle will result in inaccurate radiosity function approximations. A commonlyused oracle is given below. This oracle simply checks if the two nodes, p andq, are already too small for further refinement, whether there is no radiosity tobe shot, or whether the total energy sent across the link is extremely small. Ifany of these cases hoold, the link does not need refining, otherwise, the oracleclaims that it does.

Oracle2(Link *L, float BFǫ)QuadNode *p = L→p;QuadNode *q = L→q;

if(p→ Area < Aǫ AND q→ Area < Aǫ)return FALSE;

if(p→ Bs == 0.0)return FALSE;

if(p→ Bs * p→Area * L→L→ Fpq < BFǫ)return FALSE;

return TRUE;

The above progressive refinement hierarchical radiosity algorithm allows thesynthesis of images of complex scenes with a greatly reduced computation cost.However, much research is still needed in the field of radiosity and image syn-thesis in general.

References

[Kaj86] Jim Kajiya. The Randering Equation. In SIGGRAPH 86 ConferenceProceedings, pages 143–151, July 1986.

26