sr)] 2 ena in a scene made of ideal illumination algorithm capable in ray-traced images? ] ] 2 2

Radiosity Indirect illumination effects Color bleeding Soft shadows Image Synthesis, and Realistic Cohen and Wallace, Radiosity Academic Press Professional 1993. Morgan- Illumination, and Puech, Radiosity Global Sillion Kaufmann, 1994. Radiometric quantities ‹ ‹ ‹ ‹ ‹ Motivation: what is missing Radiosity is a physically-based of simulating the above phenom diffuse surfaces. Books: [J] Radiant power (): radiant energy per second [W] (flux density): incident radiant power per [W/m unit area Radiosity (flux density): outgoing radiant power per [W/m unit area (angular flux density): radiant power per unit projected area per solid angle [W/(m ‹ ‹ ‹ ‹ ‹ ‹ ‹ ‹

Radiosity

Radiosity in a Nutshell Break surfaces into many small elements of equations Formulate and solve a linear system that models the equilibrium of inter-reflected in a scene. The solution gives us the amount of light leaving each point on surface in the scene. Once solution is computed, the shaded elements can be quickly rendered from any viewpoint. ‹ ‹ ‹ ‹ φ φ d d

θ θ d d θ θ i sin A sin 2 i of a point on the ji r = E F = i j 2 ji A ) r ,θ,φ) A dA i F j r φ j ( B = d B A j 1 = θ ω n j B ∑ d i j sin ρ ∑ r i +

)( ρ i

θ A i d E r ( = = i A i dA B

Solid Angles (2) The Radiosity Equation (2) ( of element i)*(the total incoming flux) total incoming flux = sum of contributions from all other elements in the scene ‹ ‹ Consider the spherical coordinates Differential solid angle: Total flux leaving element i: Total flux emitted by element i: Total reflected flux: The full radiosity is then: equation sphere. What is the area of a differential surface element at this point? ‹ ‹ ‹ ‹ ‹ ‹ in the

i ctions is an arc, whose size ctions is an area on the as the total hemispherical ) leaving a surface. small elements. 2

n

radiosity B total flux = emitted + reflected sphere, whose size corresponds to a solid angle; directions are points on the unit circle; a simply connected set of dire directions are points on the unit sphere; a simply connected set of dire solid angles are measured in . Solid Angles (1) corresponds to an angle [radians]; The Radiosity Equation (1) ‹ ‹ ‹ ‹ ‹ When defining various radiometric quantities, we need to be able quantify sets of directions. In 2D: In 3D: Assume that surfaces in the scene have been discretized into Assume that each element emits/reflects light uniformly across its surface. Define the Let’s write down an expression describing the total flux (light power) leaving element flux density (W/m scene: ‹ ‹ ‹ ‹ ‹ ‹ ‹ ⎤ ⎥ ⎥ ⎥ ⎥ ⎦ 2 n 1 M E E E ⎡ ⎢ ⎢ ⎢ ⎢ ⎣ = ⎤ ⎥ ⎥ ⎥ ⎥ ⎦ 2 n 1 M B B B ⎡ ⎢ ⎢ ⎢ ⎢ ⎣ ⎤ ⎥ ⎥ ⎥ ⎥ ⎦ nn n 1 F F n 1 M M ρ ρ − − ik 1 1 F ji = + F ij j ij L O L F F A 1 = n = j = ∑ 22 ) 12 ij F k F 2 F ∪ 1 j i

ρ L ( ρ A i − F − 1 1 11 n 21 F F F 1 2 n ρ M ρ ρ − − − 1 ⎡ ⎣ Properties of Form Factors Finally... ⎢ ⎢ ⎢ ⎢ Reciprocity: Additivity: Conservation of energy in a closed environment: A linear system of n equations in unknowns: ‹ ‹ ‹ ‹ ij F j ji B 1 F = j n j ∑ ji A i j y

F ρ B j i A + A 1 dA = n i j j x ∑ E i B ⎤ ⎥ ⎥ ⎥ ⎦ dA ρ 1 = = n n 1 ) j i M ∑ + y B B i i B , ρ ⎡ ⎢ ⎢ ⎢ ⎣ A x ⎤ ⎥ ⎥ ⎥ ⎦ i ( + E i V E = y i

θ 2 = A i i y B B cos ⎡ ⎢ ⎢ ⎢ ⎣ − x + x θ ⎤ ⎥ ⎥ ⎥ ⎦ : i n 1

tells us how much of the flux π M E E ji cos ⎡ ⎢ ⎢ ⎢ ⎣ F = y ⎤ ⎥ ⎥ ⎥ ⎦ ij A n 1 ∫∫ M ∈∈ B xA B i ⎡ ⎢ ⎢ ⎢ ⎣ 1 A = ij F

The Form Factor The Radiosity Equation (3) The form factor The radiosity equation Divide equation by A Apply form-factor reciprocity: We can write this using matrix notation: leaving element j actually reaches i. ‹ ‹ ‹ ‹ ‹ Examples: Examples: ij

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 - Compute the form factors F Setup: Step 3 - Solve the resulting linear Solution: system of equations Step 4 - Display: Render shaded elements from any desired view point. These steps are often interleaved in practice. ‹ ‹ ‹ ‹ ‹ ‹ ⎞ ⎟ ⎟ ⎠ ) 1 − k i j ( E B ij = ) M 0 ( i i N = B j − ) k ent is “gathering”, in turn, j ( B strictly diagonally dominant. to converge from any initial ij M 11 1 =+ − j i ∑∑ − i E [j] FF[i,j] Unshot[i] A[i]/A[j] ⎛ ⎜ ⎜ ⎝ ρ ii 1 M = ) k ( i Choose i with largest Unshot[i]*A[i] Shoot(i) B B[i] = Unshot[i] E[i] while (not converged) { } Gauss-Seidel Iteration Progressive Radiosity (2) Compute the form factor FF[i,j] Delta[j] = B[j] += Delta[j] Unshot[j] += Delta[j] Start with an initial guess: for all i Repeatedly compute the radiosities to the according following formula: The physical analogy: Each elem light from all other elements. This iteration is guaranteed guess, because the matrix is for j = 1..n { } Unshot[i] = 0 Shoot(i): ‹ ‹ ‹ ‹ e same light more than once e physical process of light ese iterative methods are ) memory to store the matrix ) time to solve the equation 2 3 Choose i with largest Unshot[i]*A[i] Shoot(i) B[i] = Unshot[i] E[i] while (not converged) { } Solving the Equation Requires O(n Requires O(n Jacobi iteration Gauss-Seidel iteration Southwell relaxation (known as Progressive Radiosity) Progressive Radiosity (1) Select one element in the scene as current light source “Shoot” radiosity from the light source to rest of scene ‹ ‹ ‹ ‹ ‹ ‹ ‹ The naive approach - Gaussian elimination A better approach - solution iterative Due to special properties of the radiosity matrix, it is possible to prove that th guaranteed to converge the correct solution. While not converged: The solution process mimics th propagation in the scene. Must take care not to shoot th (keep track of “unshot radiosity”) ‹ ‹ ‹ ‹ ‹ ‹ Progressive Radiosity Example: 0, 8, 16, 25, 50, 100 iterations 0, 8, 16, 25, 50, 100 iterations Progressive Radiosity + Ambient i i A A ave ρ 1 ∑ ∑ − 1 ) i i A = A i i ρ K + ∑ = 3 ave

ρ Unshot ave +

ρ ∑ ( 2 ave R ρ = + ave r relatively few iterations. ρ y during the first iterations. run until complete convergence. + 1 solution after each iteration, Ambient = ) storage complexity. 2 R e sequence of images.

Progressive Radiosity (3) The Ambient Correction In each iteration the algorithm computes n form factors on the fly, removing O(n Choosing the “brightest” at each iteration makes shooter the solution to converge rapidl It is possible to display the Typically, there is no need to The process can be stopped afte In order to avoid too dark an image during the first PR iterations, an ambient correction term is used. Compute the average reflectivity in scene: Define the “overall reflection factor” as: At each iteration the ambient term is set to: resulting in a progressiv ‹ ‹ ‹ ‹ ‹ ‹ ‹ ‹ y y A dA ∆ ) ) y y , , x x ( ( V V y y θ θ 2 pproximated as a finite sum: 2 cos r cos r x π x θ π θ cos from each other (the distance between cos j A ∫ ∈ ∑ y ≈ ≈ ij

Meshing (0,8,16,50,100) F

well-separated Form-Factor Computation (2) Progressive Radiosity with Adaptive them is large relative to their sizes) The remaining integral is a This approximation works well so long as the elements i and j are ‹ ‹ y dA x dA ) y y , x dA ( ) V y y ,

θ x ( 2 V cos r y x π θ θ 2 cos r cos x π θ y ij A cos ∫∫ ∈∈ j xA A i ∫ ∈ 1 y A ≈ = ij F

Adaptive Mesh Refinement Form-Factor Computation (1) extremely complicated formula does not take into account occlusion ‹ ‹ Start with a coarse mesh of elements. During the solution process, subdivide regions in which the radiosity is above a certain gradient threshold. Advantage: creates more elements only where necessary. Disadvantage: might miss important features altogether. Analytic as well approximate formulas exist for various configurations. A closed form expression for a factor between two polygons (Schroeder 93): A common approximation is to assume that the inner integral is constant for all locations x in element i: ‹ ‹ ‹ ‹ ‹ ‹ ‹ (Cohen - 85) Greenberg

The Hemi-Cube Algorithm

Nusselt’s Analogue