190 likes | 594 Views
RAY TRACING. Ray tracing. To determine the color of a given pixel: Create a ray from the eye, through the pixel, and into the world Intersect the ray with all objects in the scene Determine the visible surface. Forward ray tracing.
E N D
Ray tracing To determine the color of a given pixel: Create a ray from the eye, through the pixel, and into the world Intersect the ray with all objects in the scene Determine the visible surface
Forward ray tracing • Light rays can be traced from the light source to the eye point
reverse ray tracing • Or from the eye point back to the light source • More efficient and more practical
Inter-object reflections We could trace a ray off reflective surfaces and determine if they hit objects – if they do we compute the lighting equations for the secondary ray and determine the contribution of this reflection at the first intersection
Refraction Transparent and translucent objects refract (bend) the light that passes through them. We could compute refracted rays and trace them as well. We can calculate the angle from the indices of refraction of the two materials which interface at the ray-object intersection.
Shadows Or we can take our first step toward a “full” ray tracing algorithm: We could trace a shadow-ray from the point of intersection toward the light and determine if some other object blocks the light source.
Recursive ray tracing Full recursive ray tracing (as suggested by Whitted) does all of these at every intersection.
The good & the bad Good: Transparency Reflections Shadows Conceptually simple / pretty easy to write – no clipping, no projections, no scan conversion Bad: Intersection tests are expensive Intersection tests are expensive Intersection tests are expensive Typical framebuffer 1 million pixels Typical scene « 1 million polygons