Download presentation
Presentation is loading. Please wait.
Published byEmory Willis Modified over 9 years ago
1
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph
2
Introduction Rays are tested against all objects in the scene to determine if they intersect any objects. The pixel is then set to the color values returned by the ray. If the ray misses all objects, then that pixel is shaded the background color. Trace rays of light from the eye back through the pixels of the image plane into the scene
3
Introduction-2 handles shadows, multiple specular reflections, and texture mapping point sampling algorithm. We sample a continuous image in world coordinates by shooting one or more rays through each pixel. the potential problem of aliasing aliasing
4
Shadow Ray When the ray hits an object, a secondary ray, ("shadow" ray), is shot towards the light sources Determine if that point on the object is in a shadow. If this shadow ray hits another object before it hits a light source, then the first intersection point is in the shadow of the second object. Only apply the ambient term for that light source at the point of intersection
5
Reflected Ray When a ray hits an object, a reflected ray is generated and tested against all of the objects in the scene. If the reflected ray hits an object then a local illumination model is applied at the point of intersection and the result is carried back to the first intersection point.
6
Transmitted Ray If the intersected object is transparent, then a transmitted ray is generated and tested against all the objects in the scene. If the transmitted ray hits an object then a local illumination model is applied at the point of intersection and the result is carried back to the first intersection point.
7
Multiple Layers of Reflection The reflected rays can generate other reflected rays that can generate other reflected rays, etc. The next sequence of three images shows a simple scene with no reflection, a single reflection, and then a double reflection.
8
Recursive Reflection
9
Ray Tree The reflective and/or transmitted rays are continually generated until the ray leaves the scene without hitting any object or a preset recursion level has been reached. This then generates a ray tree. DEMO This style of ray tracing was invented by Turner Whitted in 1979.
11
Ray Tree -2 The appropriate local illumination model is applied at each level and the resultant intensity is passed up through the tree, until the primary ray is reached. Thus we can modify the local illumination model by (at each tree node) I = I local + K r * R + K t * T R is the intensity of light from the reflected ray T is the intensity of light from the transmitted ray Kr and Kt are the reflection and transmission coefficients. For a very specular surface, such as plastic, we sometimes do not compute a local intensity, I local, but only use the reflected/transmitted intensity values.
12
Computing Reflection
13
Refraction
19
Ray-Object Intersection Ray-sphere Ray-quadric Ray-plane Ray-polygon Ray-box See Funkhouser notes on ray cast
20
Time-Consuming for a na ï ve raytracer (with no speedup techniques) the time is proportional to (number of rays) (number of objects) Each intersection requires from a few (5-7) to many (15-20) floating point (fp) operations. a scene with 100 objects and computed with a spatial resolution of 512 x 512, assuming 10 fp operations per object test there are about 250,000 X 100 X10 = 250,000,000 fps. This is just for the primary rays (from the eye through the image plane) with no anti-aliasing.
21
Computation Acceleration Approaches Use faster machines Use specialized hardware, especially parallel processors Speed up computations by using more efficient algorithms Reduce the number of ray-object computations
22
Reduce Ray-Object Computation Adaptive depth control stop generating reflected/transmitted rays when the computed intensity becomes less than a certain threshold. Attenuation due to distance and multiple reflection Bounding volumes enclose groups of objects in sets of hierarchical bounding volumes (e.g., spheres) and first test for intersection with the bounding volume
23
Reduce Computation -2 First-hit speedup a large percentage of the work is performed in finding the first intersection. use a modified Z-buffer algorithm to determine the first hit The scene would be pre-processed, with the resultant z- buffer storing pointers to the objects intersected. Then the ray tracing would proceed from that point. Weghorst showed that incorporating the above three techniques approximately halved the intersection computational time for complex scenes.
25
Fast square root
26
Aliasing Problems
27
Aliasing (in general) Nyquist theorem: to accurately reconstruct a signal, the signal must be sampled at a rate greater than or equal to two times the highest frequency contained in the signal
28
Aliasing in Computer Graphics One scanline
29
Aliasing in CG -2
30
Aliasing in CG -3
31
Aliasing Artifact
32
Anti-aliasing by Supersampling More than one samples per pixel Adaptive supersampling Supersampling with jitter
36
Ray-object intersection
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.