180 likes | 419 Views
Ray Tracing. By Steven Giovenco. Overview. Definitions Intro to computer graphics What is ray tracing? Why use ray tracing? When and how is ray tracing used? Summary References. Basic Graphics Definitions. RGB
E N D
Ray Tracing By Steven Giovenco
Overview • Definitions • Intro to computer graphics • What is ray tracing? • Why use ray tracing? • When and how is ray tracing used? • Summary • References
Basic Graphics Definitions • RGB • Color specification in which intensity values for Red, Green, and Blue components of a color are used • Pixel • Individual unit of display, single “dot” of color • Raster • Block of graphics memory which contains information to be displayed (often as a contiguous block of RGB triplets, each representing a pixel) • Clipping • Determining which virtual objects (or parts of objects) should or should not be shown.
Some More Definitions • “Camera” Specifications • Eyepoint • The logical point (in reference to the origin) at which the “camera” or “eye” is located • View Vector • Direction in which the camera is pointing • Up Vector • Perpendicular to View Vector, orients the camera • Viewing plane • Usually the near clipping plane, this is the “window” you have into the graphical world
Ray Tracing Definitions • Eye Ray • Ray from Eyepoint through a pixel on the viewing plane, used to determine visible points • Secondary Ray • Ray generated from object surface at ray intersection point to gather information about environment effects on the surface • Shadow Ray • Secondary ray toward a light source to determine if an object occludes light source
So What Is Ray Tracing? • Technique for rasterization • For each pixel of the viewing plane • Determine coordinates of pixel center • Generate eyeray • Check for intersection with objects • Determine color at closest intersection • Color • Texture • Shading • Reflection • Refraction • Store color in raster
In More Detail… • Determine coordinates of pixel center • Simple vector addition • Generate eyeray • Simple point subtraction • Check for intersection with objects • Common intersection tests range from 5-7 floating point operations to 15-20 ops for more complex tests (SIGGRAPH website)
The Rest of the Details… • Determine color at closest intersection • Color: determined from object • Texture: determined from object and texture • Shading: generate secondary ray toward light sources • Reflection: generate secondary ray at reflection angle outward from object • Refraction: generate secondary ray at refraction angle through object • Combine information using surface’s lighting equation, and store in raster
Benefits of Ray Tracing • Clipping • Other algorithms need a separate, rather costly, step to clip objects not in scene • Ray tracing only needs to make sure object is not too near • Accurate reflection and refraction • Accurately depicts mirrors, lenses, windows, etc. • Other algorithms approximate reflections and refractions • Can represent any objects for which ray intersections can be determined.
Drawbacks of Ray Tracing • Slow due to many intersection testing operations • 640x480 resolution, objects with 10 ops/test, 3,072,000 ops required per object • Does not include secondary rays • Not appropriate for most games as real-time rendering through ray tracing is nearly impossible with current techniques and hardware
Speeding Up Ray Tracing • Adaptive Depth Control • Before a secondary ray is cast, test if its contribution is significant • Bounding Volumes • Enclose objects and groups of objects in hierarchal spheres or boxes which have easy to compute ray intersections, test bounding objects from top-down to see which objects inside need be tested
Summary • Extremely accurate • Lighting • Reflections • Refractions • Texturing • Very slow • Not appropriate for real-time rendering, such as in games • Can represent nearly any object
References • ACM SIGGRAPH website - ray tracing • http://www.siggraph.org/education/materials/HyperGraph/raytrace/rtrace0.htm • Dr. Sumanta N. Pattanaik • CAP 5725 -- Computer Graphics 1 • RayShade Gallery • http://graphics.stanford.edu/%7Ecek/rayshade/gallery/gallery.html