Radiosity Radiosity

‹ Motivation: what is missing in ray-traced images? ‹ Indirect illumination effects ‹ Color bleeding ‹ Soft shadows

‹ Radiosity is a physically-based illumination algorithm capable of simulating the above phenomena in a scene made of ideal diffuse surfaces.

‹ Books: ‹ Cohen and Wallace, Radiosity and Realistic Image Synthesis, Academic Press Professional 1993. ‹ Sillion and Puech, Radiosity and Global Illumination, Morgan- Kaufmann, 1994.

Indirect illumination effects Radiosity in a Nutshell

‹ Break surfaces into many small elements

Light source ‹ Formulate and solve a linear system of equations that models the equilibrium of inter-reflected Eye in a scene.

Diffuse Reflection ‹ The solution gives us the amount of light leaving each point on each surface in the scene.

‹ Once solution is computed, the shaded elements can be quickly rendered from any viewpoint.

Meshing (partition into elements) Radiosity

Input geometry Change geometry

Form-Factors

Change light or colors Solution

Render

Change view

1 Radiometric quantities The Radiosity Equation

‹ [J] ‹ Assume that surfaces in the scene have been discretized into n small elements. ‹ Radiant power (): radiant energy per second [W] ‹ Assume that each element emits/reflects light ‹ (flux density): incident radiant power per uniformly across its surface. unit area [W/m2] ‹ Define the radiosity B as the total hemispherical ‹ Radiosity (flux density): outgoing radiant power per flux density (W/m2) leaving a surface. unit area [W/m2] ‹ Let’’s write down an expression describing the total flux (light power) leaving element i in the ‹ (angular flux dedensity):nsity): radiant power per scene: unit projected area per unit solid angle [W/(m2 sr)] scene: total flux = emitted flux + reflected flux

The Radiosity Equation The Form Factor

‹ Total flux leaving element i: Bi Ai ‹ The form factor Fji tells us how much of the flux ‹ Total flux emitted by element i: Ei Ai leaving element j actually reaches element i. ‹ Total reflected flux: 1 cosθ cosθ F = x y V (x, y)dA dA ‹ ( of element i)*(the total incoming flux) ij ∫∫ 2 x y Ai xA∈∈A y π x − y ‹ total incoming flux = sum of contributions from all other ij elements in the scene ρi ∑ B j Aj Fji j

‹ The full radiosity equation is then: n Bi Ai = Ei Ai + ρi ∑ B j Aj Fji j=1

Form-Factor Computation Properties of Form Factors

‹ Reciprocity: Ai Fij = Aj Fji

‹ Additivity: Fi( j∪k ) = Fij + Fik

‹ Conservation of energy in a closed environment: n ∑ Fij = 1 j=1

2 The Radiosity Equation Finally...

n ‹ The radiosity equation Bi Ai = Ei Ai + ρi ∑ B j Aj Fji ‹ A linear system of n equations in n unknowns: j=1 n ⎡1− ρ1F11 − ρ1F12 − ρ1F1n ⎤⎡B1 ⎤ ⎡E1 ⎤ Aj L ‹ Divide equation by A : Bi = Ei + ρi B j A Fji ⎢ ⎥⎢ ⎥ ⎢ ⎥ Divide equation by Ai: ∑ i − ρ F 1− ρ F B E j=1 ⎢ 2 21 2 22 M ⎥⎢ 2 ⎥ = ⎢ 2 ⎥ n ⎢ M O M ⎥⎢ M ⎥ ⎢ M ⎥ ‹ B = E + ρ B F Apply form-factor reciprocity: i i i ∑ j ij ⎢ − ρ F 1− ρ F ⎥⎢B ⎥ ⎢E ⎥ j=1 ⎣ n n1 L L n nn ⎦⎣ n ⎦ ⎣ n ⎦

‹ We can write this using matrix notation:

⎡B1 ⎤ ⎡E1 ⎤ ⎡ ⎤⎡B1 ⎤ ⎢ ⎥ = ⎢ ⎥ + ⎢ ⎥⎢ ⎥ ⎢ M ⎥ ⎢ M ⎥ ⎢ ⎥⎢ M ⎥ ⎣⎢Bn ⎦⎥ ⎣⎢En ⎦⎥ ⎣⎢ ⎦⎥⎣⎢Bn ⎦⎥

The Radiosity Method Examples:

‹ Take as input a geometric model of the scene, with emission and reflection properties of each surface ‹ Step 1 - Meshing: Discretize input surfaces into a mesh of small elements

‹ Step 2 - Setup: Compute the form factors Fij ‹ Step 3 - Solution: Solve the resulting linear system of equations ‹ Step 4 - Display: Render shaded elements from any desired view point. ‹ These steps are often interleaved in practice.

Examples: Examples:

3 Solving the Equation Progressive Radiosity

‹ The naive approach - Gaussian elimination ‹ While not converged: ‹ Requires O(n2) memory to store the matrix ‹ Select one element in the scene as the current light source ‹ Requires O(n3) time to solve the equation ‹ “Shoot” radiosity from the light source to the rest of the scene ‹ The solution process mimics the physical process of light ‹ A better approach - iterative solution propagation in the scene. ‹ Jacobi iteration ‹ Must take care not to shoot the same light more than once ‹ Gauss-Seidel iteration (keep track of “unshot radiosity”) ‹ Southwell relaxation (known as Progressive Radiosity) B[i] = Unshot[i] = E[i] while (not converged) { ‹ Due to special properties of the radiosity matrix, it is Choose i with largest Unshot[i]*A[i] possible to prove that these iterative methods are guaranteed to converge to the correct solution. Shoot(i) }

Progressive Radiosity Progressive Radiosity

B[i] = Unshot[i] = E[i] ‹ In each iteration the algorithm computes n form factors on while (not converged) { the fly, removing the O(n2) storage complexity. Choose i with largest Unshot[i]*A[i] Shoot(i) } ‹ Choosing the “brightest” shooter at each iteration makes the solution to converge rapidly during the first iterations. Shoot(i): for j = 1..n { ‹ It is possible to display the solution after each iteration, Compute the form factor FF[i,j] resulting in a progressive sequence of images. Delta[j] = ρ[j] FF[i,j] Unshot[i] A[i]/A[j] B[j] += Delta[j] ‹ Typically, there is no need to run until complete convergence. Unshot[j] += Delta[j] The process can be stopped after relatively few iterations. } Unshot[i] = 0

Progressive Radiosity Example: Progressive Radiosity + Ambient 0, 8, 16, 25, 50, 100 iterations 0, 8, 16, 25, 50, 100 iterations

4 Progressive Radiosity with Adaptive Meshing (0,8,16,50,100) Meshing (0,8,16,50,100) Form-Factor Computation

‹ Analytic as well as approximate formulas exist for various configurations. ‹ A closed form expression for a form factor between two polygons (Schroder 93): ‹ extremely complicated formula ‹ does not take into account occlusion ‹ A common approximation is to assume that the inner integral is constant for all locations x in element i: 1 cosθ cosθ F = x y V (x, y)dA dA ij A ∫∫ π r2 x y i xA∈∈Aijy cosθ cosθ ≈ x y V (x, y)dA ∫ π r2 y y∈Aj

Form-Factor Computation Form-Factor Computation

‹ The remaining integral is approximated as a finite sum: cosθ cosθ F ≈ x y V (x, y)dA ij ∫ π r2 y y∈Aj cosθ cosθ ≈ x y V (x, y)ΔA ∑ π r2 y

‹ This approximation works well so long as the elements i and j are well-separated from each other (the distance between them is large relative to their sizes)

Nusselt’’s Method Hemicube

5 6 7