CS488 - Introduction to Computer Graphics - Lecture 18
Comments and Questions
- Mid-term
Lighting
Bidirectional Ray Tracing
Recursive ray tracing makes a tree with a big fan-out: Cost ~ n^d ~ exp(
d*log(n) ) where d is the depth, the number of recursions, n is the fan-out,
the number of rays sent out from each point each time the algorithm
recurses..
- n is big, so it's worth getting d down.
Bright idea
- Trace out from eye
- Trace out from sources of illumination
- Match the rays in the centre ... somehow!
- The resulting double cone gets the same performance at Cost ~ n^(d/2) ~
exp( (d/2)*log(n) ), which is surely worth it.
The problem is step 3. How do you match the rays? The current state of the
art is photon mapping.
- It's big idea is stopping the recursion on diffuse surfaces
Here's how it works.
From every light source
- send out rays in `randomly' chosen directions
- For each ray
- Follow it until it hits a surface.
- If the surface is reflective
- Send out a ray in the reflection direction
- If the surface is not reflective
- Accumulate a pool of illumination
- Send out a ray in a randomly chosen direction
- Continue following rays until ...
For each pixel
- Cast a ray into the scene
- When it hits a surface, use the light you find accumulated there for
the illumination in your lighting model
Notice tuning and calibration needed.
What creates the caustics?
Something important has happened here. We have separated rendering into
two parts.
- Lighting: spreading light around the scene from the sources
- Rendering: calculating how much of the spread around light gets to the
eye.
Participating Media
Colouring the light
What is beer?
- Lots of little colour centres
- Light gets absorbed
- The farther light goes the more likely it is to get absorbed.
- And there is self-screening: the farther you have gone the less light
there is to get absorbed
- The property is described by Beer's Law (named after August Beer, no
relation)
- I(x) ~ exp( -k(\lambda) x )
What happens to the light that doesn't make it through?
Scattering the light
What is fog?
- Lots of little water droplets
- Light gets scattered
- The farther light goes the more likely it is to get scattered.
- And there is self-screening: the farther you have gone the less light
there is to get scattered.
- The property is described by Beer's Law
- I(x) ~ exp( -k(\lambda) x )
What happens to the light that doesn't make it through?
- That's why fog looks different than beer!
Refracting the light
Snell's law
Caustics
Shadows
What is a shadow?
Shadows come `for free' in the ray tracer. Can we make them fast enough to
use with OpenGL? Yes.
- The key idea is that lighting has the same geometry as viewing.
The methods, in increasing order of cost.
- Projective shadows
- Project silhouette of shadowing object onto shadowed object
- Draw a dark area where shadow lies, using alpha blending unless you
are trying to get the `deep space' look
- Easy for simple objects onto onto simple objects, ...
- What about meshed objects?
Notice that we know a lot about how to project.
- Shadow maps
- Shadow volumes
- Project from light as for shadow maps
- Define a set of polygons that are the boundaries of the volume that
is in shadow.
- Front-facing wrt eye +1
- Back-facing -1
- Count along the ray from eye to point, staring with zero
- If > 0 in shadow
- If 0 in light
Comment on global illumination. If you are doing a walk-through, you can
calculate the illumination on each polygon once, then re-project the scene
from different viewpoints as the user moves around.
Light Fields
Texture Mapping
- Basic
- Start with a 2D image: pixellated or procedural
- Map 2D image onto primitive using a 2D affine transformation
- Simple if the surface of the primitive is flat
- otherwise, ...
- Texture pixels normally do not match display pixels, so some
image processing may be needed.
- Backwards map intersection point with ray into the image to get the
surface properties
- Normal Mapping (Bump mapping)
- Start with a difference surface, defined with respect to the
surface
- Calculate the normals to the difference surface and map them onto
the surface of the primitive
- Use the mapped surface models for lighting
- No occlusion, shadows are wrong, silhouettes are wrong, nobody
notices!
- Solid Textures
- Solution to mapping texture onto curved surfaces
- Usually procedural
Return to: