Download presentation
Presentation is loading. Please wait.
Published byLewis Casey Modified over 9 years ago
1
Ray Tracing Fall, 2009
2
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)
3
Rendering with Ray Tracing Ray Tracing Algorithm Generate primary ( ‘ eye ’ ) ray ray goes out from eye through a pixel center (or any other sam ple 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
4
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…
5
Ray Tracing : Global Illumination Effects
6
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)
7
Generating Rays (1/2) Ray equation Through eye at t = 0 At pixel center at t = 1 R(t) = E + td E E + td
8
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
9
Ray-Sphere Intersection
11
Need normal vector at intersection for lighting calculations
12
Ray-Triangle Intersection First, intersect ray with plane Then, check if point is inside triangle
13
Ray-Triangle Intersection intersect ray with plane
14
Ray-Triangle Intersection Check if point is inside triangle algebraically
15
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
16
Ray-Scene Intersection Find intersection with front-most primitive in group
17
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
18
Bounding Volume Hierarchies Use hierarchy to accelerate ray intersections Intersect node contents only if hit bounding volume
19
Computing light sample Local Illumination Ray Casting
20
Computing light sample Recursive Ray Tracing Shadows and direct lighting Reflection and refraction Antialiasing, motion blur, soft shadows, and depth of field
21
Shadow Rays Detect shadow by rays to light source
22
Shadow Rays Test for occluder No occluder, shade normally ( e.g. Phong model ) Yes occluder, skip light ( don’t skip ambient )
23
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
24
Refracted Ray Transparent materials bend light Snell’s Law
25
“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???
26
“Distributed” Raytracing : Soft Shadows Soft shadows result from non-point lights Some part of light visible, some other part occluded Area Light Occluder
27
“Distributed” Raytracing : Soft Shadows Distribute shadow rays over light surface
28
Soft Shadows
29
“Distributed” Raytracing : Glossy Reflection multiple reflection rays polished surface θ θ Justin Legakis
30
“Distributed” Raytracing : Glossy Translucency Jittering the rays about the actual transmission angle produces a blurred effect N I T Bound of jittered reflection rays
31
“Distributed” Raytracing : Motion Blur Distribute rays over time More when we talk about animation...
32
Pinhole camera – everything in focus. Camera with lens – utilized depth of field “Distributed” Raytracing : Depth of Field Image Plane Focal Plane Pinhole Camera Camera with lens
33
“Distributed” Raytracing : Depth of Field (DoF) Distribute rays over a lens assembly multiple rays per pixel
34
Depth of Field multiple rays per pixel Justin Legakis focal length film
35
Depth of Field
36
Bidirectional Ray tracing Created by H. Wann Jensen caustic
37
Bidirectional Ray tracing Caustic - (Concentrated) specular reflection/refraction onto a diffuse surface Standard ray tracing cannot handle caustics caustic Created by H. Wann Jensen
38
Examples : POV-ray created using POV-ray, http://www.povray.org/
39
POV-ray created using POV-ray, http://www.povray.org/
40
POV-ray created using POV-ray, http://www.povray.org/
41
POV-ray created using POV-ray, http://www.povray.org/
42
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.