Download presentation
Presentation is loading. Please wait.
Published byJessie Crawford Modified over 9 years ago
1
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Radiosity What we can do with scan line conversion and ray tracing What we can’t do Radiosity
2
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics2 Types of Illumination Scan-line Techniques – Diffuse reflection of light sources – Specular reflection of light sources Ray tracing and move advanced scan line techniques – Specular reflection from other objects – Transmission Seem like anything is missing, here?
3
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics3 The Big Lie!!! Ambient Light! – Does not really exist – It’s faking light reflecting from other surfaces
4
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics4 What really happens Light reflects off of surfaces and illuminates other surfaces – Every surface affects every other surface One hacky solution – Assume all of the light from all surfaces is averaged into a single illumination lighting that goes everywhere That’s what we’ve been calling ambient light.
5
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics5 Ambient Light is an approximation Many elements of natural lighting are not modeled well by ambient lighting at all – Corners – Interiors – Moving items
6
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics6 Characteristics of Diffuse Reflection How will OpenGL draw this box? What about ray tracing? What about nature? Light Box
7
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics7 Our box on edge
8
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics8 Complex Lighting Environments This is really a complicated lighting environment. – There is specular and diffuse reflection everywhere in the box. – Ray tracing can approximate the specular reflection fairly well, but not the diffuse reflection. Let’s just look at diffuse reflection for now. – Note: In the real world diffuse and specular reflection interact in a complex manner. We’ll get to combining the two later.
9
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics9 Radiosity Fundamental principle: – Conservation of energy – Light is either absorbed or reflected!
10
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics10 Radiosity Every surface is treated as a diffuse reflector and emitter and all surfaces are assumed to conserve light energy. – The rate at which energy leaves the surface, the radiosity, is the sum of the rates at which the surface reflects or transmits energy from other surfaces and the rate at which the surface emits energy. Note: we no longer have disjoint light sources. – Every object in the space is treated the same. – A light source is simply a surface that emits energy.
11
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics11 How do we solve this? Simple example: two surfaces
12
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics12 Solving this… Every surface’s radiosity is dependent upon the light falling on that surface from other surfaces, – which is a function of their radiosity, which will be dependent upon every other surface’s radiosity – which will be dependent upon every other surface’s radiosity » which will be dependent upon every other surface’s radiosity – Is it any surprise that we will be either solving or approximating solutions to simultaneous equations?
13
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics13 Pure Radiosity vs. Real World Pure Radiosity systems don’t have light sources, surfaces are light sources – Lighted panels are easy to do, as are light bulbs, etc. – Neon is just too cool… But, many systems compute reflection from light sources, then augment with the radiosity solution.
14
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics14 Problems with our box What do we model? – Surfaces? – Points?
15
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics15 Patches Radiosity systems break surfaces into smaller areas called patches – Surfaces are too big for a single radiosity – Points are just too small
16
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics16 The Radiosity Equation B i - The radiosity of patch i. – the rate at which light is emitted. This is units of energy per unit area per time. – This is what we are computing. Note that this may be a spectra (color). Do all this stuff for R, G, and B. E i - The emissivity of the patch. – This is the light generated by the patch and is of the same units as B i, will be zero for anything that is not a light source.
17
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics17 The Radiosity Equation i - The reflectivity of the surface. – This is equivalent to k dr in the Hall model. B j - The radiosity of some other patch j. F j-i - The form factor. – What fraction of energy leaving patch j will arrive at patch i. – This is dependent upon shape, relative angles, intervening patches, etc. A i and A j are the areas of the patches i and j.
18
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics18 What’s that A j /A i ratio? For patch j of area A j, the amount of energy leaving per unit area is B j. – Since the area can be of any size, we are interested in the total amount of energy! – This is B j A j. But, B i is also energy per unit area. – So, we divide the total energy getting to B i from B j by A i. – Hence, the ratio A j /A i.
19
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics19 A Simplification The unit area energy leaving patch j is scaled by F j-i A j. Likewise, unit area energy leaving patch i is scaled by F i-j A i. These are symmetrical paths – So, F i-j A i = F j-i A j. So, F j-i A j /A i = F i-j We can plug that into the above equation and ELIMINATE the areas:
20
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics20 How do we solve this? We have one massive simultaneous equation – Note that the problem is O(N 2 ) A variety of “short-cuts” exist. – We can solve using Gauss-Seidel iteration, a numerical method for solving simultaneous equations.
21
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics21 Solving…
22
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics22 TNT::Array2D A(patchcnt, patchcnt); TNT::Array1D b(patchcnt); // Create matrix A and vector b for(i=0; i<patchcnt; i++) { for(int j=0; j<patchcnt; j++) { A[i][j] = -m_patches[i].r * m_patches[i].ff[j]; if(i == j) A[i][j] += 1.; } b[i] = m_patches[i].e; } // Solve for x JAMA::QR qr(A); TNT::Array1D x = qr.solve(b); // Result is in x for(i=0; i<patchcnt; i++) { m_patches[i].b = x[i]; }
23
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics23 But, these are radiosities for patches Won’t the image look patchy? No... – We average the colors for patches to make vertex colors and interpolate
24
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics24 View Independence Note that all of the diffuse lighting is view independent – We can compute it once and display it afterwards with varying views… – Or, we can add this component to other computed light components Use ray tracing to compute the specular surface colors, radiosity to compute the diffuse
25
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics25 Examples OpenGL RenderingRadiosity Rendering
26
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics26 Form Factors Patch i Patch j r ii jj njnj nini A i – Area of patch i H ij – 1 if path from dA i to dA j exists.
27
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics27 double ainv = 1. / (m_subdivide * m_subdivide); // Inverse of the area of a patch for(i=0; i<patchcnt; i++) { Patch *patchi = &m_patches[i]; patchi->ff.resize(patchcnt); for(int j=0; j<patchcnt; j++) { Patch *patchj = &m_patches[j]; // Vector from i to j CGrPoint itoj = patchj->c - patchi->c; itoj.Normalize3(); // Vector from j to i CGrPoint jtoi = -itoj; // Distance between? double r = (patchi->c - patchj->c).Length3(); r = 1.0; if(i == j) patchi->ff[j] = 0; else patchi->ff[j] = (Dot3(patchi->n, itoj) * Dot3(patchj->n, jtoi) / (GR_PI * r * r)) * ainv; } }
28
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics28 Form Factor Computations Direct analytical computation of form factors is not practical – Life is too short for numerical integration… – Instead, we’ll use an approximation technique
29
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics29 Cohen and Greenberg Form Factor Estimation Algorithm We are interested in determining F ij, the form factor for light traveling from patch i to patch j. – We’ll approximate this using the following technique
30
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics30 Hemicube Create a half cube - called a hemicube - consisting of rectangular square areas called cells:
31
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics31 Projecting on Hemicube Project all the surfaces onto the surface of the hemicube. This will take 5 different projections to accomplish (why?)
32
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics32 Think of this as viewing When I view from the center of a patch, the following affects the form factor – How big it appears – The angles to the surface – How far to the projection Note the far and large is the same as near and smaller… If we use the item buffer algorithm, we can tell what’s closer and not occluded
33
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics33 Projecting on a Hemicube We have 5 item buffers, each one for the cells on one face of the hemicube
34
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics34 Cells equal parts of the form factor Suppose cell p has item j in it. –We add F p to Fij –For top faces –For side faces (x p,y p,z p ) is center of cell. A is the area of the cell.
35
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics35 Any options other than “hemicube”? …
36
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics36 Substructuring How much do we subdivide? – Too much is costly, not enough looks bad Substructuring – Compute at one level of subdivision and further divide if we get large differences in intensities What will we have to recompute?
37
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics37 Substructuring Very effective at finding shadow lines, and varying gradients
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.