Global Illuminationand RadiosityOUTLINE:What is Global Illumination?Radiosity MethodsRadiosity EquationsProgressive RadiosityThe Math Behind RadiosityGlobal IlluminationObservation: light comes from other surfaces, not just designated light sources.Goal: simulate interreflection of light in 3-D scenes.Difficulty: you can no longer shade surfaces one at a time, since they’re now interrelated!Two general classes of algorithms:1. ray tracing methods: simulate motion of photons one by one, tracing photon paths either backwards (“eye ray tracing”) or forwards (“light ray tracing”) -- good for specular scenes2. radiosity methods: set up a system of linear equations whose solution is the light distribution -- good for diffuse scenesClassical Radiosity MethodDefinitions:surfaces are divided into elementsradiosity = integral of emitted radiance plus reflected radiance over a hemisphere. units: [power/area]Assumptions:– no participating media (no fog) → shade surfaces only, not vols.– opaque surfaces (no transmission)– reflection and emission are diffuse → radiance is direction-indep., radiance is a function of 2-D surface parameters and λ– reflection and emission are independent of λ within each of several wavelength bands; typically use 3 bands: R,G,B → solve 3 linear systems of equations– radiosity is constant across each element → one RGB radiosity per elementTypically (but not exclusively):– surfaces are polygons, elements are quadrilaterals or trianglesThe Unit of RadiosityRadiance (a.k.a. intensity) is power from/to an area in a given direction.units: power / (area × solid angle)Radiosity is outgoing power per unit area due to emission or reflection over a hemisphere of directions.units: power / arearadiosity = radiance × integral of [cos(polar angle) × d(solid angle)] over a hemisphere = π × radianceSo radiosity and radiance are linearly interrelated.Thus, “radiosity” is both a unit of light and an algorithm.Radiant emitted flux density is the unit for light emission.units: power / areaDeriving Radiosity Equations, 1 Let = area of element (computable) = radiant emitted flux density of element (given) = reflectance of element (given) = radiosity of element (unknown) = form factor from to = fraction of power leaving that arrives at (computable)So the equation above can be rewritten : AieiibiFij ijAb Ae F Abiiiiijii ii i jijnjjρρ=+=∑1outgoingpowerof elem i =poweremittedby elem i +powerreflectedby elem i outgoingpowerof elem i =poweremittedby elem i +reflectanceof elem i ×fraction of powerleaving elem j thatarrives at elem i elem j∑×outgoingpowerof elem j Form FactorsDefine the form factor Fij to be the fraction of light leaving element i that arrives at element jWherevij is a boolean visibility function: 0 if point on i is occluded with respect to point on j, 1 if unoccluded.This is a double area integral. Difficult! We end up approximating it.dAi and dAj are infinitesimal areas on elements i and j, respectivelyθi and θj are polar angles: the angles between ray and normals on elements i and j, respectivelyProjected area of dAi from j is cos θi dAi, hence the cosinesr is distance from point on i to point on jReciprocity law: AiFij = AjFji.FrvdAdAijAijij j iAAiji=∫∫12cos cosθθπDeriving Radiosity Equations, 2 Earlier, we had : Dividing by : By the reciprocity law, , so for all elems Or, in matrix/vector notation : where is the vector of unknown radiosities, is the vector of known emissions,and Ab Ae F AbAbe FAAbFAA F b e Fb iii ii i jijnjjiiii jijnjijji j i ij i i i ijjnj=+=+==+===∑∑∑ρρρ111(/)b=e+KbbeK is a square matrix of reflectance times form factor is a square matrix of reflectance times form factor : Subtracting from both sides, we get , or where is an identity matrix.This is a linear system of equations in unknowns (the ).There are three such systems of equations, one for the red channel, one forgreen, and one for blue. The variables , , and are RGB vectors.KFnn bebij i ijiii i=ρρKb b- Kb = e(I - K)b = eIComputing Visibility for Form FactorsComputing visibility in the form factor integral is like solving a hidden surface problem from the point of view of each surface in the scene.Two methods:ray tracing: easy to implement, but can be slow without spatial subdiv.hemicube: exploit speed of z-buffer algorithm, compute visibility between one element and all other elements. Good when you have z-buffer hardware, but some tricky issues regarding hemicube resolutionYou end up approximating the double area integral with a double summation, just like numerical methods for approximating integrals.When two elements are known to be inter-visible (no occluders), you can use analytic form factor formulas and skip all this.Two Radiosity AlgorithmsMatrix radiosity: Compute form factors and store the matrix I-K, solve system of equations, then display.Solving can be done in several ways (Successive Overrelaxation, Gauss-Seidel, Conjugate Gradient, ...)Time and memory cost: O(n2), where n=#elements.n is commonly many thousand, so the memory cost is excessive.Progressive radiosity: Solves system of equations incrementally as matrix of form factors is computed, one column at a time. Partial solutions can be displayed, yielding progressive refinement of image.Time cost: O(ns) where s=#shooting stepsMemory cost: O(n)This is much more commonly used.Progressive Radiosity, Intuitively• Turn hemicube around so that you’re shooting light out to other elements, not gathering it in from other elements.• Shoot from light sources initially, then shoot from reflective surfaces in decreasing order of brightness, treating reflective surfaces as secondary light sources, like repeated application of a shadow algorithm.• Display an approximate picture as you go (optional).• Converges to correct solution in the limit as you shoot an infinite number of times, and hopefully it will reach an acceptable approximation very quickly.• If you stop after only lights have “shot”, you’ve simulated shadows only, not interreflection.Progressive Radiosity Algorithmgenerate mesh by subdividing polygons into elementsfor
View Full Document