CSCE 441 Lecture 23
« previous | Monday, March 17, 2014 | next »
Ray Tracing
Not meant to be used in real-time
Provides rendering method with
- refraction / trasparent surfaces
- reflective surfaces
- shadows
Necessary Information
- Eye position
- Screen position and orientation
- Objects
- Material properties
- Reflection / refraction coefficients
- Index of refraction
- Light sources
Recursive Ray Tracing
for each pixel,
- intersect ray from eye through pixel with all objects in scene
- find closest (positive; in front) intersection to eye
- compute lighting at intersection point
- recur for reflected and refracted rays (if necessary)
Ray Casting
Do not recur; only compute basic lighting
Shadows
Cast a virtual ray to each light source (from each intersection point on the surface)
If there is an opaque object in the way, ignore contribution from that light source.
If there is semi-transparent object, scale contribution of that source and continue to look for intersections
Reflection
Recall from lighting lecture:
Refraction
If object is transparent, compute a ray from intersection point that travels through object.
Snell's law:
If we have a vector incident to a surface at angle from a medium with index of refraction and into a medium with indexf of refraction
Geometric formula:
- find basis and with respect to normal .
Progress Summary
Truncate recursion at a finite depth
Pruning:
- Do not recur on non-reflective or non-refractive surfaces
- Keep track of cumulation of value ( at th level of recursion): when , do not recur any more since no color value will affect color of pixel on screen.
Optimizations
Lots of rays generated, and ray-to-surface intersections are expensive to compute.
Associate a bounding-box in 3D space with each object: if ray doesn't intersect box, then ray doesn't intersect object.
Parallel processing:
- Ray tracing is trivially parallel
- cast rays in parallel, cast reflection, refraction, and shadow rays in parallel, and join on results
- calculate ray/surface intersections independently in parallel.
Extensions
Only considers totally specular interactions
- rays either reflect perfectly or refract perfectly (not realistic)
- Ray-traced scenes don't show "color bleed" from light reflected from other surface.
Translating from Screen to Window Coordinates
Object files for HW4 defined in space. This needs to be mapped to .