Paper Summaries

• Any takers? Radiosity

Don Greenberg Michael Cohen

Assignments Projects

• New due dates • Approx 17 projects – Checkpoint 6 – tonight • Listing of projects now on Web – Checkpoint 7 / Code – Nov 3 • Presentation schedule • Renderman – Presentations (20 min max) – Due Nov 8th (new date) – Last 3 classes (week 10 + finals week) – Getting distributions on mycourses – Sign up st nd rd – Server up and running. • Email me with 1 , 2 , 3 choices • First come first served. – DID I SAY VALUABLE PRIZES!!!! • Sign up for presentation!!!

Finals date Logistics

• For last day of presentations •Final Report – Introduction – Approach Taken – Implementation Details th • Friday, November 18 – Results • 12:30pm – 2:30pm – Appendix/Code •Presentation • 70-1445 – 10-15 minutes

• All project material due Friday, Nov 18th • Times on SCHEDULE – No late submission • else I can’t get your grades in!

1 Computer Graphics as Virtual Photography Today’s Class - Radiosity

real camera photo Photographic Photography: •Basics scene (captures processing print ) • The Radiosity Equation • Form Factors processing – What they are – The hemicube solution

Computer 3D camera tone synthetic • Solving the Radiosity Equation Graphics: models model reproduction image (focuses • Rendering simulated • Generating Meshes lighting)

Radiosity - Basics ..but first

• A video overview • Ray tracing – Great for specular type reflections – Handles hidden surface calculations – Doesn’t handle diffuse (inter-)reflections. – View dependent •Radiosity – Gorel, Torrance, et al. from Cornell! – More accurate solution to ambient light – Not as elegant as ray tracing – More physically-based

Radiosity - Basics Radiosity - Basics

• Based on thermal engineering models for • - radiant out (misnamed emission and reflection of radiosity by CGers) • Assumes the conservation of light energy in a dΦ closed system, i.e., that steady state can be M = reached dA • Assumes that all surfaces are perfectly diffuse dA • To get radiant exitance at each point, a VERY large system of linear equations must be solved

2 Radiosity - Basics Radiosity - Basics

• First determine all light interactions in an • Program Flow environment in a view independent way. • Then create image using calculated radiant exitance values in a standard rendering process. – i.e., radiosity defines a “made to fit” texture mapping

[Sillion,35]

Radiosity - Basics Radiosity - Basics

• View dependence vs view independence • Patches – Radiosity provides a view independent solution – Then rendered from a given view point. • Not points -- But patches – Scene is subdivided into patches – Radiant exitance is calculated for each patch [Ashdown,7]

Radiosity - Key Idea Radiosity - Basic Idea

• Each patch has two values associated with it: • Since all objects are perfectly diffuse, can determine where light distribution by simply – Its illumination (how brightly lit) considering the geometry of the scene. – Its surplus energy () • Closed form solution • Each patch will receive light from the environment • It will reflect a fraction back • Calculation of radiant exitance per patch is given by the radiosity equation. • Keep track of amount of light reflected back and where it went to n M i = M oi + ρi ∑ M j Fij = • Continue until all light has been distributed. exitance init flux out j 1 light from other surfaces

3 The Radiosity Equation n Radiosity Equation M i = M oi + ρi ∑ M j Fij = exitance init flux out reflectance j 1 light from other surfaces • Radiosity vs Rendering Equation

• For each patch i, the Mi is the radiant exitance of that patch. I(x, x′) = g(x, x′)[]ε(x, x′) + ∫ ρ(x, x′, x′′)I(x′, x′′)dx′′ • All surfaces are perfectly diffuse, i.e. S reflectivity is equal in all directions n – Reflectance for each patch is a constant ρi M i = M oi + ρi ∑ M j Fij = – ρi can be wavelength dependent. exitance init flux out reflectance j 1 • Geometry term Fi,j indicates the fraction of light from other surfaces flux leaving patch i and arriving at patch j.

Radiosity System of Equations Radiosity System of Equations

• Rearrange terms • Expand the terms n M o1 = M1 − (ρ1M1F11 + ρ1M 2F12 +…+ ρnM n F1n ) M i = M oi + ρi M j Fij ∑ M = M − (ρ M F + ρ M F +…+ ρ M F ) j=1 o2 2 2 2 21 2 2 22 n n 2n … n M on = M n − (ρn M1Fn1 + ρnM 2Fn2 +…+ ρnM n Fnn ) M oi = M i − ρi ∑ M j Fij j=1

Radiosity System of Equations Radiosity System of Equations • Put in matrix notation • Put into matrix form

