Computer Graphics CSI4130 – Winter 2019
Jochen Lang
EECS, University of Ottawa Canada
Ray Tracing and Global Illumination
• Ray Tracing
– Viewing rays
– Shadow rays
– Acceleration data structures
• Path Tracing
– Stochastic path-tracing summary
– Light tracing • Radiosity
• Hybrid Methods
– Instant radiosity – Photon mapping
CSI4130 Computer Graphics
Reminder: Rasterization
• Vertices are projected into image space
– This projects polygons since lines project to lines
• Normal test can be used for visibility
• Depth buffer decides occlusions
eye
CSI4130 Computer Graphics
Introduction to Ray Tracing
• Whitted [Com. of the ACM, 1980]
• Trace rays from the eye through pixels in the image into the
scene
lightsource
image plane
eye
scene
CSI4130 Computer Graphics
Viewing Rays
• Parametric (half-) line
– eye ( ) through screen pixel s ( ) and – one line equation per pixel
– background image for non-intersecting rays
• Ray-object intersections – Examples:
• Ray-sphere intersection (e.g., bounding sphere)
• Ray-triangle intersection (other planar polygons are similar)
CSI4130 Computer Graphics
Ray-Sphere Intersection
– Implicit equation of sphere • It must hold for intersection
– Simple quadratic equation in unknown t
– Bounding sphere: need only to check intersection yes/no, i.e., discriminant greater/smaller zero.
CSI4130 Computer Graphics
Ray-Surface Intersection
– Different efficient solutions possible
• Intersection with a parametric surface
• Points must be on the (parametric) line and the surface
CSI4130 Computer Graphics
Ray-triangle intersection
– Triangle as parametric surface (baricentric coordinates)
– Parametric line equation • Intersection:
– Linear system in 3 unknowns
• in front of eye and
• inside triangle and
CSI4130 Computer Graphics
Bare-Bone Ray Tracer
for each pixel do
compute view ray
if (ray hits an object with 1