Title: Radiosity
1Radiosity
- What can we do with scan line conversion and ray
tracing - What we cant do
- Radiosity
2Types 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?
T T
3The Big Lie!!!
- Ambient Light!
- Does not really exist
- Its faking light reflecting from other surfaces
4What 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 - Thats what weve been calling ambient light.
5Ambient Light is an approximation
- Many elements of natural lighting are not modeled
well by ambient lighting at all - Corners
- Interiors
- Moving items
6Characteristics of Diffuse Reflection
Light
How will OpenGL draw this box? What about ray
tracing? What about nature?
Box
7Our box on edge
8Complex 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. - Lets just look at diffuse reflection for now.
- Note In the real world diffuse and specular
reflection interact in a complex manner. Well
get to combining the two later.
9Radiosity
- Fundamental principle
- Conservation of energy
- Light is either absorbed or reflected!
10Radiosity
- 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.
11How do we solve this?
- Simple example two surfaces
12Solving this
- Every surfaces 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
surfaces radiosity - which will be dependent upon every other
surfaces radiosity - which will be dependent upon every other
surfaces radiosity - Is it any surprise that we will be either solving
or approximating solutions to simultaneous
equations?
13Pure Radiosity vs. Real World
- Pure Radiosity systems dont 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.
14Problems with our box
- What do we model?
- Surfaces?
- Points?
15Patches
- Radiosity systems break surfaces into smaller
areas called patches - Surfaces are too big for a single radiosity
- Points are just too small
16The Radiosity Equation
- Bi - 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. - Ei - The emissivity of the patch.
- This is the light generated by the patch and is
of the same units as Bi, will be zero for
anything that is not a light source.
17The Radiosity Equation
- ri - The reflectivity of the surface.
- This is equivalent to kdr in the Hall model.
- Bj - The radiosity of some other patch j.
- Fj-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. - Ai and Aj are the areas of the patches i and j.
18Whats that Aj/Ai ratio?
- For patch j of area Aj, the amount of energy
leaving per unit area is Bj. - Since the area can be of any size, we are
interested in the total amount of energy! - This is BjAj.
- But, Bi is also energy per unit area.
- So, we divide the total energy getting to Bi from
Bj by Ai. - Hence, the ratio Aj/Ai.
19A Simplification
- The unit area energy leaving patch j is scaled by
Fj-iAj. - Likewise, unit area energy leaving patch i is
scaled by Fi-jAi. - These are symmetrical paths
- So, Fi-jAi Fj-iAj. So, Fj-iAj/Ai Fi-j
- We can plug that into the above equation and
ELIMINATE the areas
20How do we solve this?
- We have one massive simultaneous equation
- Note that the problem is O(N2)
- We can solve using Gauss-Seidel iteration, a
numerical method for solving simultaneous
equations.
21Solving
22 TNTArray2D A(patchcnt,
patchcnt) TNTArray1D
b(patchcnt) // Create matrix A and vector
b for(i0 ifor(int j0 j Aij -m_patchesi.r
m_patchesi.ffj if(i j)
Aij 1. bi
m_patchesi.e // Solve for x
JAMAQR qr(A) TNTArray1D x qr.solve(b) // Result is in x
for(i0 im_patchesi.b xi
23But, these are radiosities for patches
- Wont the image look patchy?
- No...
- We average the colors for patches to make vertex
colors and interpolate
24View 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
25Examples
OpenGL Rendering
Radiosity Rendering
26Form Factors
Ai Area of patch i Hij 1 if path from
dAi to dAj exists.
nj
fj
ni
fi
r
Patch j
Patch i
27Form Factor Computations
- Direct analytical computation of form factors is
not practical - Life is too short for numerical integration
- Instead, well use an approximation technique
28Cohen and Greenberg Form Factor Estimation
Algorithm
- We are interested in determining Fij, the form
factor for light traveling from patch i to patch
j. - Well approximate this using the following
technique
29Hemicube
- Create a half cube - called a hemicube -
consisting of rectangular square areas called
cells
30Projecting on Hemicube
- Project all the surfaces onto the surface of the
hemicube. This will take 5 different projections
to accomplish (why?)
31Think 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 a z-buffer like algorithm, we can tell
whats closer and not occluded
32Item Buffers
- Suppose we used a z-buffer, but instead of
putting colors in each pixel, we put some
identification for an object - Point to data structure
- Integer id, etc
- This is called an item buffer
- We use item buffers to do the projection onto the
hemicube
33Projecting on a Hemicube
- We have 5 item buffers, each one for the cells on
one face of the hemicube
34Cells equal parts of the form factor
- Suppose cell p has item j in it.
- We add DFp to Fij
- For top faces
- For side faces
(xp,yp,zp) is center of cell. DA is the area of
the cell.
35Substructuring
- 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?
36Substructuring
- Very effective at finding shadow lines, and
varying gradients