lecture02.ppt
Download
Report
Transcript lecture02.ppt
CS 551/651:
Advanced Computer Graphics
Ray Tracing Continued
David Luebke
1
7/27/2016
Basic Algorithm: Code
Color TraceRay(Ray R)
if rayHitsObjects(R) then
Color localC, reflectC, refractC;
Object O = findNearestObject(R);
localC = shade(O,R); // shadow rays?
Ray reflectedRay = calcReflect(O,R)
Ray refractedRay = calcRefract(O,R)
reflectC = TraceRay(reflectedRay);
refractC = TraceRay(refractedRay);
return localC reflectC refractC
else return backgroundColor
David Luebke
2
7/27/2016
Shadow Ray Problems:
Sharp Shadows
Why are the shadows sharp?
A: Infinitely small point light sources
What can we do about it?
A: Implement area light sources
How?
David Luebke
3
7/27/2016
Shadow Ray Problems:
Area Light Sources
Could trace a conical beam from point of intersection
to light source:
Track portion of beam blocked by occluding
polygons:
30% blockage
David Luebke
4
7/27/2016
Shadow Ray Problems:
Area Light Sources
Too hard! Approximate instead:
Sample the light source over its area and take
weighted average:
50% blockage
David Luebke
5
7/27/2016
Shadow Ray Problems:
Area Light Sources
Disadvantages:
Less accurate (50% vs. 30% blockage)
Oops! Just quadrupled (at least) number of
shadow rays
Moral of the story:
Soft shadows are very expensive in ray tracing
David Luebke
6
7/27/2016
The End
David Luebke
7
7/27/2016