M o = (I −T ) M ⎡M o1 ⎤ ⎡1− ρ1F11 − ρ1F12 … − ρ1F1n ⎤⎡M1 ⎤ known ⎢ ⎥ ⎢ ⎥⎢ ⎥ M 2 − ρ2 F21 1− ρ2 F22 … − ρ2 F2 M 2 M = initial n x 1 exitance vector ⎢ o ⎥ = ⎢ n ⎥⎢ ⎥ o ⎢ … ⎥ ⎢ … … … … ⎥⎢ …⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ Trying to find I = n x n identity matrix ⎣M on ⎦ ⎣ − ρn Fn1 − ρn Fn2 … 1− ρn Fnn ⎦⎣M n ⎦ M = final n x 1 exitance vector

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

Still Need

4 Radiosity - Form Factor

Radiosity - Form Factors Note: •r is distance between • Form factors are based solely on geometry: surfaces

– Given the radiant exitance of a patch E , what •φi & φI relative i orientations fraction of it is received by another patch Ej? •dAi & dAI – Remember: All patches are Lambertian surfaces and relative areas distribute flux (radiant exitance) equally in all •cos φi cos φI directions. differential angle [0,1]

•bigger φi & φI mean smaller Fij

Note: A’s and dA’s in this slide are denoted by E’s on other slides!

Radiosity - Form Factor Radiosity - Form Factor

• Notice that • Integration over patches (here dE is same as dA in – Area of patches must be relatively small previous slide) compared to distances between them – Full visibility between patches is assumed – Patches are not points nor are they differential areas – Must in the end integrate over each patch.

[Ashdown, 43]

Radiosity - Form Factors Radiosity - Form Factor Facts • The final expression! • Solution first developed in 1760 by Lambert Hij •AiFij = AjFji - Useful to find pairs of form factors • Form factor calculation assumes a nonparticipating 1 cosθi cosθ j F = dA dA medium (like air or vacuum) ij ∫∫ 2 i j Ai πr AAij n n F =1 Remember we assumed all patches could get to all others, the Hij term, if added, ∑∑ ij is the visibility factor i=1 j=1

5 Radiosity - Form Factors Radiosity - Nusselt’s Analogy

• So how do we solve this thing? • Computing FdEi-Ej is equivalent to

– There is an analytic solution. But it is very – Projecting those parts of Ej that are visible from ugly and impractical (note: discovered in 1993) dEi onto a unit hemisphere centered about dEi – Classic solution: The Hemicube method – Then, projecting this projected area orthogonally onto the base of the hemispheres

– Break – Finally, dividing by the area, i.e.., FdEi-Ej = A/π

Radiosity - Form Factors Radiosity - Form Factors

Nusselt’s Analogy • Note from Nusselt’s Analogy that patches Ej and Ek • Project Ej onto plane have the same form factor from patch dE of surface of a i hemisphere • Form factor is a fraction of the projected surface area with respect to this projected area, i.e.., FdEi-Ej = A/π [Ashdown, 273] [Ashdown, 275]

Radiosity - Form Factors - Hemicube Hemicube and Nusselt’s Analogy

• Why the hemicube works • Image precision projections • Replace hemisphere with hemicube. • Hemicube is divided into equal sized square cells. • Can determine form factor for each cell (delta form factors). • The form factor for a patch is the sum of delta form factors for cells that the projection of the patch covers.

[&Watt, 278]

6 Radiosity - Form Factors - Hemicube Radiosity - Form Factors - Hemicube

• Hemicube - Delta Form Factors • Hemicube - Imagine that dEi represents a pinhole camera; hemicube is what it sees. – Gives an approximation of form factor for a cell on the hemicube.

cosθ cosθ F ≈ i j ∆A dEi −E j πr 2 j

[Ashdown, 276]

Radiosity - Form Factors Radiosity - Form Factors - Hemicube

• Need a hemicube for each dEi • Stores patch ids of closest intersection patch and contains precomputed delta form factors • Shooting light from source patch to destination through hemicube • Scale amount of shooter’s radiative energy by delta form factor associated with hemicube

Radiosity - Recap Radiosity - Hemicube Form Factor Facts

• Relatively inexpensive to compute • Delta form factors can be precomputed once then applied to each patch • Calculation of form factors involves projection and summation. • Accuracy depends on hemicube resolution. • Most popular means of calculating form factors

[Sillion,35]

7 Radiosity - Recap Radiosity - Recap

• Divided our scene into n patches • For each i,j combination, calculate the form factor Fij • Set up this system of n equations: • Now need to solve the radiosity equation for

