Rendering III : Radiosity

Post on 13-Apr-2022

12 views 0 download

Transcript of Rendering III : Radiosity

Rendering III :Radiosity

July 20, 1999

July 20, 1999

Motivational Film

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

July 20, 1999

Logistics

✔Paper summaries on Radiosity– Any takers?

✔Projects– Updates due today

– Sign up for presentations now open

July 20, 1999

Logistics

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

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…

July 20, 1999

Computer Graphics as Virtual Photography

camera(captureslight)

syntheticimage

cameramodel

(focusessimulatedlighting)

processing

photoprocessing

tonereproduction

realscene

3Dmodels

Photography:

ComputerGraphics:

Photographicprint

July 20, 1999

Today’s Class

✔Radiosity– Basics

– The Radiosity Equation– Form Factors

• What they are• The hemicube solution

– Solving the Radiosity Equation– Rendering

July 20, 1999

Radiosity - Basics

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

– Awful for diffuse reflections.

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

July 20, 1999

Radiosity - Basics

✔Radiant exitance - radiant flux out

dAdA

dM

Φ=

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

July 20, 1999

Radiosity - Basics

✔Program Flow

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.

July 20, 1999

Radiosity - Basics

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

– Radiant exitance will be calculated for eachpatch

July 20, 1999

Radiosity - Basics

✔Patches

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.

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.

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.

July 20, 1999

Radiosity Equation

{ { {43421

surfaceother fromlight

1ereflectancoutflux init exitance

∑=

+=n

jijjioii FMMM ρ

July 20, 1999

Radiosity Equation

✔Radiosity vs Rendering Equation

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

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

∑=

+=n

jijjioii FMMM

1

ρ

July 20, 1999

Radiosity System of Equations

✔Rearrange terms a bit

∑=

+=n

jijjioii FMMM

1

ρ

∑=

−=n

jijjiioi FMMM

1

ρ

July 20, 1999

Radiosity System of Equations

✔Expand this out

)(

)(

)(

22111

22222212222

11221111111

nnnnnnnnnon

nnno

nnno

FMFMFMMM

FMFMFMMM

FMFMFMMM

ρρρ

ρρρρρρ

+++−=

+++−=+++−=

L

K

L

L

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

ρρρ

ρρρρρρ

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

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?

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.

July 20, 1999

Radiosity - Form Factors

✔ Flux emitted by Ei:

✔ Flux arriving at Ej

iii AME =

iijij F Φ=Φ

i

ijijF

ΦΦ

=

July 20, 1999

Radiosity - Form Factors

✔Physically based geometry– Points are actually areas

– Rays are actually solid angles.

July 20, 1999

Radiosity - Form Factors

✔Solid angles

2r

A=ω

July 20, 1999

Radiosity -- Form Factors

✔Radiance

θω cos

2

dAd

dL

Φ=

July 20, 1999

Radiosity -- Form Factor

✔Flux leaving Ei in direction of Ej

ωθθ ddAL iiiij cos)(radiance321

July 20, 1999

Radiosity - Form Factors

✔Solid angle of ray as seen by Ei

2/cos rdAd jjθω =

July 20, 1999

Radiosity - Form Factor

✔Flux leaving Ei towards Ej

2

coscos

r

dAdAL jijiiij

θθ=Φ

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)

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

July 20, 1999

Radiosity - Form Factor

✔Calculating the fraction

2

coscos

rdAL

dAdALF

ii

jijiiijij π

θθ=

ΦΦ

=

2

coscos

r

dAF jji

ij πθθ

=

July 20, 1999

Radiosity - Form Factor

✔Calculating the fraction

Depends ONLY on geometry!2

coscos

r

dAF jji

ij πθθ

=

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.

July 20, 1999

Radiosity - Form Factor

✔Integration over patches

July 20, 1999

Radiosity - Form Factors

✔The final expression!

ji

A A

ji

iij dAdA

rAF

i j

∫ ∫=2

coscos1

πθθ

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)

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?

July 20, 1999

Radiosity - Form Factors

✔Nusselt’s Analogy

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.

July 20, 1999

Radiosity - Form Factors

✔Result from Nusselt’s Analogy

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.

July 20, 1999

Radiosity - Form Factors

✔Hemicube

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

πθθ

July 20, 1999

Radiosity - Form Factors

✔Hemicube - delta form factor (top side)

July 20, 1999

Radiosity - Form Factors

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

– and

122 ++= vur

rji

1coscos == θθ

July 20, 1999

Radiosity - Form Factors

✔So...

2222 )1(

coscos

++∆

=∆≈∆vu

AA

rF top

topji

top ππθθ

July 20, 1999

Radiosity - Form Factors

✔Similarly, it can be shown

2222 )1(

coscos

++∆=∆≈∆

nu

AnA

rF side

sideji

side ππθθ

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

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

ρρρ

ρρρρρρ

July 20, 1999

Radiosity

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

factor Fij

– Now need to solve the radiosity equation

July 20, 1999

Radiosity

✔Recap

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.

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.

July 20, 1999

Radiosity - Progressive Refinement

✔Shooting flux into environment

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

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

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.

July 20, 1999

Radiosity

✔Okay, so where are we?

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!

July 20, 1999

Radiosity - examples

✔Cornell Box

July 20, 1999

Radiosity Examples

July 20, 1999

Radiosity

✔Based on physically based energytransfer

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

July 20, 1999

Radiosity

✔Summary

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

July 20, 1999

Radiosity

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

Perspective– Cohen/Wallace, Radiosity and Realistic

Image Synthesis– papers on reserve

✔Any questions

July 20, 1999

Next Class

✔Advanced Rendering– Two pass method

• Radiosity + ray tracing - Best of both worlds

– REYES

July 20, 1999

Remember

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