Download presentation
Presentation is loading. Please wait.
1
Ray Tracing Jerry Sui Adam Conner
2
Part I – Introduction to Ray Tracing Final Product
3
Part I – Introduction to Ray Tracing 1.Trace the rays backward from the viewpoint through each pixel and into the scene (reverse direction of light propagation). 2.Find intersection point that is closest to eye. 3.Compute color at intersection. Ray Tracing is global lighting model.
4
Part I – Introduction to Ray Tracing Cast rays into the scene: Ray: a point (x o, y o, z o ) and the direction (unit vector)
5
Part II – Ray-object Intersection 1.Whether there is an intersection (with object surface). 2.If yes, give me the distance between viewpoint and the point of intersection (so that we can calculate the position of the intersection point). --- Find intersection that is closest to the viewpoint.
6
Part II – Ray-object Intersection Ray-plane intersection: ax + by + cz + d = 0 n = (a, b, c) Intersection with X-axis: -d/a Intersection with Y-axis: -d/b Intersection with Z-axis: -d/c
7
Part II – Ray-object Intersection v d = (x d, y d, z d ) direction vector (unit); p d = p o + tv d a(x o + tx d ) + b(y o + ty d ) + c(z o + tz d ) + d = 0 Solve: t = -(ax o +by o +cz o +d) / (ax d +by d +cz d ) = -(n p o + d) / n v d popo n vdvd pdpd
8
Part II – Ray-object Intersection Sphere, Box…etc. Most of the work in ray tracing goes into calculation of intersections between rays and surfaces. Calculations of some ray-object intersections could be pretty hard.
9
Part III – Color at Intersection The color at the intersection point depends on Lights in scene Material properties of the object.
10
Part III – Color at Intersection Illumination: Phong reflection model Reflection Transmition (refraction) light Shadow need recursion
11
Part III – Color at Intersection Phong reflection model: Diffuse: Calculated using the diffuse component of the light source. Ambient Calculated using the ambient light in the scene. Specular reflection Calculated by taking the dot product of the reflection ray with the rays direction vector, and raise the result to a power.
12
Part III – Color at Intersection Reflection: Mirror-like object reflection Outside phong reflection model Recursive; additional secondary rays generated for each intersection Secondary ray acts as primary ray, which may in turn generate additional secondary rays. Primary ray: ray shot out from the viewpoint. Secondary ray: any ray the is not a primary ray.
13
Part III – Color at Intersection
14
Transmission (refraction): I T n Snell’s Law:
15
Part III – Color at Intersection Transmission:
16
Part III – Color at Intersection
17
Transmission: Absorbency Coefficient: e = 2.718… (base of natural logarithm) R: transparency factor (0, 1) D: distance the ray travelled.
18
Part III – Color at Intersection Anti-aliasing: Shoot multiple rays through a pixel (to different position inside a pixel), and then average the colors returned by the rays. That is the final color of the pixel.
19
Part III – Color at Intersection Shadows: Given an intersection, shoot a ray to each light source and trace it to see if it intersects with anything along the way. If the shadow ray makes it to the light source, then the intersection is not in the shadow of that light. Otherwise, it is.
20
Part III – Color at Intersection
21
Shadows: Area Lights: Area light can be seen as if it is comprised of multiple point lights. Each point light within an area light gives off a fraction of the total light for the area light. When calculating shadows from area light, each intersection point fires a ray for each part of the area light. For each of these rays which fails to reach the area light, the sum of those fractions of light represent the shadow at the intersection point cast from the area light.
22
Part III – Color at Intersection
23
Shadows: Soft Shadows (noise): Eliminate banding Done by using multiple shadow rays for each area light grid position, each with random offset.
24
Part IV – Future Research Possibilities Optimization (acceleration) Distributed computing Better illumination model Real-time ray tracing ……
25
Picture Time
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.