CS 428: Fall 2009 Introduction to Computer Graphics Radiosity 12/7/2009 1
Problems with diffuse lighting A Daylight Experiment, John Ferren 12/7/2009 2
Problems with diffuse lighting 12/7/2009 3
Direct lighting 12/7/2009 4
Global lighting 12/7/2009 5
Cornell box Photography Simulation Goral, Torrance, Greenberg & Battaile Modeling the Interaction of Light Between Diffuse Surfaces SIGGRAPH '84 12/7/2009 6
Cornell box Calibration and measurement allows comparisons between reality and simulation Light Measurement Laboratory Cornell University, Program for Computer Graphics 12/7/2009 7
The rendering equation ω' x' L(x',ω') = E(x',ω') + ρ x '(ω,ω')l(x,ω)g(x,x')v(x,x') da L (x',ω') is the radiance from point x in direction of ω' Radiance is measured in [W/(m 2 sr)] http://en.wikipedia.org/wiki/radiance 12/7/2009 8
The rendering equation ω' x' L(x',ω') = E(x',ω') + ρ x '(ω,ω')l(x,ω)g(x,x')v(x,x') da E(x',ω') is the emitted radiance: E is greater zero for light sources 12/7/2009 9
The rendering equation ω' x' L(x',ω') = E(x',ω') + ρ x '(ω,ω')l(x,ω)g(x,x')v(x,x') da Sum of contributions from all other scene elements to the radiance from point x in direction of ω' 12/7/2009 10
The rendering equation ω' ω x x' L(x',ω') = E(x',ω') + ρ x '(ω,ω')l(x,ω)g(x,x')v(x,x') da For every x, compute L(x, ω),the radiance in point x in direction ω(from x to x') 12/7/2009 11
The rendering equation ω' ω x x' L(x',ω') = E(x',ω') + ρ x '(ω,ω')l(x,ω)g(x,x')v(x,x') da The contribution is scaled by ρ x' (ω,ω') (the BRDF in x ) 12/7/2009 12
The rendering equation ω' ω x Forevery x, determine V(x,x'), the visibility from x relative to x': 1 if there is no occlusion in direction ω, 0 otherwise x' L(x',ω') = E(x',ω') + ρ x '(ω,ω')l(x,ω)g(x,x')v(x,x') da 12/7/2009 13
The rendering equation ω' ω x x' L(x',ω') = E(x',ω') + ρ x '(ω,ω')l(x,ω)g(x,x')v(x,x') da For every x, compute G(x, x'), the geometry term w.r.t. x and x 12/7/2009 14
G(x,x')? Which constellation leads to a large exchange of light and why? 12/7/2009 15
The radiosityassumptions Surfaces are Lambertian (perfectly diffuse) Reflection occurs in all directions The scene is split into small surface elements The radiosityb i, is the total radiositythat comes from element i For each element, the radiosity is constant 12/7/2009 16 ω' x'
The radiosityequation L(x',ω') = E(x',ω') + ρ x '(ω,ω')l(x,ω)g(x,x')v(x,x') da Radiosityassumption: Perfectly diffuse surfaces no directional dependency B x' = E x' + ρ x' B x G(x,x')V(x,x') x' x' x' x 12/7/2009 17
The radiosityequation Continuous radiosity equation Reflection factor B x' = E x' + ρ x' G(x,x') V(x,x') B x Form factor G: geometry term V: visibility term Properties No analytical solution, even for simple scenes x x 12/7/2009 18
The radiosityequation Discretize into elements with const. radiosity Reflection factor B i = E + ρ i i Fij B j n j=1 A j Properties Iterative solution Form factor Expensive geometry computations 12/7/2009 19 A i
B i = E i + ρ i j=1 The radiositymatrix n linear equations in n unknowns B i : n F ij B j The solution of this LSE results in B i, which are independent of viewer position and direction 12/7/2009 20
The radiositymatrix Iterative solution The radiosity of an element is replaced by the multiplication of a row with the current solution vector (Gathering) (= Gauss-Seidel iteration) 12/7/2009 21
Rendering the radiositysolution B i are constant per Element How to map to graphics hardware? Average radiosityvalues foreach vertex Extrapolate for vertices on the boundary 12/7/2009 22
Form factors F ij = Part of radiance from jthat reaches i Influenced by: Geometry (area, orientation, position) Visibility (other elements of the scene) patch j patch j patch j patch i patch i patch i 12/7/2009 23
Form factors F ij = Part of radiance from jthat reaches i patch j θ i r θ j patch i 1 cos θ i cos θ j F ij = V ij da j da π r 2 i A i A i A j 12/7/2009 24
Form factors Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point form factors Determines form factors between elements A j A i 12/7/2009 25
Form factors Nusselt analog: the form factor is equivalent to the part of the unit circle, which the projection of the element occupies on the unit sphere A j A j r = 1 da i F dai,a j 12/7/2009 26
Form factors Hemicube algorithm Place hemicube at element center Discretize the sides into pixels Project and rasterize other elements into cube Each hemicubepixel contains precomputedform factor Form factor for an element is the sum of contributions Visibility by depth buffer 12/7/2009 27
Solving the radiosityequation Geometry Form factor computation > 90% O(n 2 ) form factors Reflection properties Iterative solution of the LSE < 10% Camera position & orientation Radiosity solution Visualization (Rendering) ~ 0% Radiosity Image 12/7/2009 28
Progressive refinement Idea: instead of collecting radiosityfrom all sources ( gathering ), rather distribute radiosity from brightest emitters ( shooting ) 12/7/2009 29
Progressive refinement B B L ρ F B B L ρ F M M = + M M B B L ρ F 1 1 1 1i 2 2 2 2i n n n ni L M Bi M L 12/7/2009 30
Progressive refinement Each patch has remaining radiosity B i Start with B i =E i and B i = E i Distribute B i to the scene Reciprocity: B = E + r B F, für for alle i i i i j i j j= 1 A F = A F j ji i ij n A B = E + r B F A i i i j ji j= 1 n j i 12/7/2009 31
Progressive refinement After sending from patch j, the radiosity of elements A i is increased Aj Bi = Bi + ri BjFji, i= 1.. n A The nondisributed radiosity is also increased The set undistributed radiosity of j to zero A i Aj Bi = Bi + ri BjFji, i= 1.. n A B i = 0 i 12/7/2009 32
Progressive refinement Advantages Each iteration only requires form factors F ij for element i w.r.t. all other patches Good results after few iterations, resulting in significantly less overhead when compared to Gauss-Seidel iterations Only requires storing a single column of the form factor matrix 12/7/2009 33
Progressive refinement Without ambient term 12/7/2009 34
Progressive refinement With ambient term 12/7/2009 35
Discretizationinto patches Image quality depends on the size of patches Smaller patches smaller error Patches should be adaptively subdivided where large gradients in radiosity are evident Start with regular grid Subdivide based on quality criterion 12/7/2009 36
Discretizationinto patches 12/7/2009 37
Photon Mapping Jensen 95 12/7/2009 38
Examples Lightscape http://www.lightscape.com 12/7/2009 39
Examples Mental Ray 12/7/2009 40