72
Rendering III : Radiosity July 20, 1999

Rendering III : Radiosity

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Rendering III : Radiosity

Rendering III :Radiosity

July 20, 1999

Page 2: Rendering III : Radiosity

July 20, 1999

Motivational Film

✔More Bells and Whistles– Computer Graphics’ first music video

Page 3: Rendering III : Radiosity

July 20, 1999

Logistics

✔Paper summaries on Radiosity– Any takers?

✔Projects– Updates due today

– Sign up for presentations now open

Page 4: Rendering III : Radiosity

July 20, 1999

Logistics

✔Many thanks to Max and Rob for takingover for me last week.

Page 5: Rendering III : Radiosity

July 20, 1999

Photography and Light

pho•tog•ra•phy, n., the process or art ofproducing images of objects by the action oflight on a sensitized surface, esp, a film in acamera.

Sure, we know, it’s all aboutlight…

Page 6: Rendering III : Radiosity

July 20, 1999

Computer Graphics as Virtual Photography

camera(captureslight)

syntheticimage

cameramodel

(focusessimulatedlighting)

processing

photoprocessing

tonereproduction

realscene

3Dmodels

Photography:

ComputerGraphics:

Photographicprint

Page 7: Rendering III : Radiosity

July 20, 1999

Today’s Class

✔Radiosity– Basics

– The Radiosity Equation– Form Factors

• What they are• The hemicube solution

– Solving the Radiosity Equation– Rendering

Page 8: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔The problem with ray tracing– Great for specular type reflections

– Awful for diffuse reflections.

Page 9: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔Based on the theory of heat transfer✔Calculate lighting in a steady state✔Assumes that all surfaces are perfectly

diffuse✔Formulates a large systems of linear

equations✔Solution of these equations give you

radiant exitance at each point

Page 10: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔Radiant exitance - radiant flux out

dAdA

dM

Φ=

Page 11: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔Image is created by using calcuatedradiant existance values in standardrendering process.– In essence, radiosity defines a “made to fit”

texture mapping

Page 12: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔Program Flow

Page 13: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔View dependence vs viewindependence– Radiosity provides a view independent

solution

– Scene needs to be further rendered from agiven view point.

Page 14: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔Not points -- But patches– Scene is subdivided into patches

– Radiant exitance will be calculated for eachpatch

Page 15: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔Patches

Page 16: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔Basic idea– Each patch will receive a certain amount of

light from the environment– It will reflect fraction back into the

environment

– Keep track of amount of light reflectedback

– Continue till all light has been exhasted.

Page 17: Rendering III : Radiosity

July 20, 1999

Radiosity - Basics

✔Key idea– Since all objects are perfectly diffuse, we

can determine where light is coming from(and going) by simply considering thegeometry of the scene.

– Calculation of radiant exitance per patch isgiven by the radiosity equation.

Page 18: Rendering III : Radiosity

July 20, 1999

The Radiosity Equation

✔For each patch i, the RE gives you theradiant exitance of that patch.

✔All surfaces are perfectly diffuse (I.e.reflectivity is equal in all directions)– Reflectance for each patch is a constant ρI

✔Geometry term Fi,j indicates the fractionof flux leaving patch i and arriving atpatch j.

Page 19: Rendering III : Radiosity

July 20, 1999

Radiosity Equation

