![Page 1: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/1.jpg)
Ray Tracing
Fall, 2009
![Page 2: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/2.jpg)
Introduction
Simple idea Forward Mapping Natural phenomenon
• infinite number of rays from light source to object to viewer
Backward Mapping Ray Tracing• finite number of rays from viewer through each sample to object
to light source (or other object)
![Page 3: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/3.jpg)
Rendering with Ray Tracing
Ray Tracing Algorithm Generate primary (‘eye’) ray
• ray goes out from eye through a pixel center (or any other sample point on image plane)
Find closest object along ray path• find first intersection between ray and an object in scene
Compute light sample • use illumination model to determine direct contribution from
light sources for greater accuracy
• recursively generate secondary rays at equal
![Page 4: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/4.jpg)
Raytracing versus scan conversion
Raytracing versus scan conversion scan conversion
• After meshing and projection
• 3D 2D Image
• Based on transforming geometry
• for each triangle in scene
Raytracing• 3D Image
• Geometric reasoning about light rays
• for each sample in pixel image…
![Page 5: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/5.jpg)
Ray Tracing: Global Illumination Effects
![Page 6: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/6.jpg)
Raytracing
Overview Eye, view plane section, and scene Launch ray from eye through pixel (Generating Rays) see what it hits (Ray-Scene Intersection) Compute color and fill-in the pixel (Computing light sample)
![Page 7: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/7.jpg)
Generating Rays (1/2)
Ray equation
Through eye at t = 0 At pixel center at t = 1
R(t) = E + td
E
E + td
![Page 8: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/8.jpg)
Ray-Scene Intersection
Ray-Scene Intersection Intersections with geometric primitives
• Sphere
• Triangle
• Groups of primitives (scene)
Acceleration techniques• Bounding volume hierarchies
• Spatial partitions– Uniform grids– Octrees– BSP trees
![Page 9: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/9.jpg)
Ray-Sphere Intersection
![Page 10: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/10.jpg)
Ray-Sphere Intersection
![Page 11: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/11.jpg)
Ray-Sphere Intersection
Need normal vector at intersection for lighting calculations
![Page 12: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/12.jpg)
Ray-Triangle Intersection
Ray-Triangle Intersection First, intersect ray with plane Then, check if point is inside triangle
![Page 13: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/13.jpg)
Ray-Triangle Intersection
intersect ray with plane
![Page 14: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/14.jpg)
Ray-Triangle Intersection
Check if point is inside triangle algebraically
![Page 15: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/15.jpg)
Other Ray-Primitive Intersections
Cone, cylinder, ellipsoid: Similar to sphere
Box Intersect 3 front-facing planes, return closest
Convex polygon Same as triangle (check point-in-polygon algebraically)
Concave polygon Same plane intersection More complex point-in-polygon test
![Page 16: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/16.jpg)
Ray-Scene Intersection
Find intersection with front-most primitive in group
![Page 17: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/17.jpg)
Bounding Volumes
Check for intersection with simple shape first If ray doesn’t intersect bounding volume, then it doesn’t
intersect its contents If found another hit closer than hit with bounding box, then
can skip checking contents of bounding box
![Page 18: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/18.jpg)
Bounding Volume Hierarchies
Use hierarchy to accelerate ray intersections Intersect node contents only if hit bounding volume
![Page 19: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/19.jpg)
Computing light sample
Local Illumination Ray Casting
![Page 20: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/20.jpg)
Computing light sample
Recursive Ray Tracing Shadows and direct lighting Reflection and refraction Antialiasing, motion blur, soft shadows, and depth of field
![Page 21: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/21.jpg)
Shadow Rays
Detect shadow by rays to light source
![Page 22: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/22.jpg)
Shadow Rays
Test for occluder No occluder, shade normally ( e.g. Phong model ) Yes occluder, skip light ( don’t skip ambient )
![Page 23: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/23.jpg)
Reflection Ray
Recursive shading Ray bounces off object Treat bounce rays (mostly) like eye rays Shade bounce ray and return color
• Shadow rays
• Recursive reflections
Add color to shading at original point• Specular or separate reflection coefficient
V B
S
![Page 24: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/24.jpg)
Refracted Ray
Transparent materials bend light Snell’s Law
![Page 25: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/25.jpg)
“Distributed” Raytracing
Send multiple rays through each pixel
Average results together Jittering trades aliasing for noise Use multiple rays for reflection and refraction
How many rays???
![Page 26: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/26.jpg)
“Distributed” Raytracing : Soft Shadows
Soft shadows result from non-point lights Some part of light visible, some other part occluded
Area Light
Occluder
![Page 27: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/27.jpg)
“Distributed” Raytracing : Soft Shadows
Distribute shadow rays over light surface
![Page 28: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/28.jpg)
Soft Shadows
![Page 29: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/29.jpg)
“Distributed” Raytracing : Glossy Reflection
multiple reflection rays
polished surfaceθθ
Justin Legakis
![Page 30: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/30.jpg)
“Distributed” Raytracing : Glossy Translucency
Jittering the rays about the actual transmission angle produces a blurred effect
N
I
T
I
Bound of jittered reflection rays
![Page 31: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/31.jpg)
“Distributed” Raytracing : Motion Blur
Distribute rays over time More when we talk about animation...
![Page 32: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/32.jpg)
Pinhole camera – everything in focus. Camera with lens – utilized depth of field
“Distributed” Raytracing : Depth of Field
Image Plane Image Plane Focal Plane
Pinhole Camera Camera with lens
![Page 33: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/33.jpg)
“Distributed” Raytracing : Depth of Field (DoF)
Distribute rays over a lens assembly multiple rays per pixel
![Page 34: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/34.jpg)
Depth of Field
multiple rays per pixel
Justin Legakisfocal lengthfilm
![Page 35: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/35.jpg)
Depth of Field
![Page 36: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/36.jpg)
Bidirectional Ray tracing
Created by H. Wann Jensen
caustic
![Page 37: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/37.jpg)
Bidirectional Ray tracing
Caustic - (Concentrated) specular reflection/refraction onto a diffuse surface
Standard ray tracing cannot handle caustics caustic
Created by H. Wann Jensen
![Page 39: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/39.jpg)
POV-ray
created using POV-ray, http://www.povray.org/
![Page 40: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/40.jpg)
POV-ray
created using POV-ray, http://www.povray.org/
![Page 41: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/41.jpg)
POV-ray
created using POV-ray, http://www.povray.org/
![Page 42: Ray Tracing Fall, 2009. Introduction Simple idea Forward Mapping Natural phenomenon infinite number of rays from light source to object to viewer](https://reader036.vdocuments.us/reader036/viewer/2022062322/5697bff61a28abf838cbe373/html5/thumbnails/42.jpg)
Summary
Writing a simple ray casting renderer is easy Generate rays Intersection tests Lighting calculations
Recursive Ray Tracing Shadows and direct lighting Reflection and refraction Antialiasing, motion blur, soft shadows, and depth of field
Bidirectional Ray tracing Caustic : specular reflection/refraction onto a diffuse surface Standard ray tracing cannot handle caustics