# Ray Tracing

Cheng-Ling Lin, WPI CS Department

## Introduction

Ray tracing is a versatile technique that uses the same model to integrate aspects of light/object interaction that were previously handled by seperate ad hoc algorithms - reflections, hidden surface removal and showdows.

The idea of ray tracing is tracing the light for ecah pixel, from an eye or view point through the pixel and into the scene.

## Description

The method to trace a light from light source and propagate to eye or view point, is called 'backwards ray tracing'. There are infinity of rays emanate from light source and it is difficult, therefore, to trace rays in the direction of light propagation.

In the implementation we trace the rays backward from the view point through each pixel and into these scene. That is we trace in the reverse direction of light propagation. This is because we are only interestd eventually in a fixed number of rays - those that pass through the view plane - say, one per pixel.

Ray/objects intersection and color rendering are two major issues need to be evaluate carefully. There are many existing algorithm to compute the intersection of light with objects. To select a sufficient method for ray/object intersection has a significant effect of performance, because most of time for raytracing is sepnd for intersection. Due to different objects have different characteristics, it is not necessary to apply the same ray/object intersection method for different objects. For example, even the geometric method may good enough for ray/sphere intersection evaluation, but it may not sufficient for ray/quardrics intersection.

After find out the intersec point for ray and objects, the next issue is render the color for that point. Following formula is used to model the color by ray tracing.

```    I = Ilocal + Krg . Ireflection + Ktg . Itransmitted

Where I is the final color of redendering
Ilocal is the term by direct illumination
Krg is the cofficient of reflection of object
Ireflection is reflected light
Ktg is the cofficient of transmitted or refraction of object
Ireflection is trasnmitted or refracted light
```

phong model is a good model for local light redering. Reflection and transmitted light need apply some geometric methods and need find out the normal vector of light vector at interection point.

## Conclusion

1. With a simple implemenation of ray tracing, the effects of shadow, reflection, reflection and transparency are present on the final image without any further extension of algorithm.

2. Potentially, we can extend ray tracing to support CSG solid modeling by checking the relationship of intersect points for the same light. What we have to do is based on the boolean operation of each object, compare every intersect point of same light to find out the existing point which nearest to the light.

3. A major disadvantage of ray tracing is that its computation complexity is about square of object number. More object on the scene, much more time needed for rendering. Some optimal methods are available to enhance efficient of ray tracing. Bounding volumn, Ray coherence and 3-directional subdivision are some of well known methods.

## Reference

The reference if chapter 8 of Advanced Animation and Rendering Techniques Theory and Practice by Alan Watt and Mark Watt.

cllin@cs.WPI.EDU