Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 445 / 645 Introduction to Computer Graphics Lecture 16 Radiosity Radiosity.

Similar presentations


Presentation on theme: "CS 445 / 645 Introduction to Computer Graphics Lecture 16 Radiosity Radiosity."— Presentation transcript:

1 CS 445 / 645 Introduction to Computer Graphics Lecture 16 Radiosity Radiosity

2 Global Illumination Global Illumination (Angel Ch. 13) The notion that a point is illuminated by more than light from local lights; it is illuminated by all the emitters and reflectors in the global sceneThe notion that a point is illuminated by more than light from local lights; it is illuminated by all the emitters and reflectors in the global scene –Ray Tracing –Radiosity Global Illumination (Angel Ch. 13) The notion that a point is illuminated by more than light from local lights; it is illuminated by all the emitters and reflectors in the global sceneThe notion that a point is illuminated by more than light from local lights; it is illuminated by all the emitters and reflectors in the global scene –Ray Tracing –Radiosity

3 The ‘Rendering Equation’ Jim Kajiya (Current head of Microsoft Research) developed this in 1986 I(x, x’) is the total intensity from point x’ to x g(x, x’) = 0 when x/x’ are occluded and 1/d 2 otherwise (d = distance between x and x’)  (x, x’) is the intensity emitted by x’ to x  (x, x’,x’’) is the intensity of light reflected from x’’ to x through x’ S is all points on all surfaces Jim Kajiya (Current head of Microsoft Research) developed this in 1986 I(x, x’) is the total intensity from point x’ to x g(x, x’) = 0 when x/x’ are occluded and 1/d 2 otherwise (d = distance between x and x’)  (x, x’) is the intensity emitted by x’ to x  (x, x’,x’’) is the intensity of light reflected from x’’ to x through x’ S is all points on all surfaces

4 Recursive Ray Tracing Cast a ray from the viewer’s eye through each pixel Compute intersection of this ray with objects from scene Closest intersecting object determines color Cast a ray from the viewer’s eye through each pixel Compute intersection of this ray with objects from scene Closest intersecting object determines color

5 Recursive Ray Tracing For each ray cast from eyepoint If surface is struckIf surface is struck –Cast ray to each light source (shadow ray) –Cast reflected ray (feeler ray) –Cast transmitted ray (feeler ray) –Perform Phong lighting on all incoming light Note diffuse component of Phong lighting is not pushed through the systemNote diffuse component of Phong lighting is not pushed through the system For each ray cast from eyepoint If surface is struckIf surface is struck –Cast ray to each light source (shadow ray) –Cast reflected ray (feeler ray) –Cast transmitted ray (feeler ray) –Perform Phong lighting on all incoming light Note diffuse component of Phong lighting is not pushed through the systemNote diffuse component of Phong lighting is not pushed through the system

6 Recursive Ray Tracing Computing all shadow and feeler rays is slow Stop after fixed number of iterationsStop after fixed number of iterations Stop when energy contributed is below thresholdStop when energy contributed is below threshold Most work is spent testing ray/plane intersections Use bounding boxes to reduce comparisonsUse bounding boxes to reduce comparisons Use bounding volumes to group objectsUse bounding volumes to group objects Parallel computation (on shared-memory machines)Parallel computation (on shared-memory machines) Computing all shadow and feeler rays is slow Stop after fixed number of iterationsStop after fixed number of iterations Stop when energy contributed is below thresholdStop when energy contributed is below threshold Most work is spent testing ray/plane intersections Use bounding boxes to reduce comparisonsUse bounding boxes to reduce comparisons Use bounding volumes to group objectsUse bounding volumes to group objects Parallel computation (on shared-memory machines)Parallel computation (on shared-memory machines)

7 Recursive Ray Tracing Just a Sampling Method We’d like to cast infinite rays and combine illumination results to generate pixel valuesWe’d like to cast infinite rays and combine illumination results to generate pixel values Instead, we use pixel locations to guide ray castingInstead, we use pixel locations to guide ray castingProblems? Just a Sampling Method We’d like to cast infinite rays and combine illumination results to generate pixel valuesWe’d like to cast infinite rays and combine illumination results to generate pixel values Instead, we use pixel locations to guide ray castingInstead, we use pixel locations to guide ray castingProblems?

8 Problems With Ray Tracing AliasingAliasing –Supersampling –Stochastic Sampling –Examples on board Works best on specular surfaces (not diffuse)Works best on specular surfaces (not diffuse) –For perfectly specular surfaces  Ray tracing == rendering equation (subject to aliasing) AliasingAliasing –Supersampling –Stochastic Sampling –Examples on board Works best on specular surfaces (not diffuse)Works best on specular surfaces (not diffuse) –For perfectly specular surfaces  Ray tracing == rendering equation (subject to aliasing)

9 Radiosity Ray tracing models specular reflection and refractive transparency, but still uses an ambient term to account for other lighting effects Radiosity is the rate at which energy is emitted or reflected by a surface By conserving light energy in a volume, these radiosity effects can be traced Ray tracing models specular reflection and refractive transparency, but still uses an ambient term to account for other lighting effects Radiosity is the rate at which energy is emitted or reflected by a surface By conserving light energy in a volume, these radiosity effects can be traced

10 Radiosity All surfaces are assumed perfectly diffuse What does that mean about property of lighting in scene?What does that mean about property of lighting in scene? All surfaces are assumed perfectly diffuse What does that mean about property of lighting in scene?What does that mean about property of lighting in scene? –Light is reflected equally in all directions Same lighting independent of viewing angle / locationSame lighting independent of viewing angle / location –Only a subset of the Rendering Equation Diffuse-diffuse surface lighting effects possible Same lighting independent of viewing angle / locationSame lighting independent of viewing angle / location –Only a subset of the Rendering Equation Diffuse-diffuse surface lighting effects possible

