MIT EECS 6.837, Durand and Cutler Global Illumination:RadiosityMIT EECS 6.837, Durand and Cutler Last Time?Shadow Volumes (Stencil Buffer)Shadow MapsProjective Texture Shadows (Texture Mapping)Planar ShadowsMIT EECS 6.837, Durand and Cutler Schedule•No class Tuesday November 11th•Review Session: Tuesday November 18th, 7:30 pm, bring lots of questions!•Quiz 2: Thursday November 20th, in class(two weeks from today)MIT EECS 6.837, Durand and Cutler Today•Why Radiosity–The Cornell Box –Radiosity vs. Ray Tracing•Global Illumination: The Rendering Equation•Radiosity Equation/Matrix•Calculating the Form Factors•Progressive Radiosity•Advanced RadiosityMIT EECS 6.837, Durand and Cutler Why Radiosity?eye•Sculpture by John Ferren•Diffusepanelsphotograph:diagram from above:MIT EECS 6.837, Durand and Cutler Radiosity vs. Ray TracingRay traced image. A standardray tracer cannot simulate theinterreflectionof light between diffuse surfaces.Image rendered with radiosity. note color bleeding effects.Original sculpture by John Ferrenlit by daylight from behind.MIT EECS 6.837, Durand and Cutler The Cornell BoxGoral, Torrance, Greenberg & BattaileModeling the Interaction of Light Between Diffuse SurfacesSIGGRAPH '84photographsimulation Image removed due to copyright considerations.MIT EECS 6.837, Durand and Cutler The Cornell Box2 bouncesdirect illumination (0 bounces)1 bounceCourtesy of MichealCallahan. Used with permission http://www.cs.utah.edu/~shirley/classes/cs684_98/students/callahan/bounce/MIT EECS 6.837, Durand and Cutler The Cornell Box•Careful calibration and measurement allows forcomparison between physical scene & simulationLight Measurement LaboratoryCornell University, Program for Computer Graphics Images removed due to copyright considerations.MIT EECS 6.837, Durand and Cutler Radiosity vs. Ray Tracing•Ray tracing is an image-spacealgorithm–If the camera is moved, we have to start over•Radiosity is computed in object-space–View-independent (just don't move the light)–Can pre-compute complex lighting to allow interactive walkthroughsMIT EECS 6.837, Durand and Cutler Today•Why Radiosity–The Cornell Box –Radiosity vs. Ray Tracing•Global Illumination: The Rendering Equation•Radiosity Equation/Matrix•Calculating the Form Factors•Progressive Radiosity•Advanced RadiosityMIT EECS 6.837, Durand and Cutler The Rendering Equationx'ω'L(x',ω') = E(x',ω')+ ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dAL (x',ω') is the radiance from a point on a surface in a given direction ω'MIT EECS 6.837, Durand and Cutler The Rendering Equationx'ω'L(x',ω') = E(x',ω')+ ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dAE(x',ω') is the emitted radiance from a point: E is non-zero only if x' is emissive (a light source)MIT EECS 6.837, Durand and Cutler The Rendering Equationx'ω'L(x',ω') = E(x',ω')+ ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dASum the contribution from all of the other surfaces in the sceneMIT EECS 6.837, Durand and Cutler The Rendering Equationx'ω'ωxL(x',ω') = E(x',ω')+ ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dAFor each x, compute L(x, ω), the radiance at point x in the direction ω(from x to x') MIT EECS 6.837, Durand and Cutler The Rendering Equationscale the contribution by ρx'(ω,ω'), the reflectivity (BRDF) of the surface at x'x'ω'ωxL(x',ω') = E(x',ω')+ ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dA f q q r n i r fiMIT EECS 6.837, Durand and Cutler The Rendering EquationFor each x, compute V(x,x'), the visibility between x and x': 1 when the surfaces are unobstructed along the direction ω, 0 otherwise x'ω'ωxL(x',ω') = E(x',ω')+ ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x')dAMIT EECS 6.837, Durand and Cutler The Rendering Equationx'ω'ωxL(x',ω') = E(x',ω')+ ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dAFor each x, compute G(x, x'), which describes the on the geometric relationship between the two surfaces at x and x’MIT EECS 6.837, Durand and Cutler Intuition about G(x,x')? •Which arrangement of two surfaces will yield the greatest transfer of light energy? Why?MIT EECS 6.837, Durand and Cutler Today•Why Radiosity–The Cornell Box –Radiosity vs. Ray Tracing•Global Illumination: The Rendering Equation•Radiosity Equation/Matrix•Calculating the Form Factors•Progressive Radiosity•Advanced RadiosityMIT EECS 6.837, Durand and Cutler Radiosity Overview•Surfaces are assumed to be perfectly Lambertian(diffuse)–reflect incident light in all directions with equal intensity•The scene is divided into a set of small areas, or patches. •The radiosity, Bi, of patch iis the total rate of energy leaving a surface. The radiosity over a patch is constant. •Units for radiosity: Watts /steradian* meter2x'ω'MIT EECS 6.837, Durand and Cutler Radiosity EquationL(x',ω') = E(x',ω') + ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dABx'= Ex'+ ρx'∫BxG(x,x')V(x,x')Radiosityassumption: perfectlydiffuse surfaces (notdirectional)MIT EECS 6.837, Durand and Cutler Continuous Radiosity EquationreflectivityformfactorBx'= Ex'+ ρx'∫G(x,x') V(x,x') BxG: geometrytermV: visibilitytermNo analyticalsolution, evenfor simple configurations Image removed due to copyright considerations.MIT EECS 6.837, Durand and Cutler Discrete Radiosity EquationDiscretizethe scene into npatches, over which the radiosity is constantreflectivity∑j=1iρn=+iBiEijFjBformfactor•discreterepresentation•iterativesolution•costlygeometric/visibilitycalculations Image removed due to copyright considerations.MIT EECS 6.837, Durand and Cutler The Radiosity Matrix∑j=1iρn=+iBiEijFjBnsimultaneous equations with nunknown Bivalues can be writtenin matrix form:12nBBB⎡⎤⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎣⎦M12nEEE⎡⎤⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎣⎦M=111112112212221111nnnnnnFFFFFFFρρρρρρρ−−−⎡⎤⎢⎥−−⎢⎥⎢⎥⎢⎥−−⎢⎥⎣⎦LMOLLA solution yields a single radiosity value Bifor each patch in the environment, a view-independent solution.MIT EECS 6.837, Durand and Cutler Solving the Radiosity MatrixThe radiosity of a single patch iis updated for each iteration by gatheringradiositiesfrom all other patches:12121112iiiiiiiiinnnnBBBEBFBEBFFBEBEρρρ⎡⎤⎡⎤⎡⎤⎡⎤⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥=+⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎣⎦⎣⎦⎣⎦⎣⎦MMMMMMLThis method is fundamentally a Gauss-Seidel relaxationMIT EECS 6.837, Durand and Cutler Computing Vertex Radiosities•Biradiosity values are constant over the extent of a patch. •How are they mapped to the vertex radiosities(intensities) needed by the renderer?–Average the radiositiesof patches that contribute to the vertex–Vertices on the edge of a surface are assigned values extrapolation 1 B = (B1 + B2) 2 3 4 12B = max[0, (3B1 + 3B2 -B3 -B4)] orB = (B1 + B2 + B3 + B4) 14 [ Images removed due to copyright considerations.MIT EECS 6.837, Durand and Cutler Today•Why Radiosity–The Cornell Box –Radiosity vs. Ray Tracing•Global Illumination: The Rendering Equation•Radiosity Equation/Matrix•Calculating the Form Factors•Progressive Radiosity•Advanced RadiosityRadiosity Patches are Finite Elements MIT EECS 6.837, Durand and Cutler •We are trying to solve an the rendering equation over the infinite-dimensionalspace of radiosity functions over the scene.•We project the problem onto a finite basisof functions: piecewise constant over patchesAiAjArea-to-area form factorAiAjPoint-to-area form factorMIT EECS 6.837, Durand and Cutler Calculating the Form Factor Fij•Fij= fraction of light energy leaving patch j that arrives at patch i•Takes account of both:–geometry (size, orientation & position) –visibility (are there any occluders?)patch ipatch ipatch ipatch jpatch jpatch jMIT EECS 6.837, Durand and Cutler Remember Diffuse Lighting?SurfaceθidBdAnidAdBθcos=2 4 )()(dkLsdrπωΦ⋅=lnMIT EECS 6.837, Durand and Cutler Calculating the Form Factor Fij•Fij= fraction of light energy leaving patch j that arrives at patch ipatch ipatch jθiθjrFij= ∫∫VijdAjdAicosθicosθjπr21AiAiAjMIT EECS 6.837, Durand and Cutler HemicubeAlgorithm•A hemicubeis constructed around the center of each patch•Faces of the hemicubeare divided into "pixels"•Each patch is projected (rasterized) onto the faces of the hemicube•Each pixel stores its pre-computed form factorThe form factor for a particular patch is just the sum of the pixels it overlaps•Patch occlusions are handled similar to z-buffer rasterizationMIT EECS 6.837, Durand and Cutler Form Factor from Ray Casting•Cast nrays between the two patches–nis typically between 4 and 32–Compute visibility–Integrate the point-to-point form factor•Permits the computation of the patch-to-patch form factor, as opposed to point-to-patchAiAjMIT EECS 6.837, Durand and Cutler Today•Why Radiosity–The Cornell Box –Radiosity vs. Ray Tracing•Global Illumination: The Rendering Equation•Radiosity Equation/Matrix•Calculating the Form Factors•Progressive Radiosity•Advanced RadiosityMIT EECS 6.837, Durand and Cutler Stages in a Radiosity SolutionForm FactorCalculationSolve theRadiosity MatrixInput GeometryVisualization(Rendering)Radiosity SolutionRadiosity ImageReflectance Properties~ 0%< 10%> 90%Calculation & storage of n2form factorsWhy so costly?Camera Position & OrientationMIT EECS 6.837, Durand and Cutler Progressive Refinement•Goal: Provide frequent and timely updates to the user during computation•Key Idea: Update the entire image at every iteration, rather than a single patch•How? Instead of summing the light received by one patch, distribute the radiance of the patch with the most undistributed radiance.MIT EECS 6.837, Durand and Cutler Reordering the Solution for PRShooting:the radiosity of all patches is updated for each iteration:11112222iiinnnniBBFBBFBBBFρρρ⎡⎤⎡⎤⎡⎤⎡⎤⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥=+⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎣⎦⎣⎦⎣⎦⎣⎦MLLLMMMLLMMThis method is fundamentally a SouthwellrelaxationProgressive Refinement w/out Ambient Term MIT EECS 6.837, Durand and Cutler Image removed due to copyright considerations.Progressive Refinement with Ambient Term MIT EECS 6.837, Durand and Cutler Image removed due to copyright considerations.MIT EECS 6.837, Durand and Cutler Today•Why Radiosity•Global Illumination: The Rendering Equation•Radiosity Equation/Matrix•Calculating the Form Factors•Progressive Radiosity•Advanced Radiosity–Adaptive Subdivision–Discontinuity Meshing–Hierarchical Radiosity–Other Basis FunctionsIncreasing the Accuracy of the Solution MIT EECS 6.837, Durand and Cutler •The quality of the image is a function of the size of the patches. •The patches should be adaptively subdividednear shadow boundaries, and other areas with a high radiosity gradient. •Compute a solution on a uniform initial mesh, then refine the mesh in areas that exceed some error tolerance. What’s wrong with this picture? Image removed due to copyright considerations.MIT EECS 6.837, Durand and Cutler Adaptive Subdivision of PatchesCoarse patch solution (145 patches)Improved solution(1021 subpatches) Adaptive subdivision(1306 subpatches) Images removed due to copyright considerations.MIT EECS 6.837, Durand and Cutler Discontinuity Meshing•Limits of umbra and penumbra–Captures nice shadow boundaries–Complex geometric computation–The mesh is getting complexpenumbraumbrasourceblockerMIT EECS 6.837, Durand and Cutler Discontinuity MeshingMIT EECS 6.837, Durand and Cutler Discontinuity Meshing Comparison[Gibson 96]With visibilityskeleton & discontinuitymeshing10 minutes 23 seconds1 hour 57 minutesMIT EECS 6.837, Durand and Cutler Hierarchical Approach•Group elements when the light exchange is not important–Breaks the quadratic complexity–Control non trivial, memory costMIT EECS 6.837, Durand and Cutler Other Basis Functions•Higher order (non constant basis)–Better representation of smooth variations–Problem: radiosity is discontinuous (shadow boundary)•Directional basis–For non-diffuse finite elements–E.g. spherical harmonics Images removed due to copyright considerations.MIT EECS 6.837, Durand and Cutler Next Time:Global Illumination:Monte Carlo Ray TracingHenrikWannJensen Images removed due to copyright considerations.