Unformatted text preview:

Lecture 17: Recursive Ray TracingWhere is the way where light dwelleth? Job 38:191. Raster GraphicsTypical graphics terminals today are raster displays. A raster display renders a picture scan line by scan line. A scan line is a horizontal line consisting of many small, tightly packed dots called pixels. To display a scene using a raster display, we need to compute the color and intensity of the light at each pixel. The purpose of this lecture is to explain how to compute the color and intensity of light for each pixel given a 3-dimensional model of the objects in the scene and the location, color, and intensity of the light sources.2. Recursive Ray TracingFor realistic rendering, we need the following setup: an eye point E, a viewing screen S, and one or more point light sources with known location, color, and intensity (see Figure 1). We also need to specify the locations and the shapes of all the objects in the scene, together with their reflectivity, transparency, and indices of refraction. Our goal is to display the 2-dimensional projection onto the screen of the 3-dimensional scene as viewed from the eye point, much like an artist painting the scene or a still photographer capturing a vista. We shall accomplish this task by tracing light rays from the scene back to the eye. Below is the basic ray tracing algorithm.Ray Tracing AlgorithmFor each pixel:i. Find all the intersections of the ray from the eye to the pixel with every object in the scene.ii. Keep the intersection closest to the eye.iii. Compute the color and intensity of the light at this intersection point.Render the scene by displaying the color and intensity at each pixel.Step i of the ray tracing algorithm requires us to compute the intersections of a straight line with lots of different surfaces. The difficulty of this intersection problem depends on the complexity of the surfaces in the scene. For planar surfaces these intersections are easy to compute: we simply solve one linear equation in one unknown. But for more complicated surfaces, we shall need more sophisticated tools. We will study line-surface intersection algorithms for a variety of different surfaces in Chapters 18 and 19. Step ii of the intersection algorithm is straightforward; in this chapter we shall concentrate on Step iii of the algorithm.€ •€ screen€ eye€ reflection€ refraction€ light€ light€ •€ shadow€ pixelFigure 1: To determine the color and intensity at a pixel, a ray is cast from the eye point through the pixel. The color and intensity of the point where the ray first strikes a surface is computed by summing the contributions from the direct illumination of the unobstructed light sources and the contributions of reflected and refracted rays.To find the color and intensity of the light at a surface point, we need to consider not only the light shining directly on the surface from the light sources, but also the light reflected and refracted from these sources off of other surfaces. Thus the total intensity I at a surface point is given by€ I = Idirect+ ksIreflected+ ktIrefracted, (2.1)where, as we observed in Chapter 16,€ Idirect= Iambiant+ Idiffuse+ Ispecular(2.2)and € 0 ≤ ks,kt≤1 are the reflection and refraction (transparency) coefficients. These coefficients depend on the physical characteristics of the surface, which can be determined experimentally or simply set by the programmer. Again the light reflected and refracted from other surfaces depends on the light shining directly on these surfaces as well as on the light reflected and refracted onto these surfaces from other surfaces. These observations lead to the binary light tree depicted in Figure 2.2IdirectIreflectedIreflectedIrefractedIrefractedIreflectedIrefracted MksksksktktktFigure 2: Binary light tree. The intensity of light at a surface point (apex) is the sum (depicted here by arrows) of the intensities of the light from the point light sources shining directly on the surface and the intensity of the light reflected and refracted off of other surfaces. The intensity of the light reflected and refracted from other surfaces also depends on the light shining directly on these surfaces and the light reflected and refracted to these surfaces from other surfaces. This recursive computation is summarized graphically in the binary light tree depicted above. This tree must be truncated at a prespecified depth in order to avoid infinite recursion.Notice that for each object in the scene, we must decide whether it is reflecting, transparent, semi-transparent, or opaque -- that is, we need to assign values for reflectivity (€ ks) and transparency (€ kt). Moreover for transparent or semi-transparent objects, we need to assign an index of refraction (€ ci). For opaque objects, € ci= 0; for air, € ci= 1. Note too that for transparent, objects € Idirect= 0.3. ShadowsJust as we may not see every object in a scene because some objects are hidden from view by other objects closer to the eye, so too not every object in the scene is necessarily illuminated by every light source in the scene because some objects may lie in the shadow of other objects. That is, if an opaque object lies between a light source and a surface, then the surface will not be illuminated by the light source. To determined whether or not a surface point is illuminated by a point light source, we treat the surface point as a virtual eye and we cast a virtual ray from the surface point to the point light source. As in the ray casting algorithm, we compute all the intersections of this virtual ray with every object in the scene. If the virtual ray intersects an opaque object before the virtual ray hits the 3light source, then the surface point lies in shadow; otherwise the surface point is illuminated by the light source. Below we summarize this basic shadow casting algorithm.Shadow Casting AlgorithmFor each surface point visible to the eye, cast a virtual ray to each light source.i. If the virtual ray hits an opaque object before the virtual ray hits a light source, then omit the contribution of this light source. That is, for this light source, € Idiffuse= Ispecular=


View Full Document

Rice COMP 360 - Lecture Notes

Documents in this Course
Radiosity

Radiosity

42 pages

Radiosity

Radiosity

22 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?