{ { {43421

surfaceother fromlight

1ereflectancoutflux init exitance

∑=

+=n

jijjioii FMMM ρ

Page 20: Rendering III : Radiosity

July 20, 1999

Radiosity Equation

✔Radiosity vs Rendering Equation

[ ]∫ ′′′′′′′′+′′=′S

xdxxIxxxxxxxgxxI ),(),,(),(),(),( ρε

∑=

+=n

jijjioii FMMM

1

ρ

Page 21: Rendering III : Radiosity

July 20, 1999

Radiosity System of Equations

✔Rearrange terms a bit

∑=

+=n

jijjioii FMMM

1

ρ

∑=

−=n

jijjiioi FMMM

1

ρ

Page 22: Rendering III : Radiosity

July 20, 1999

Radiosity System of Equations

✔Expand this out

)(

)(

)(

22111

22222212222

11221111111

nnnnnnnnnon

nnno

nnno

FMFMFMMM

FMFMFMMM

FMFMFMMM

ρρρ

ρρρρρρ

+++−=

+++−=+++−=

L

K

L

L

Page 23: Rendering III : Radiosity

July 20, 1999

Radiosity System of Equations

✔Put into matrix form

−−−

−−−−−−

=

nnnnnnnn

n

n

on

o

o

M

M

M

FFF

FFF

FFF

M

M

M

L

L

LLLL

L

L

L2

1

21

22222212

11121111

2

1

1

1

1

ρρρ

ρρρρρρ

Page 24: Rendering III : Radiosity

July 20, 1999

Radiosity System of Equations

✔Put in matrix notation

MTIM o )( −=Mo = initial n x 1 exitance vector

I = n x n identity matrix

M = final n x 1 exitance vector

T = n x n matrix whose i,j element is ρiFij

Page 25: Rendering III : Radiosity

July 20, 1999

Radiosity System of Equations

✔We have Mo

✔We have I

✔We have ρI

✔We’re solving for M✔We need this Fij -- Form Factor

✔Any questions?

Page 26: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Form factors are a geometric term:– Given the radiant exitance of a patch Ei,

what fraction of its flux is received byanother patch Ej.

– Remember: All patches are Lambertiansurfaces and distribute flux equally in alldirections.

Page 27: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔ Flux emitted by Ei:

✔ Flux arriving at Ej

iii AME =

iijij F Φ=Φ

i

ijijF

ΦΦ

=

Page 28: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Physically based geometry– Points are actually areas

– Rays are actually solid angles.

Page 29: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Solid angles

2r

A=ω

Page 30: Rendering III : Radiosity

July 20, 1999

Radiosity -- Form Factors

✔Radiance

θω cos

2

dAd

dL

Φ=

Page 31: Rendering III : Radiosity

July 20, 1999

Radiosity -- Form Factor

✔Flux leaving Ei in direction of Ej

ωθθ ddAL iiiij cos)(radiance321

Page 32: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Solid angle of ray as seen by Ei

2/cos rdAd jjθω =

Page 33: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factor

✔Flux leaving Ei towards Ej

2

coscos

r

dAdAL jijiiij

θθ=Φ

Page 34: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factor

✔Recall: Form Factor is the fraction oftotal flux given off by one patch thatarrives at another.

✔We have the amount of flux from i to j(Φij)

✔What we need is total amount of fluxemitted by i (Φi)

Page 35: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factor

✔Recall: Patch i is Lambertian

iiiii dALdAM π==Φ

Note: it can be shown by integration of Lover a hemisphere that M = πL for aLambertian surface

Page 36: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factor

✔Calculating the fraction

2

coscos

rdAL

dAdALF

ii

jijiiijij π

θθ=

ΦΦ

=

2

coscos

r

dAF jji

ij πθθ

=

Page 37: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factor

✔Calculating the fraction

Depends ONLY on geometry!2

coscos

r

dAF jji

ij πθθ

=

Page 38: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factor

✔But wait, there’s more….– Patches are not points nor are they

differential areas– Must integrate over each patch.

Page 39: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factor

✔Integration over patches

Page 40: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔The final expression!

ji

A A

ji

iij dAdA

rAF

i j

∫ ∫=2

coscos1

πθθ

Page 41: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Fun Facts about form factors– Solution first developed in 1760 by

Lambert– AiFij = AjFji

– Form Factor assumes a nonparticipatingmedium (like air or vacuum)

Page 42: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔So how do we solve this thing?– There is an analytic solution. But it is very

ugly and impractical (note: discovered in1993)

– Classic solution: The Hemicube method

– Any questions before we move on?

Page 43: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Nusselt’s Analogy

Page 44: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Nusselt’s Analogy– Project Ej onto plane of surface

– Form factor is fraction of projected surfacearea with respect to projected area of ahemisphere.

Page 45: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Result from Nusselt’s Analogy

Page 46: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Hemicube– Replace hemisphere with hemicube.

– Hemicube is divided into cells.– Can determine form factor for each cell

(delta form factors).

– Form factor for a patch is the sum of deltaform factors for cells that the projection ofthe patch covers.

Page 47: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Hemicube

Page 48: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Hemicube - Delta Form Factors– Gives an approximation of form factor for a

cell on the hemicube.

jji

EdE Ar

Fji

∆≈− 2

coscos

πθθ

Page 49: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Hemicube - delta form factor (top side)

Page 50: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Hemicube - Delta Form Factors– If we conveniently choose r to be 1 then

– and

122 ++= vur

rji

1coscos == θθ

Page 51: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔So...

2222 )1(

coscos

++∆

=∆≈∆vu

AA

rF top

topji

top ππθθ

Page 52: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Similarly, it can be shown

2222 )1(

coscos

++∆=∆≈∆

nu

AnA

rF side

sideji

side ππθθ

Page 53: Rendering III : Radiosity

July 20, 1999

Radiosity - Form Factors

✔Fun Facts about Hemicube– Delta Form Factors can be precomputed

once then applied to each patch– Accuracy depends on hemicube resolution.– Most popular means of calculating form

factors

Page 54: Rendering III : Radiosity

July 20, 1999

Radiosity

✔Let’s recap– Divided our scene into n patches

– Set up this system of n equations:

−−−

−−−−−−

=

nnnnnnnn

n

n

on

o

o

M

M

M

FFF

FFF

FFF

M

M

M

L

L

LLLL

L

L

L2

1

1221

2212221212

11121111

2

1

1

1

1

ρρρ

ρρρρρρ

Page 55: Rendering III : Radiosity

July 20, 1999

Radiosity

✔Recap continued– For each i,j combination, calculate the form

factor Fij

– Now need to solve the radiosity equation

Page 56: Rendering III : Radiosity

July 20, 1999

Radiosity

✔Recap

Page 57: Rendering III : Radiosity

July 20, 1999

Radiosity

✔Solving the Radiosity Equation– Use Numerical Techniques (Jacobi /

Gauss-Sidel method)• Calculates full radiosity solution• O (n2)

– Progressive Refinement• Approximate solution• Better solution with each iteration.

Page 58: Rendering III : Radiosity

July 20, 1999

Radiosity - Progressive Refinement

✔Progressive Refinement– Based on Flux left to be distributed in

scene.– At each iteration only consider patch with

most flux to give

– Continue until flux left to be distributed fallsbelow a threshold

– Limit…threshold = 0 is equivalent to fullsolution.

Page 59: Rendering III : Radiosity

July 20, 1999

Radiosity - Progressive Refinement

✔Shooting flux into environment

Page 60: Rendering III : Radiosity

July 20, 1999

Radiosity - Progressive Refinement

✔For each patch I we keep track of:– Mi - current amount of radiant exitance

– ∆Mi - current amount of radiant exitancegained since last iteration

– ∆Miunsent - amount of unsent radiant

exitance since last iteration

✔Munsent - Total amount of unsent flux =∆Mi

unsent Ai

Page 61: Rendering III : Radiosity

July 20, 1999

Radiosity - Progressive Refinement

✔ Initialize Mi, ∆Mi, ∆Miunsent = Moi

✔ While Munsent > Threshold– Find element i with greatest ∆Mi

unsentAi

– For each other element j• Calculate form factor Fij

• Calculate ∆M, change of M due to ∆MiunsentAi

• Update ∆Munsent for element j• Update Total M for element j

– Set ∆Munsent for element I to 0

Page 62: Rendering III : Radiosity

July 20, 1999

Radiosity - Progressive Refinement

✔Solution gets progressively better witheach iteration

✔Later iterations contribute less to totalsolution than earlier iterations

✔Limit is equivalent to complete solution.

Page 63: Rendering III : Radiosity

July 20, 1999

Radiosity

✔Okay, so where are we?

Page 64: Rendering III : Radiosity

July 20, 1999

Radiosity

✔Finally! Rendering– Radiosity Solution gives us a view

independent solution– “Made to fit” texture mapping– Use traditional rendering to get view

dependent image• flat / Gouraud shading• Non-recursive ray tracing

– We are done!

Page 65: Rendering III : Radiosity

July 20, 1999

Radiosity - examples

✔Cornell Box

Page 66: Rendering III : Radiosity

July 20, 1999

Radiosity Examples

Page 67: Rendering III : Radiosity

July 20, 1999

Radiosity

✔Based on physically based energytransfer

✔Calculates steady state solution✔Assumes diffuse surfaces✔Computationally intensive

Page 68: Rendering III : Radiosity

July 20, 1999

Radiosity

✔Summary

Page 69: Rendering III : Radiosity

July 20, 1999

Radiosity

✔One thing we didn’t discuss– Meshing strategies

• How do we efficiently divide scene into patches• Adaptive Subdivision

– see Ashdown, Chapter 7

Page 70: Rendering III : Radiosity

July 20, 1999

Radiosity

✔Further Reading– Ashdown, Radiosity: A Programmer’s

Perspective– Cohen/Wallace, Radiosity and Realistic

Image Synthesis– papers on reserve

✔Any questions

Page 71: Rendering III : Radiosity

July 20, 1999

Next Class

✔Advanced Rendering– Two pass method

• Radiosity + ray tracing - Best of both worlds

– REYES

Page 72: Rendering III : Radiosity

July 20, 1999

Remember

✔Class Web Site:– http://www.cs.rit.edu/~jmg/virtualPhoto