1 GR2-00 GR2 Advanced Computer Graphics AGR Lecture 15 Radiosity
Mar 28, 2015
1GR2-00
GR2Advanced Computer
GraphicsAGR
GR2Advanced Computer
GraphicsAGR
Lecture 15Radiosity
2GR2-00
ReviewReview
First a review of the two rendering approaches we have studied:– Phong reflection model– ray tracing
3GR2-00
Phong Reflection ModelPhong Reflection Model
This is the most common approach to rendering– objects represented as polygonal faces– intensity of faces calculated by Phong
locallocal illumination model
– polygons projected to viewplane– Gouraud shading applied with Z buffer
to determine visibility
I() = Ka()Ia() + ( Kd()( L . N ) + Ks( R . V )n ) I*() / dist
4GR2-00
Phong Reflection ModelPhong Reflection Model
Strengths– simple and efficient– models ambient, diffuse and specular
reflection Limitations
– only considers light incident from a light source, and not inter-object reflections - ie it is a local illumination method (ambient term is approximation to global illumination
– empirical rather than theoretical base– objects typically have plastic appearance
5GR2-00
Ray TracingRay Tracing
Ray traced from viewpoint through pixel until first object intersected
Colour calculated as summation of:– local Phong reflection at that point– specularly reflected light from
direction of reflection– transmitted light from refraction
direction if transparent
6GR2-00
Ray TracingRay Tracing
This is done recursively Colour of light incoming along
reflection direction found by:– tracing ray back until it hits an
object– colour of light emitted by object is
itself summation of local component, reflected component and transmitted component
– and so on
7GR2-00
Ray Tracing - Strengths and Weaknesses
Ray Tracing - Strengths and Weaknesses
Advantages– increased realism through ability to
handle inter-object reflection Disadvantages
– much more expensive than local reflection
– still empirical– only handles specular inter-object
reflection– entire calculation is view-dependent
8GR2-00
RadiosityRadiosity
Based on the physics of heat transfer between surfaces
Developed in 1980s at Cornell University in US (Cohen, Greenberg)
Determine energy balance of light transfer between all surfaces in an enclosed space– equilibrium reached between emission of
light and partial absorption of light Assume surfaces are opaque, are perfect
diffusediffuse reflectors and are represented as sets of rectangular patches Ai
9GR2-00
Radiosity ExamplesRadiosity Examples
10GR2-00
Radiosity - DefinitionRadiosity - Definition
Radiosity defined as:– energy (Bi ) per unit area leaving a
surface patch (Ai ) per unit time
Bi Ai = Ei Ai + Ri ( Fj-i Bj Aj) i=1,2,..Nj
Ei is the light energy emitted by Ai per unit areaRi is the fraction of incident light reflected in all directionsFj-i is the fraction of energy leaving Aj that reaches Ai
lightemitted
lightreflected
lightleaving
11GR2-00
Radiosity - Pictorial Definition
Radiosity - Pictorial Definition
Ai
Aj
r
Ni
Nj
i
j
Bi Ai = Ei Ai + Ri (Fj-i Bj Aj)
Form factor Fj-i is fraction ofenergy leaving Aj that reachesAi. It is determined by therelative orientation of thepatches and distance rbetween them
Form factors arehard to calculate!Let’s assume for nowwe can do it.
j
12GR2-00
Simplifying the EquationSimplifying the Equation
Bi Ai = Ei Ai + Ri (Fj-i Bj Aj)ieBi Ai = Ei Ai + Ri (Bj Fj-i Aj)
There is a reciprocity relationship:Fj-i Aj = Fi-jAi
Bi Ai = Ei Ai + Ri (Bj Fi-j Ai)
Hence:
Bi = Ei + Ri ( Bj Fi-j )
So the radiosity of patch Ai is given by:
j
j
j
j
13GR2-00
Creating a System of Equations
Creating a System of Equations
We get one equation for each patch– assume we can calculate form factors
– then N equations for N unknowns B1,B2,..BN
First equation is:
(1-R1F1-1)B1 - (R1F1-2)B2 - (R1F1-3)B3 - .. - (R1F1-N)BN = E1
..and we get in all N equations like this. Generally Fi-i will be zero - why? Most of the Ei will be zero - why?
B1 = E1 + R1 ( Bj F1-j )j
14GR2-00
Solving the EquationsSolving the Equations
Equations are solved iteratively - ie a first guess chosen, then repeatedly refined until deemed to converge
Suppose we guess solution as:B1
(0), B2(0), .. BN
(0)
Rewrite first equation as:B1 = E1 + (R1F1-2)B2 + .. + (R1F1-N)BN
Then we can ‘improve’ estimate of B1 by:B1
(1) = E1 + (R1F1-2)B2(0) + .. + (R1F1-N)BN
(0)
.. and so on for other Bi
15GR2-00
Solving the EquationsSolving the Equations
This gives an improved estimate:B1
(1), B2(1), .. BN
(1)
and we can continue until the iteration converges.
This is known as the JacobiJacobi iterative method
An improved method is Gauss-SeidelGauss-Seidel iteration– this always uses best available values
– eg B1(1) (rather than B1
(0) ) used to calculate B2
(1), etc
16GR2-00
RenderingRendering
What have we calculated? The Bi are the intensities of light
emanating from each patch– the form factors do not depend on
wavelength , but the Ri do
– thus Bi depend on , so we need to calculate Bi
RED, BiGREEN, Bi
BLUE
We get vertex intensities by averaging the intensities of surrounding faces
Then we can pass to Gouraud renderer code for interpolated shading
17GR2-00
Pause at this stagePause at this stage
Number of equations can be very large
Calculation is not view dependent
Only diffuse reflection We still have not seen how to
calculate the form factors! Their calculation dominates
18GR2-00
Form FactorsForm Factors
The calculation of the form factors is unfortunately quite hard
We begin by looking at the form factor between two infinitesimal areas on the patches
19GR2-00
Form Factors - NotationForm Factors - Notation
Ai
Ni
dAi
Nj
Aj
dAj
i
j
Form factor Fdi-dj gives the fractionof energy reaching dAj from dAi.
r
r is distance between elementsNi, Nj are the normalsi, j are angles made with normalsby line joining elements
20GR2-00
Form Factor Calculation : 2D Cross Section View
Form Factor Calculation : 2D Cross Section View
Draw in 2D but imagine this in 3D:* create unit hemisphere with dAi at centre* light emits/reflects equally in alldirections from dAi * form factor Fdi-dj is fraction of energyreaching dAj from dAi
dAi
Aj
dAj
Ai
21GR2-00
Form Factor Calculation : 2D Cross Section View
Form Factor Calculation : 2D Cross Section View
We begin calculation by* projecting dAj onto the surfaceof the hemisphere (blue)* this resulting area is (cos j / r2 ) dAj
This gives us the relative area of light energy reaching dAj from dAi
dAi
Aj
dAj
j
r
Nj
22GR2-00
Form Factor Calculation : 2D Cross Section View
Form Factor Calculation : 2D Cross Section View
But we need a measure perunit area of Ai so need to adjustfor orientation of Ai
This gives a ‘corrected’ area as:( cos i cos j / r2 ) dAj
dAi
Aj
dAj
i
23GR2-00
Form Factor Calculation : 2D Cross Section View
Form Factor Calculation : 2D Cross Section View
dAi
Total energy comes from integratingover whole hemisphere - this comes to this comes to
Hence form factor is given by:Fdi-dj = ( cos i cos j ) / ( r2 )dAj
24GR2-00
Form Factor Calculation : 2D Cross Section View
Form Factor Calculation : 2D Cross Section View
Finally we need to sum up for ALL dAj. This means integrating over the whole of the patch:Fdi-j = (cos i cos j ) /( r2 ) dAj
dAi
Aj
Ai
25GR2-00
Form Factor CalculationForm Factor Calculation
dAi
Aj
Ai
Strictly speaking, we should nowintegrate over all dAi. In practice,we take Fdi-j as representative ofFi-j and this assumption:
Fi-j = Fdi-j
works OK in practice.
However the calculation of the integral (cos i cos j ) /( r2 ) dAj
is extremely difficult. Next lecture will discuss an approximation.