CSCE 641 Computer Graphics: Radiosity Jinxiang Chai Rendering: Illumination Computing Direct (local) illumination Light directly from light sources No shadows Indirect (global) illumination Transparent, reflective surfaces, and hard shadows (Ray tracing) Diffuse interreflections, color bleeding, and soft shadow (radiosity) Rendering: Illumination Computing Direct (local) illumination Light directly from light sources No shadows Indirect (global) illumination Transparent, reflective surfaces, and hard shadows (Ray tracing) Diffuse interreflections, color bleeding, and soft shadow (radiosity) Review: Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) Review: Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) Review: Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) Review: Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) - transparent ray (light passing through an object) Review: Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) - transparent ray (light passing through an object) Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) - transparent ray (light passing through an object) Pros and Cons of Ray Tracing Advantages of ray tracing All the advantages of the local illumination model Also handles shadows, reflection, and refraction Disadvantages of ray tracing Computational expense No diffuse inter-reflection between surfaces (i.e., color bleeding) Not physically accurate Radiosity handles these shortcomings for diffuse surfaces! Radiosity vs. Local Illumination Radiosity Physical Image vs. Radiosity Rendering Radiostiy Definition: The radiant (luminous) exitance is the radiant flux/power per unit area leaving a surface. d o M ( x) dA W lm m2 m2 lux Radiosity Model light effects by considering the physical laws governing the radiant energy transfer; The radiosity model computes radiant-energy interactions between all the surfaces in a scene Radiosity: Key Idea #1 Diffuse Surface Radiosity: Key Idea #2 Constant Surface Approximation Radiosity Equation N Radiosityi Radiosityself ,i a j i Radiosityj j 1 Radiosity Equation N Radiosity1 Radiosityself ,1 a j 1Radiosityj j 1 N Radiosity2 Radiosityself , 2 a j 2 Radiosityj j 1 N RadiosityN Radiosityself , N a j N Radiosityj j 1 Radiosity Algorithm Energy Conservation Equation N i e ,i i j F ( j i ) j 1 Energy Conservation Equation N i e ,i i j F ( j i ) j 1 The total rate of radiant energy leaving surface i per unit square Energy Conservation Equation N i e ,i i j F ( j i ) j 1 The rate of energy emitted from surface i per unit area - zero if surface i is not a light source Energy Conservation Equation N i e ,i i j F ( j i ) j 1 Reflectivity factor Percent of incident light that is reflected in all directions Energy Conservation Equation N i e ,i i j F ( j i ) j 1 Form factor Fractional amount of radiant energy from surface j that reaches surface i Compute Form Factors 1 F ( j i) Aj Ai , A j cos x cos y r 2 xy V ( x, y ) dAi dA j The form factor specifies the fraction of the energy leaving one patch and arriving at the other. In other words, it is an expression of radiant exchange between two surface patches! Compute Form Factors 1 F ( j i) Aj Ai , A j cos x cos y r 2 xy V ( x, y ) dAi dA j Radiant energy reaching Ax from Ay Radiant energy leaving Ay in all directions The form factor specifies the fraction of the energy leaving one patch and arriving at the other. In other words, it is an expression of radiant exchange between two surface patches! Form Factor: Reciprocity 1 F ( j i) Aj 1 F (i j ) Ai Ai , A j Ai , A j cos x cos y r 2 xy cos x cos y r 2 xy V ( x, y ) dAx dAy V ( x, y ) dAy dAx F (i j) Ai F ( j i) Aj Radiosity Equation Radiosity for each polygon N i : i e,i i j F ( j i) j 1 Linear system: - i : radiosity of patch I (unknown) - e,i : emission of patch I (known) - i : reflectivity of patch I (known) - Fi j : form-factor (known) Linear System 1 1 F11 1 F12 F 1 2 F22 2 21 ... ... N FN 1 N FN 2 A 1 F1 N 1 e,1 ... 2 F2 N 2 e, 2 ... ... ... ... ... 1 N FN N N e,3 ... X = B Radiosity Algorithm Form Factors for Infinitesimal Surfaces • Visibility - if not visible, receive zero power F ( j i) cos x cos y r 2 xy dAiV ( x, y) Form Factors for Subdivided Patches • Visibility 1 F ( j i) - if not visible, receive zero Aj power Ai , A j cos x cos y r 2 xy V ( x, y ) dAi dA j Form Factor: How to compute? Closed Form - analytical Hemicube Form Factor: Analytical 1 F ( j i) Aj Ai , A j cos x cos y r 2 xy V ( x, y ) dAx dAy Form Factor: How to compute? Closed Form - analytical Hemicube Form Factor: Nusselt Analog Nusselt developed a geometric analog which allows the simple and accurate calculation of the form factor between a surface and a point on a second surface. 3D diagram Form Factor: Nusselt Analog The form factor is, then, the area projected on the base of the hemisphere divided by the area of the base of the hemisphere, or (A/B) A B 2D diagram Form Factor: Nusselt Analog Form Factor: Nusselt Analog So how can we use Nusselt Analog to compute the form factor? Form Factor: Nusselt Analog So how can we use Nusselt Analog to compute the form factor? - answer: precomputing Form Factor: HemiCube Form Factor: HemiCube • Project path on hemicube • Add hemicube cells to compute form factors A B 2D diagram Precomputing Form Factor How to calculate the form factor for each cell? Delta Form Factor: Top Face Top of hemicube Delta Form Factors: Side Faces Side of hemicube The Hemicube in Action Form Factors: HemiCube Form Factors Radiosity Algorithm How to Solve Linear System? Matrix conversion Iterative approaches - Jacobian (gathering) - Gauss-Seidel (gathering) - progressive refinement (shooting) Matrix Conversion 1 1 1 F11 1 F12 F 1 2 F22 2 21 2 ... ... ... N N FN 1 N FN 2 ... 1 F1 N ... 2 F2 N ... ... ... 1 N FN N - Computational cost: O(N3) - Very slow for a large set of polygons 1 e,1 e, 2 ... e,3 Iterative Approaches N i e ,i i j F ( j i ) j 1 Jacobian Iterations For all patches i, i=1,…,N, i0 e,i While not converged: for all patches i=1,…,N N iter i 1 e,i i iter F ( j i) j j 1 Jacobian Iterations For all patches i, i=1,…,N, i0 e,i While not converged: for all patches i=1,…,N N iter i 1 e,i i iter F ( j i) j j 1 Update of one patch requires evaluation of N Form Factors What’s the computational cost? Successive Approximation Le K Le Le Le K Le K K Le Le K 2 Le K K K Le Le K 3 Le Rendering - The final Φi's can be used in place of intensities in a standard renderer (Gouraud, per-veretx shading) - Radiosities are constant over the extent of a patch - A standard renderer requires vertex intensities (or radiosities) - If the radiosities of surrounding patches are know, vertex radiosities can be estimated using bilinear interpolation Vertex Intensity: Bilinear Interpolation Consolation Room Theatre Steel Mills Radiosity: Benefit Global illumination method: modeling diffuse interreflection Color bleeding: a red wall next to a white one casts a reddish glow on the white wall near the corner Soft shadows – an “area” light source casts a soft shadow from a polygon No ambient term hack, so when you want to look at your object in low light, you don’t have to adjust parameters of the objects – just the intensities of the lights! View independent: it assigns a brightness to every surface Radiosity: Limitation Radiation is uniform in all directions Radiosity is piecewise constant – usual renderings make this assumption, but then interpolate cheaply to fake a nice-looking answer – this introduces quantifiable errors No surface is transparent or translucent Reflectivity is independent of directions to source and destination