01/29/03 © 2003 University of Wisconsin
Last Time
• Radiosity
01/29/03 © 2003 University of Wisconsin
Today
• Form Factor Computations
• Progressive Radiosity
01/29/03 © 2003 University of Wisconsin
Form Factors (recall)
• The proportion of patch i’s power received by patch j
• Also a point-patch form: the proportion of the power from a differential area about point x received by j
dydxyxVrA
Fi jPx Py
iji ),(
coscos12,
jPyjx dyyxV
rF ),(
coscos2,
01/29/03 © 2003 University of Wisconsin
Form Factor Computations
• Unoccluded patches:– Direct integration
– Conversion to contour integration
– Form factor algebra
• Occluded patches:– Monte Carlo integration
– Projection methods• Hemisphere
• Hemicube
01/29/03 © 2003 University of Wisconsin
Direct Integration
• Only works for simplest cases
• For example: Point to a Disc– A point to something form factor is that from
a small area, dx, to the patch
– Integrating over the points on a patch gets you the patch-patch integral
– Note that the point is on the line perpendicular to the disc through the center
22
2
, vu
uF discx
01/29/03 © 2003 University of Wisconsin
Direct Integration – Point-Rect
• Note that you could get any point-rectangle configuration using the additive property
2
1
22
1
2,1
tan11
tan12
1
Y
X
Y
Y
X
Y
X
XF rectx
w
vY
w
uX ,
01/29/03 © 2003 University of Wisconsin
Direct Integration – Rect-Rect
• Note that we can do this only under the constant radiosity over patch assumption
• There is a formula for 2 isolated polygons, but it assumes they can see each other fully!
222
2222
222
2222
22
22
22
12211
1
1ln
1
1ln
1
11ln
4
1
1tan
1tan
1tan
1
YXY
YXYY
YXX
YXXX
YX
YX
X
YXYX
YY
XX
XF
01/29/03 © 2003 University of Wisconsin
Contour Integral
• Use Stokes’ theorem to convert the area integrals into contour integrals
• For point to polygon form factors, the contour integral is not too hard
• Care must be taken when r0
i jC C
iij ydxrd
AF
ln
2
1
01/29/03 © 2003 University of Wisconsin
Form Factor Algebra
• Use the properties of form factors and direct integration to compute new form factors– Additivity
– Reciprocity
– Point to disc form factors
– Rectangle to rectangle form factors
• Difficult to apply automatically– Useful only in tiny scenes
• Unoccluded case only
01/29/03 © 2003 University of Wisconsin
Projection Methods
• For patches that are far apart compared to their areas, the inner integral in the form factor doesn’t vary much– That is, the form factor is similar from most points on a surface i
• So, compute point to patch form factors and weigh by area
dyyxVr
FPyPx ),(
coscos2,
01/29/03 © 2003 University of Wisconsin
Nusselt’s Analogy
• Integrate over visible solid angle instead of visible patch area:
P
dF Px
cos1
,
Fx,P is the fraction of the area of the unit disc in the base plane obtained by projecting the surface patch P onto the unit sphere centered at x and then orthogonally down onto the base plane.
01/29/03 © 2003 University of Wisconsin
Same Projection – Same Form Factor
• Any patches with the same projection onto the hemisphere have the same form factor– Makes sense: put yourself at the point
and look out – if you see equal amounts, they get equal power
• It doesn’t matter what you project onto: two patches that project the same have the same form factor
01/29/03 © 2003 University of Wisconsin
Monte-Carlo Form Factors
• We can use Monte-Carlo methods to estimate the integral over visible solid angle
• Simplest method:– Uniformly (in area) sample the disc about the point
– Project up onto the hemisphere, then cast a ray out from the point in that direction
– Form factor for each patch is the weighted sum of the number of rays that hit the patch
• There are even better Monte-Carlo methods that we will see later
01/29/03 © 2003 University of Wisconsin
The Hemicube
• We have algorithms, and even hardware, for projecting onto planar surfaces
• The hemicube consists of 5 such faces
• A “pixel” on the cube has a certain projection, and hence a certain form factor
• Something that projects onto the pixel has the same form factor 222
222
)1(
)1(
yz
AzF
yx
AF
faceside
facetop
01/29/03 © 2003 University of Wisconsin
Hemicube, cont.
• Pretend each face of the hemicube is a screen, and project the world onto it
• Code each polygon with a color, and count the pixels of each color to determine C(j)
• Quality depends on hemicube resolution and z-buffer depth
)(
,jCq
qPx FFj
01/29/03 © 2003 University of Wisconsin
Problems with Gauss-Seidel
• All the form factors are required before any image can be generated– So you wait a long time to see anything
• Reducing the number of form factors requires reducing the number of patches, which severely impacts quality
• We desire a progressive solution, that starts with a rough approximation and refines it– This also opens the possibility of computing some pieces (the bits
you can see) before others
01/29/03 © 2003 University of Wisconsin
Radiosity Eqn to Energy Eqn
• The radiosity equation is in terms of power per unit area
• Rewrite this equation in terms of energy values per patch (instead of per unit area)
NiFBEBij
ijjiii
1for
jiiijij
jiij
jiii
ijij j
jiiiiii
iiiii
F
F
FA
AEABA
EAεBAβ
KεKβ with
,Let i
Note that the form factor is now from j to i
01/29/03 © 2003 University of Wisconsin
Relaxation and Residuals
• Relaxation methods start with an initial guess, (0), and perform a sequence of relaxation steps, each resulting in a new (k)
• The residual is defined as
• At each step, relaxation methods zero one element of the residual (e.g. Gauss-Seidel zeros each one in turn)
• Note the residual is zero when the equation is solved
)()( kk Kβεr
01/29/03 © 2003 University of Wisconsin
Southwell Relaxation
• Southwell relaxation zeros the largest residual at each step
)1(
1
)1(0
kj
N
jiji
ki Kr
)()1(, kj
kjij
ii
kik
ik
i
ij
kjiji
ii
ki
K
r
KK
)()()1(
)()1( 1
We can update the radiosity for the patch i in a single step! But we need to update all the other residuals
01/29/03 © 2003 University of Wisconsin
Updating Residuals
• Note that only one component of changed, i
• Hence, we only need one element of K for every j, one row in total
)()1(
1
)(
)1(
1
)1(
km
km
N
mjm
kj
km
N
mjmj
kj
Kr
Kr
)()()()1()()1( ki
ii
jikj
ki
kiji
kj
kj r
K
KrKrr
Using the definition of residuals
01/29/03 © 2003 University of Wisconsin
Southwell Summary
• Each patch has two components: energy, ik, and
undistributed energy, rik
• Start with some i0 and hence ri
0
• At each step k+1:– Choose the i with maximum residual
– Update ik+1 and ri
k+1 =0
– Update all the rjk+1
01/29/03 © 2003 University of Wisconsin
Physical Interpretation
• Assume that all the initial patch energies are 0• Then the initial residuals are the amounts of energy to be
emitted by each patch• Each step redistributes the residual according to:
• Recall, the form factor Fij is the amount of power radiated by i that j receives
• So, each patch gets its own share of the residual that is shot, according to the form factors
)()()1( kiijj
kj
kj rFrr
01/29/03 © 2003 University of Wisconsin
Gathering and Shooting
• Gauss-Seidel “gathers” radiosity from every patch to a specific patch:
• Southwell “shoots” energy from one patch onto all the other patches
• The terms gathering and shooting are used commonly in the literature– Eg “do a final gather” means gather radiosity to the image plane
ij
ijk
jiik
i FBEB )()1(
)()()1( kiijj
kj
kj rFrr
01/29/03 © 2003 University of Wisconsin
Progressive Refinement
• After any number of iterations, an estimate of each patch’s final energy can be obtained by:
• These intermediate results can be displayed as the algorithm proceeds, giving faster feedback
i
ki
kik
i A
rB
)()()(
01/29/03 © 2003 University of Wisconsin
Typical Equations
• Typically work in terms of radiosity, which result in equations similar to those from the previous slides
• Define radiosity and “un-shot” radiosity
• On each step, find the highest residual:
• Compute all the form factors out of patch i– Eg With a hemi-cube centered on I
• Continued…
i
ki
ki
i A
rB
)()(
i
ki
i A
rB
)(
iik
i BAr )(
01/29/03 © 2003 University of Wisconsin
More Equations
• Display partial solution by displaying Bj
ij
iijjjj B
A
AFBB
0 iB
ij
iijjjj B
A
AFBB
01/29/03 © 2003 University of Wisconsin
Ambient Correction
• Progressive radiosity images look dark at first, because shooters hold onto their energy until it’s their turn.
• An ambient correction can be added to the display only:
N
i i
ii
N
j
kj
avg A
RUBrUR
11
)( ,,1
1