⎡M o1 ⎤ ⎡1− ρ1F11 − ρ1F12 … − ρ1F1n ⎤⎡M1 ⎤ ⎢ ⎥ ⎢ ⎥⎢ ⎥ M o2 − ρ2 F21 1− ρ2 F22 … − ρ2 F2n M 2 − ρ − ρ − ρ ⎢ ⎥ = ⎢ ⎥⎢ ⎥ ⎡M o1 ⎤ ⎡1 1F11 1F12 … 1F1n ⎤⎡M1 ⎤ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ … ⎥ ⎢ … … … … ⎥⎢ …⎥ M − ρ F 1− ρ F − ρ F M ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ o2 ⎥ ⎢ 2 21 2 22 … 2 2n ⎥⎢ 2 ⎥ − ρ − ρ − ρ = ⎣M on ⎦ ⎣ n Fn1 n Fn2 … 1 n Fnn ⎦⎣M n ⎦ ⎢ … ⎥ ⎢ … … … … ⎥⎢ …⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎣M on ⎦ ⎣ − ρn Fn1 − ρn Fn2 … 1− ρn Fnn ⎦⎣M n ⎦

Solve the Radiosity Equation Radiosity - Progressive Refinement

• By gathering - use numerical techniques such as • Solves Jacobi / Gauss-Sidel methods (can be done in – Memory requirements parallel) – Lessens processing time – Calculates full radiosity solution – Θ (n2) – Preview work in progress • Based on flux (radiant exitance) left to be • By shooting - progressive refinement distributed in scene. – Approximate solution – Better solution with each iteration.

Radiosity - Progressive Refinement Radiosity - Progressive Refinement

• At each iteration, only consider the patch with • Shooting flux into environment most flux yet to be distributed. • Continue until flux left to be distributed falls below a threshold. • If threshold = 0, equivalent to full solution. n M i = M oi + ρi ∑ M j Fij = exitance init flux out reflectance j 1 light from other surfaces

8 Radiosity - Progressive Refinement Radiosity - Progressive Refinement

unsent • For each patch i we keep track of: • Initialize Mi, ∆Mi, ∆Mi = Moi unsent –Mi - current amount of radiant exitance • While M > Threshold – Find element i with greatest ∆M unsentA – ∆Mi - current amount of radiant exitance gained i i since last iteration – For each other element j unsent • Calculate form factor Fij – ∆Mi - amount of unsent radiant exitance unsent • Calculate ∆Mi, change of Mi, due to ∆Mi Ai since last iteration unsent • Update ∆Mj unsent •M is the total amount of unsent flux = • Update Total Mj unsent –Set ∆Munsent for element i to 0 ∆Mi Ai

Radiosity - Progressive Refinement Radiosity - Progressive Refinement

• Solution gets progressively better with each iteration • Later iterations contribute less to total solution than earlier iterations • Limit is equivalent to complete solution.

Radiosity - Progressive Refinement Radiosity - Progressive Refinement

Gauss-Seidel 1, 2, 24, 100 Progressive Refinement Steps 1, 2, 24, 100 Steps Progressive Refinement with Ambient Term 1, 2, 24, 100 Steps [Cohen, 121] [Sillion, Plate 9] [Sillion, Plate 9]

9 Radiosity – Where are we? Radiosity – view independence

• Radiosity solution gives us • Once a radiosity solution is calculated a view independent solution – As long as the scene doesn’t change • “Made to fit” texture – Can be used for multiple viewpoints mapping • Use traditional rendering to – E.g. architectural walkthrus. get view dependent image – Flat / Gouraud shading / Z- buffer – Non-recursive ray tracing [Sillion,35]

Radiosity - Summary Radiosity - Meshing strategies

• Based on thermal • How do we efficiently divide scene into engineering models for patches emission and reflection of – Adaptive Subdivision radiation • Assumes the conservation of – Only need subdivision in high contrast areas where light energy in a closed there is a dramatic change in energy across a system, i.e., steady state can relatively small area be reached • shadow boundary • Assumes diffuse surfaces • light source • Computationally intensive [Sillion,35]

Radiosity - Adaptive Subdivision Radiosity - Adaptive Subdivision

• Once a surface has fully emitted its energy, each patch is visited and a decision is made to subdivide patches if two adjoining patches have too much difference in their illumination values • Notice there is a difference between subdividing to make patches and to do energy collection [Sillion,73]

10 Radiosity

• Further Reading – Ashdown, Radiosity: A Programmer’s Perspective – Cohen & Wallace, Radiosity and Realistic Image Synthesis – Sillion & Puech, Radiosity & Global Illumination – Watt & Watt – Foley & Van Dam

11