Ray Tracing

[ LiB ]

Ray Tracing

Ray tracing, the first computer algorithm for the photo-realistic rendering of 3D objects, is a very simple yet powerful idea. Ray tracing is very good at simulating specular reflections (covered in Chapter 3) and transparency. This is because rays can be easily bounced (or reflected) at mirrors as well as refracted on transparent materials. Major rendering applications like 3D Studio Max implemented ray tracing as the core layer for rendering. Games like Wolfenstein 3D by Id Software used a subset of ray tracing called ray casting as the core layer for rendering. The basic idea behind ray tracing is that you can trace rays in some particular order and calculate the intensity based on each interaction on a material given each light source. Ray tracing excels at curved surfaces because it's a point-based rendering technique. It's also excellent at specular reflections, primarily mirror reflections.

But ray tracing has some major problems in simulating the movement of energy that caused it to incorrectly simulate natural lighting effects such as diffuse reflections and indirect illumination . As you will see later, ray tracing does a poor job at computing the penumbras in shadows. It also does a poor job at simulating the scattering of light on diffuse surfaces. Over the many years of research many new subsets of ray tracing have been developed. The next section briefly covers a few techniques because you will use two of these later. There are many more advanced techniques such as Stochastic Sampling, Beam Tracing, Cone Tracing, and Pencil Tracing that aren't covered in this book.

NOTE

NOTE

Ray tracing was invented by Turner Whitted in 1980.He published a paper called "An Improved Illumination Model for Shaded Display," which got the ball rolling for everyone.

Forward Ray Tracing

Forward ray tracing works with the idea of tracing light particles ( photons ) from the light sources as they intersect objects in the scene and then finally reach the image plane. See Figure 5.6 for an example of forward ray tracing.

Figure 5.6. Forward ray tracing.

graphic/05fig06.gif


This technique is very good at computing the coloring of each object, but it has some major problems. This technique is very processor- intensive because each ray being traced from each light source has to be calculated as it intersects each object in the scene. This typically included many wasted rays that never hit the image plane. Although significant in its time as a major step in the direction of photo-realistic rendering, it is, obviously, a very inefficient approach.

A better approach developed later is called backward ray tracing, which traces rays in the opposite manner. Forward ray tracing is also known as light ray tracing or photon tracing . You'll use this idea later during the development of photon mapping. For now, just keep it in mind.

NOTE

NOTE

When ray tracing was first devel oped as the only method available for photo-realistic rendering,the only people who actually used it were operating on big UNIX main frames and Cray supercomputers. Slow by our standards now,it is (aca demically) biased to judge the method retrospectively as a "bad approach." In its time,it was the only approach.

Backward Ray Tracing

Backward ray tracing was developed to increase ray-tracing efficiency. The basic idea behind this technique is that a virtual ray originating from the eye is sent out through each pixel of the image plane. This technique eliminates the computational strain on the processor because the work is limited only to where it matters; where rays intersect viewable objects. After the rays leave the eye and scatter around in the scene, the color is computed based on each intersection. The new value is then saved on that specific (x,y) position from where it originally left on the image plane. For example if the image plane was a 2x2 image, a typical application would spawn one ray per each pixel. See Figure 5.7 for an example of backward ray tracing.

Figure 5.7. Backward ray tracing

graphic/05fig07.gif


The problem with backward ray tracing is that it assumes light particles are moving in only one direction and that light is being traced from the image plane and not from the light sources. This creates a problem in correctly computing a pixel's intensity. It also creates other problems with indirect lighting effects such as shadows and multiple specular reflections. You'll soon see how this technique is used extensively for ray-tracing applications. It will also be used in conjunction with photon mapping to render the final image.

Bi-directional Ray Tracing

Bi-directional or hybrid ray tracing was developed to fix the problems inherent in forward and backward ray tracing. Researchers wanted to develop a new technique that was optimized for speed and accuracy. The system was set up where, based on a certain set of conditions, the application would select forward or backward ray tracing. Sometimes it would use both to correctly compute a pixel's intensity. This was an improvement but this too had some problems because sometimes the intensity of a pixel traced backwards was very different from the intensity traced forward. See Figure 5.8 for an example of bi-directional ray tracing.

Figure 5.8. Bi-direc- tional ray tracing.

graphic/05fig08.gif


[ LiB ]


Focus On Photon Mapping
Focus On Photon Mapping (Premier Press Game Development)
ISBN: 1592000088
EAN: 2147483647
Year: 2005
Pages: 128
Authors: Marlon John

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net