02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity...

28
02/18/05 © 2005 University of Wisc onsin Last Time • Radiosity Converting the LTE into the radiosity equation Solving with Gauss-Seidel relaxation Form factor computations

Transcript of 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity...

Page 1: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Last Time

• Radiosity– Converting the LTE into the radiosity equation

– Solving with Gauss-Seidel relaxation

– Form factor computations

Page 2: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Today

• Progressive Radiosity

• Assorted optimizations

Page 3: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

Page 4: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

ij jijiii

ij ijj

jiiiiii

iiiii

F

F

FA

AEABA

EAεBAβ

KεKβ with

,Let i

Note that the form factor is now from j to i

Page 5: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

Page 6: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

Page 7: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

Page 8: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

Page 9: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

Page 10: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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 radiance to the image plane

ij

ijk

jiik

i FBEB )()1(

)()()1( kiijj

kj

kj rFrr

Page 11: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

)()()(

Page 12: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

• Continued…

i

ki

ki

i A

rB

)()(

i

ki

i A

rB

)(

iik

i BAr )(

Page 13: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

More Equations

• Display partial solution by displaying Bj

0

i

ij

iijjjj

ij

iijjjj

B

BA

AFBB

BA

AFBB

Page 14: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 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

Page 15: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

The Effect of Patch Size

• There is a trade-off in patch size: large patches give faster solution, small patches give better results– Doubling the patch resolution increases computation by 16x

• 4x in each patch, but N2 computation, so 16x

• Effect of large patches is most obvious in receiving: patch size indicates largest resolvable illumination feature– Particularly important when?

• Large patches are not so bad for emitting– What impact will large vs. small patches have?

Page 16: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Shooting to Vertices

• “Standard” progressive radiosity shoots from points to areas– Point is middle of shooting patch

– Area is the area of a receiving element

• Better to shoot from area to points:– Area is source patch, point is receiving vertex

– Progressive radiosity really needs Fji

– Less aliasing under certain circumstances

– Radiosity is needed at vertices for display

– Greater control over receivers

Page 17: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Ray-casting For Form Factors

• Aim: compute

• Cast rays from y to sub-patches, Pik, of Pi:

– Ray determines (constant) visibility for each sub-patch

• Then:

• Not Monte-Carlo, but similar!

dxyxVr

Fi

i PxPy ),(coscos2,

dxr

F

FVF

ki

i

i

Pxk

k

n

k kPy

2

1,

coscos

ˆ

Page 18: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Delta Form Factors

• We need to compute Fk

• Several possibilities– Assume constant, evaluated using angles and radius for a

point at the center of the patch (can be very bad)– Use analytic methods, point-polygon (costly)– Use disc approximation

• Assume sub-patch is a small disc• Form factor for point-disc is known

2

222

2

,

coscos

,

rA

AF

rvAuvu

uF

ki

ki

k

kidiscy

Page 19: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Automated Meshing

• The patch and element resolution should be decided based on the complexity of the illumination situation

• It is unreasonable to expect a user to know what is required – they are, after all, using the software to find a solution

• Automated meshing strategies are desired

Page 20: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Adaptive Subdivision (Progressive Version)

• Shoot as normal

• Choose to subdivide after each shot– Look at how the received energy varied over the surface

• Not all shooting patches require the same subdivision– For instance, lights in different places cast different shadows

– Can re-compute subdivision for each shot

• Distribute radiosity gathered at one resolution to that gathered at another– Need all radiosity at largest patch size for shooting

– Need all radiosity at highest level of subdivision for rendering

Page 21: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Which Resolution?

• Should P be bigger or smaller for each receiving patch?

• What influences the decision?

Page 22: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Hierarchical Meshing

• Use different resolution depending on who is emitting and who is receiving

• Build hierarchy of elements for each patch

• Record interactions between elements at appropriate levels

• Essentially replaces blocks in the form factor matrix with average values

Page 23: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Building the Hierarchy

• Start with “top level” patches• Estimate the error incurred by each patch-patch transfer.

Use:– Form factor estimate:– Radiosity Form factor– Importance (more later)

• If error too large, break one element and recurse– But only recurse for this transfer – don’t re-compute all transfers

• Like starting with finest resolution, and averaging blocks in the form factor matrix

2

coscos~r

F

Page 24: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Hierarchical Solution

• For each Gauss-Seidel iteration– Gather energy to a patch along all the

links– Update radiosity values for each node

in the patch hierarchy• Push radiosity down from parents to

children – no area weighting• Pull radiosity up from children to

parents – area weighted

• Cost proportional to number of links, which is O(N) where N is number of leaves

Page 25: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Brightness-weighted refinement

• Subdivide based on an estimate of energy transferred

• Need radiosity estimates, which we don’t know beforehand:– Start with high error threshold, and get approximate solution

– Refine hierarchy using radiosity estimates

– Repeat with successively lower thresholds

– Also called multi-grid methods

Page 26: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Importance

• For a single image, only the visible surfaces are directly important– Don’t care what’s “down the hall”

• Surfaces illuminating visible surfaces are also important, and other surfaces illuminating those surfaces…

• Importance propagates backwards from the “primary” sources of importance– Visible surfaces are typically prime sources of importance

Page 27: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Solving for Importance

• Ri is the inherent importance of a given element

• When radiosity is gathered, importance is shot

• Use BIF as error estimate in determining subdivision– Radiosity * Importance * Form Factor: Combine with multi-grid method

• Note: must use different push-pull operations for importance– Push down area-weighted, pull up non-weighted

jji

N

jjii IFRI

1

Page 28: 02/18/05© 2005 University of Wisconsin Last Time Radiosity –Converting the LTE into the radiosity equation –Solving with Gauss-Seidel relaxation –Form.

02/18/05 © 2005 University of Wisconsin

Next Time

• A little more radiosity

• Volume scattering