**Unformatted text preview: **Interactive Computer Graphics:
Lecture 14
"
Computational Issues in Radiosity
! The story so far . . . The story so far …" Every polygon in a graphics scene radiates light. • Every polygon in a is called scene radiates light. !
The light energy it radiatesgraphics the radiosity, denoted by letter
B • The light energy it radiates is called the radiosity,
denoted by letter B Graphics Lecture 14: Slide 3!
3 / 35 Lambertian Surfaces "
Lambertian Surfaces
• A Lambertian surface is one that obeys Lambert’s
A Lambertian surface is one that obeys Lambert’s Cosine law.
Cosine law.!
• It is aaperfectly matt surface and the reﬂected energy is the same is
It is perfectly matt surface and the reﬂected energy
in all same in all directions. !
the directions. • We can only calculate Radiosity for Lambertian Surfaces Surfaces !
We can only calculate Radiosity for Lambertian
! Graphics Lecture 14: Slide 4! 4 / 35 The Radiosity Equation "
The Radiosity Equation
The Radiosity Equation
• For patch i:! For patch i: patch i:
For XX
Bi = EBi+ Rii + RBj FBj Fij
i =E
ij
i
j j !
! Ei !
!Light emitted by the patch (usually zero)
Light emitted by the patch (usually zero) !
Ei
Light emitted by the patch (usually zero)
! Ri P !Bj Fij !Reﬂected light energy that arrived from all all !
Reﬂected light energy that arrived from other
j
P
!
!
!patches
other patches
Ri j Bj Fij Reﬂected light energy! that arrived from all other
!F
!
Proportion of energy leaving patch j t reaches
patches !Proportion of energy leaving patch j thathat !
ij
!
!
!patch i patch i
reaches Fij
! Proportion of energy leaving patch j that reaches
patch i Graphics Lecture 14: Slide 5!
5 / 35 Form factors
Form factors"
Fij = (a) Big form factor perhaps 0.5
Graphics Lecture 14: Slide 6! cos i cos
⇡ r2 j |Aj | (b)
Further
smaller form
perhaps 0.25 away,
factor, (c) Not really facing
each other, even smaller
form factor perhaps 0.1
6 / 35 Computing the Form Factors"
• Direct Computation: !
– 60,000 polygons (or patches) !
– 3,600,000,000 form factors ! • Computation takes forever! Most of the results will be
zero. !
• Hemicube method: !
– Pre-compute the form factors on a hemicube!
– For each patch ray trace (or project) through the hemicube ! Graphics Lecture 14: Slide 7! The whole solution The whole solution "
• All that remains to be done is to solve the matrix
equation:
All that remains!to be done is to solve the matrix equation:
0
B
B
B
B
@ 1
R2 F21
R3 F31
.
Rn Fn1 R1 F12
1
R3 F32
.
Rn Fn2 R1 F13
R2 F23
1
.
Rn Fn3 .
.
.
.
. .
.
.
.
. 1 0B 1 0E 1
1
1
R 1 F1 n
BCBC
R2 F2n C B B2 C B E2 C
CB . C B . C
R 3 F3 n C B . C = B . C
CB . C B . C
[email protected] A @ A
.
1
Bn
En Graphics Lecture 14: Slide 8!
8 / 35 Summary of Radiosity method "
1. Divide the graphics world into discrete patches
!"
2. Compute form factors by the hemicube method
""
3. Solve the matrix equation for the radiosity of each patch.
!!
4. Average the radiosity values at the corners of each patch
!!
5. Compute a texture map of each point or render directly!
"
"
"
"! Graphics Lecture 14: Slide 9! !
! Summary of Radiosity method "
1. Divide the graphics world into discrete patches
Meshing strategies, meshing errors "
2. Compute form factors by the hemicube method
Alias errors "
3. Solve the matrix equation for the radiosity of each patch.
Computational strategies "
4. Average the radiosity values at the corners of each patch
Interpolation approximations "
5. Compute a texture map of each point or render directly
At least this stage is relatively easy "
"
Now read on ... "
Graphics Lecture 14: Slide 10! Alias Errors "
Alias Errors Computation of the form factors will involve alias errors. • Computation of the form factors will involve alias errors. !
Equivalent to errors in texture mapping, due to discrete sampling
• Equivalent toenvironment. texture mapping, due to discrete
of a continuous errors in
sampling of a continuous environment. !
However, as the alias errors are averaged over a large number of
• However, as thenot be signiﬁcant. averaged over a large
pixels the errors will alias errors are
number of pixels the errors will not be signiﬁcant. !
! Graphics Lecture 14: Slide 11! 10 / 35 Form Factor reciprocity Form Factor reciprocity "
Form factors have a reciprocal relationship:
• Form factors have a reciprocal relationship: !
Fij = cos i cos
⇡ r2 ) j |Aj | Fji = Fji = cos i cos
⇡ r2 j |Ai | Fij |Ai |
|Aj | So factors for only half the patches need be computed.
So•form form factors for only half the patches need be
computed. !
!
Graphics Lecture 14: Slide 12! 11 / 35 The number of form factors"
There will be a large number of form factors:
!
For 60,000 patches, there are 3,600,000,000 form factors. !
!
We only need store half of these (reciprocity), but we will
need four bytes for each, hence 7 GB are needed. !
!
As many of them are zero we can save space by using an
indexing scheme (e.g. use one bit per form factor, bit = 0
implies form factor zero and not stored) ! Graphics Lecture 14: Slide 13! Inverting the matrix
Inverting the matrix Inverting the matrix can be "
Inverting the matrix done by the Gauss Seidel method: Inverting the matrix can be done by the Gauss Seidel method: • Inverting the matrix can be done by the Gauss Seidel 1
0
1 0B 1 0E
method: ! R1 F12
1
1
1
R1 F13 . .
R 1 F1 n 0
B
B
B
B
B
B
@
B
B
@ R2 F21
1
R3 21
R2 FF31
.
R3 F31
Rn Fn1
.
Rn Fn1 1
R1 F12
R3 F32
1
.
R3 F32
Rn Fn2
.
Rn Fn2 RRFF23
1 2 13
1
R2 F23
1.
Rn Fn3
.
Rn Fn3 ..
..
..
..
. ..
..
..
..
. BCBC
1 0 BB1 0 EE1
RFFn n C B 1 2 C B 1 2 C
21 2 C
R1
B
C B . C BE . C
RFFn C B B2.C = B 2.C
C
C
nC B
R2 3 2 3C B .C B .C
B. C B . C
CBC
B
[email protected] A @ A
.
R 3 F3 n C B . C = B . C
CB . C B . C
. 1 A @ BA @ EA
n
n
1
Bn
En Each row of the matrix gives an equation of the form:
• Each row of the matrix gives an equation of the form: !
Each row of the matrix gives an equation of the form:
X
Bi = Ei + Ri
BF
X j ij
Bi = Ei + Ri j Bj Fij
j Graphics Lecture 14: Slide 14! 13 / 35 13 / 35 Inverting the matrix
Inverting the matrix
Inverting the the matrix "
the matrix
Inverting matrix
Inverting The Gauss Seidel method is iterative and uses the equation of of each
The Gauss Seidel method is iterative and uses the equation each
row
The Gauss Seidel method is iterative and uses theuses the of each
row
• The Gauss Seidel method is iterative and equation
The Gauss Seidel method is iterative and uses the equation of each
row
e Given:
row quation of each row !
X
Given:
Bi B Ei E Ri R XjBijF
==++
BF
• Given: !
Given:
X
i
i
i
j ij
Given:
j
XB F j
Bi = Ei + Ri
j ij
Bi = Ei + Ri
Bj Fij
j
j WeWe use the iteration:
use the iteration:
• We use the iteration: !
X
We use the iteration:
k
We use the iteration:
Bi = Ei + Ri Xj 1 Fij
Bk k 1
k
Bi = Ei + Ri
Bj Fij
X
k1
k
Bi = Ei + Ri X Bj j 1 Fij
j
k
k
Bi = Ei + Ri
Bj Fij
j
j
0
1
To give successive estimates Bi , Bi , .1. .
0, B , . . .
To give successive estimates
• To give successive estimates ! Bi i
0
1
ToCan set initial values! Bi , Bi , . . .
give successive estimates 0 0 1
• Can set initial values Bi = 0
To give successive estimates Bi 0 Bi , . . .
Can set initial values Bi, = 0
0
Can set initial Slide 15! Bi = 0
Graphics Lecture 14: values
0
Can set initial values Bi = 0 14 / 3
1 Gauss-Seidel method for solving equations
Gauss-Seidel method for solving equations Given a scene with three patches,for can write the iterations as
Gauss-Seidelthree patches, we can write the iterations as
Given a scene with method we solving equations
update equations:
update equations: " • Given a scene with three patches, we can write the
iterations as update equations: !
B0
B0
B1
B1
B2
B2 E0 + R0 ( F01 B1 + F02 B2 )
E0 + R0 ( F01 B1 + F02 B2 )
E1 + R1 ( F10 B0 + F12 B2 )
E1 + R1 ( F10 B0 + F12 B2 )
E2 + R2 ( F20 B0 + F21 B1 )
E2 + R2 ( F20 B0 + F21 B1 ) Assume we know numeric the values for E0 , E1for 2 , 0RE, , E2,R20,, R1,
• Assume we know numeric the values , E E R , R , R
Assume we know numeric the values for E0 , E1 , E2 , , 0 1 R1 , R2 ,
0
1
F01 , F02 , F10 , F12 , F20 FF21F20, F21: !
, 12, :
F01 , R2, FF10FF12FF20 , F21 :
F02 , 01, , 02, , 10,
B0
B0
B1
B1
B2
B2 0 + 0.5( 0.2 B1 + 0.1 B2 )
0 + 0.5( 0.2 B1 + 0.1 B2 )
5 + 0.5( 0.2 B0 + 0.3 B2 )
5 + 0.5( 0.2 B0 + 0.3 B2 )
0 + 0.2( 0.1 B0 + 0.3 B1 )
0 + 0.2( 0.1 B0 + 0.3 B1 ) Graphics Lecture 14: Slide 16!
15 / 35
15 / 35 Gauss-Seidel method for solving
Gauss-Seidel method for solving equationsequations "
Simplify: !
Simplify: !
!
!
!
!
!
!
! B0 0.1 B1 + 0.05 B2 B1 5 + 0.1 B0 + 0.15 B2 B2 0.02 B0 + 0.06 B1 Step
0
1
2
3
.
.
. B0
0
0
0.5
0.515
.
.
. B1
0
5
5
5.095
.
.
. B2
0
0
0.3
0.31
.
.
. !
!
The process eventually converges to 0.53, 5.07 and 0.31 in this case ! The process eventually converges to 0.53, 5.07 and 0.31 in this
!
case Gauss-Seidel method for solving equations "
• The Gauss-Seidel method is stable and converges !
• It can be shown that the radiosity matrix is ‘diagonally dominant’ (a
sufﬁcient condition to guarantee convergence). !
• At the ﬁrst iteration the emitted light energy is distributed to those
patches that are illuminated !
• In the next cycle, those patches illuminate others and so on. !
• The image will start dark and progressively illuminate as the iteration
proceeds ! Graphics Lecture 14: Slide 18! Gauss-Seidel method for solving equations "
• The Gauss-Seidel method is stable and converges !
• It can be shown that the radiosity matrix is ‘diagonally dominant’ (a
sufﬁcient condition to guarantee convergence). !
• At the ﬁrst iteration the emitted light energy is distributed to those
patches that are illuminated !
• In the next cycle, those patches illuminate others and so on. !
• The image will start dark and progressively illuminate as the iteration
proceeds ! Graphics Lecture 14: Slide 19! Gauss-Seidel method for solving equations "
• The Gauss-Seidel method is stable and converges !
• It can be shown that the radiosity matrix is ‘diagonally dominant’ (a
sufﬁcient condition to guarantee convergence). !
• At the ﬁrst iteration the emitted light energy is distributed to those
patches that are illuminated !
• In the next cycle, those patches illuminate others and so on. !
• The image will start dark and progressively illuminate as the iteration
proceeds ! Graphics Lecture 14: Slide 20! Gauss-Seidel method for solving equations "
• The Gauss-Seidel method is stable and converges !
• It can be shown that the radiosity matrix is ‘diagonally dominant’ (a
sufﬁcient condition to guarantee convergence). !
• At the ﬁrst iteration the emitted light energy is distributed to those
patches that are illuminated !
• In the next cycle, those patches illuminate others and so on. !
• The image will start dark and progressively illuminate as the iteration
proceeds ! Graphics Lecture 14: Slide 21! Progressive Reﬁnement "
• The nature of the Gauss Seidel method allows a partial solution to
be rendered as the computation proceeds. !
• Without altering the method we could render the image after each
iteration, allowing the designer to stop the process and make
corrections quickly. !
• This may be particularly important if the scene is so large that we
need to re-calculate the form factors every time we need them. ! Graphics Lecture 14: Slide 22! Inverting the matrix "
• The Gauss Seidel inversion can be modiﬁed to make it
faster by making use of the fact that it is essentially
distributing energy around the scene. !
• The method is based on the idea of “shooting and
gathering”, and also provides visual enhancement of the
partial solution. ! Graphics Lecture 14: Slide 23! Gathering Patches
Evaluation of one Bi value using one line of the matrix: Gathering Patches
Gathering Patches " Evaluation of one Bi value using one line of the matrix:
X
k1
k
Bi B v + R
B one ij
• Evaluation of one = iEialue iusing j Fline of the matrix: !
j
X
k
k
Bi = Ei + Ri
Bj 1 Fij
j
is the process of gathering. is the process of gathering. ! is the process of gathering. Graphics Lecture 14: Slide 24!
20 / 35 Shooting Patches Shootingan iteration Bi" changes by
Suppose in Patches Shooting Patches
Shooting Patches Bi . SupposeSupposeeveryiteration BB can be Biby! using:
in an an
Bi patch by found
The change toiterationiteration changes .
• Suppose in in another changeschanges by Bi .
ii
k1
k
• change
change toBotherBother can Fji found using: using:
every patch Rj be B kbe found
TheTheThe to everyto everyj otherpatch canibe1 found using: !
+ patch can
j=
change k
k
Bj = BB k1= B k Fji R iF 1 B k 1
+ Rj 1 + B k
j
j ji
j
j
i
This is the process of shooting, and is evaluating the matrix
column wise. process of shooting, and is evaluating the
• This is the
This is the process process of shooting,evaluating the matrix matrix
This is the of shooting, and is and is evaluating the
matrix column wise. !
column wise. wise.
column Graphics Lecture 14: Slide 25!
21 / 35 Evaluation Order "
• The idea of gathering and shooting allows us to choose
an evaluation order that ensures fastest convergence. !
• The patches with the largest change ∆B (called the
unshot radiosity) are evaluated ﬁrst. !
• The process starts by initialising all unshot radiosity to
zero except emitting patches where ∆Bi = Ei Graphics Lecture 14: Slide 26! Processing unshot radiosity Processing unshot unshot radiosity "
Processing radiosity
Choose patch with largest unshot
•radiosity patch with largest
Choose Bi
Choose patch with largest unshot
unshot radiosity ∆Bi
radiosity Bi
Patch Unshot radiosity
Shoot the radiosity for the chosen
• Shoot the radiosity for the
B0
B0
patch, i.e. for all other patches update
Patch BUnshot radiosity
Shoot chosen patch, i.e. for all other
the radiosity for the chosen
B1
1
B0 B
B0 B
atches update patches Bi
patch,pi.e. for all Bj = Rj Fji update
other !
2
2
B1 .
B1 .
.
.
.
B2
B2 .
Bj to their
Bi
and add it = Rj Fjiradiosity
BN
. BN
.
.
.
.
.
and • and add it to their radiosity !
add it to their radiosity
BN
BN
Set Bi = 0 and iterate • Set ∆Bi = 0 and iterate !
Set Bi = 0 and iterate Graphics Lecture 14: Slide 27!
23 / 35 Interpolation Strategies
Interpolation Strategies "
Visual artefacts do occur with interpolation strategies, but may not
• Visual artefacts do occur with interpolation strategies, but
be signiﬁcant for small patches may not be signiﬁcant for small patches ! Graphics Lecture 14: Slide 28! Meshing "
• Meshing is the process of dividing the scene into
patches. !
• Meshing artifacts are scene dependent. !
• The most obvious are called D0 artifacts, caused by
discontinuities in the radiosity function ! Graphics Lecture 14: Slide 29! D0 artifacts
0 D artifacts"
• Discontinuities in the radiosity are exacerbated by bad
Discontinuities in the radiosity are exacerbated by bad patching
patching ! Graphics Lecture 14: Slide 30! Discontinuity Meshing (a-priori) "
• The idea is to compute discontinuities in advance:!
!
– Object boundaries!
– Albedo/reﬂectivity discontinuities!
– Shadows (requires pre-processing by ray tracing) !
– etc. ! • Place patches in advance so that they align with the
discontinuities !
• Then calculate radiosity !
Graphics Lecture 14: Slide 31! Graphics Lecture 14: Slide 32!
28 / 35 Adaptive Meshing (a posteriori)"
The idea is to re-compute the mesh during the radiosity
calculation!
If two adjacent patches have a strong discontinuity in
radiosity value, we can !
1. Put more patches (elements) into that area, or!
2. Move the mesh boundary to coincide with the greatest change ! Graphics Lecture 14: Slide 33! Subdivision of Patches (h-reﬁnement)
Subdivision of Patches (h-reﬁnement) "
!
Compute the radiosity at
the vertices of the
coarse grid. !
Compute the radiosity at the
!
vertices of the coarse grid.
!
Subdivide into elements if the
Subdivide into elements
discontinuities exceed a threshold
if the discontinuities
exceed a threshold ! Graphics Lecture 14: Slide 34! Computational issues of h-reﬁnement "
When a patch is divided into elements each element
radiosity is computed using the original radiosity solution
for all other patches. !
!
The assumptions are that !
1. The radiosity of a patch is equal to the sum of the
radiosity of its elements, and, !
2. The distribution of radiosities among elements of a
patch do not affect the global solution signiﬁcantly ! Graphics Lecture 14: Slide 35! Patch Reﬁnement (r-reﬁnement)
Patch Reﬁnement (r-reﬁnement) " Compute the radiosity at the
vertices of the coarse grid. !
! Compute the radiosity at the
vertices of patch boundaries
Move the the coarse grid.
closer together if they have
Move the patch boundaries closer
htogether if they changes !
igh radiosity have high
radiosity changes Graphics Lecture 14: Slide 36!
32 / 35 Computational issues of r-reﬁnement "
• Unlike the other solution (h-reﬁnement) it is necessary to
recompute the entire radiosity solution each reﬁnement. !
• However the method should make more efﬁcient use of
patches by shaping them correctly. Hence a smaller
number of patches could be used. ! Graphics Lecture 14: Slide 37! Adding Specularities "
• We noted that specularities (being viewpoint dependent)
cannot be calculated by the standard radiosity method.!
• However, they could be added later by ray tracing. !
• The complete ray tracing solution is not required, just the
specular component in the viewpoint direction ! Graphics Lecture 14: Slide 38! Graphics Lecture 14: Slide 39!
35 / 35 ...

View
Full Document

- Spring '14
- Gauss–Seidel method, Radiosity