11 Radiosity Equation Radiosity of patch ‘i’ is  i is the rate at which light is emitted (watts/m 2 )  i is patch i’s reflectivity F j,i is the form factor fraction of patch j that reaches patch i as determined by orientation of both patches and obstructionsfraction of patch j that reaches patch i as determined by orientation of both patches and obstructions Use A j /A i (Area of patch j / Area of patch I) to scale units to total light emitted by j as received per unit area by i Radiosity of patch ‘i’ is  i is the rate at which light is emitted (watts/m 2 )  i is patch i’s reflectivity F j,i is the form factor fraction of patch j that reaches patch i as determined by orientation of both patches and obstructionsfraction of patch j that reaches patch i as determined by orientation of both patches and obstructions Use A j /A i (Area of patch j / Area of patch I) to scale units to total light emitted by j as received per unit area by i

12 Radiosity Equation As n becomes large, summation becomes integral Radiosity equation then == Rendering equation All surfaces are perfectly diffuseAll surfaces are perfectly diffuse As n becomes large, summation becomes integral Radiosity equation then == Rendering equation All surfaces are perfectly diffuseAll surfaces are perfectly diffuse

13 Solving for all Patches One patch defined by: Symmetry: A i F i,j = A j F j,I Therefore: One patch defined by: Symmetry: A i F i,j = A j F j,I Therefore:

14 Solving for all Patches Putting into matrix form b = e – RFbb = e – RFb b = [I – RF] -1 eb = [I – RF] -1 e Use matrix algebra to solve for B i ’s Putting into matrix form b = e – RFbb = e – RFb b = [I – RF] -1 eb = [I – RF] -1 e Use matrix algebra to solve for B i ’s

15 Solving for all Patches Difficult to perform Gaussian Illumination and solve for b (size of F is large but sparse – why?) Instead, iterate: b k+1 = e – RFb k Multiplication of sparse matrix is O(n), not O(n 2 )Multiplication of sparse matrix is O(n), not O(n 2 ) Stop when b k+1 = b kStop when b k+1 = b k Difficult to perform Gaussian Illumination and solve for b (size of F is large but sparse – why?) Instead, iterate: b k+1 = e – RFb k Multiplication of sparse matrix is O(n), not O(n 2 )Multiplication of sparse matrix is O(n), not O(n 2 ) Stop when b k+1 = b kStop when b k+1 = b k

16 Solving for all Patches Alternative solution We know:We know: Therfore:Therfore: And solution for b is:And solution for b is: Alternative solution We know:We know: Therfore:Therfore: And solution for b is:And solution for b is:

17 Form Factors Compute n-by-n matrix of form factors to store radiosity relationships between each light patch and every other light patch H ij = 1 or 0 depending on occlusion

18 Form Factor – Another example Spherical projections to model form factor project polygon A j on unit hemisphere centered at (and tangent to) A iproject polygon A j on unit hemisphere centered at (and tangent to) A i –Contributes cos  j / r 2 Project this projection to base of hemisphereProject this projection to base of hemisphere –Contributes cos  i Divide this area by area of circle baseDivide this area by area of circle base –Contributes    Spherical projections to model form factor project polygon A j on unit hemisphere centered at (and tangent to) A iproject polygon A j on unit hemisphere centered at (and tangent to) A i –Contributes cos  j / r 2 Project this projection to base of hemisphereProject this projection to base of hemisphere –Contributes cos  i Divide this area by area of circle baseDivide this area by area of circle base –Contributes   

19 Form Factor – Another Model Hemicube allows faster computations Analytic solution of hemisphere is expensiveAnalytic solution of hemisphere is expensive Use rectangular approximation, hemicubeUse rectangular approximation, hemicube cosine terms for top and sides are simplifiedcosine terms for top and sides are simplified Dimension of 50 – 200 squares is goodDimension of 50 – 200 squares is good Hemicube allows faster computations Analytic solution of hemisphere is expensiveAnalytic solution of hemisphere is expensive Use rectangular approximation, hemicubeUse rectangular approximation, hemicube cosine terms for top and sides are simplifiedcosine terms for top and sides are simplified Dimension of 50 – 200 squares is goodDimension of 50 – 200 squares is good

20 Radiosity Radiosity is expensive to compute Get your PhD by improving itGet your PhD by improving it Some parts of illuminated world can change Emitted lightEmitted light ViewpointViewpoint Other things cannot Light anglesLight angles Object positions and occlusionsObject positions and occlusions Computing form factors is expensiveComputing form factors is expensive Specular reflection information is not modeled Radiosity is expensive to compute Get your PhD by improving itGet your PhD by improving it Some parts of illuminated world can change Emitted lightEmitted light ViewpointViewpoint Other things cannot Light anglesLight angles Object positions and occlusionsObject positions and occlusions Computing form factors is expensiveComputing form factors is expensive Specular reflection information is not modeled

21 View-dependent vs View-independent Ray-tracing models specular reflection well, but diffuse reflection is approximated Radiosity models diffuse reflection accurately, but specular reflection is ignored Advanced algorithms combine the two Ray-tracing models specular reflection well, but diffuse reflection is approximated Radiosity models diffuse reflection accurately, but specular reflection is ignored Advanced algorithms combine the two


Download ppt "CS 445 / 645 Introduction to Computer Graphics Lecture 16 Radiosity Radiosity."

Similar presentations


Ads by Google