RAY was born as a project in the
course and consisted of a conventional recursive raytracer.
A year later it was extended to include the radiosity technique for image rendering. This work was done as a semester project in the Intelligent Systems Laboratory under the supervision of Dr. Craig (Chaim) Gotsman
Raytracing is a powerful rendering technique, but has a number of major drawbacks.
Radiosity addresses these problems by rendering using heat transfer principles. As in finite-element calculations, the scene surfaces are discretized to n elements (patches). A radiosity bi is associated with each patch Pi (polygons in RAY's case). This is the amount of energy emitted by a unit area of the element. The energy transfer between two elements is fully characterized by their relative position and orientations, their physical characteristics and occluding objects. The proportion of the total energy emitted by element Pi, received by element Pj is the form-factor Fij. When calculating form factors, we assume that surfaces are Lambertian or ideally diffuse, i.e. each point on the surface emits energy uniformly in all directions.
The input for the radiosity calculation is the specification of a set of n patches. The radiosities are computed by computing n2 form factors and solving a set of n linear equations.
After obtaining radiosity values for the patches, the scene can be rendered from an arbitrary viewpoint by simple shading methods.
This classic radiosity method suffers from two major drawbacks:
Common methods for attacking these problems are progressive refinement and adaptive subdivision. Both techniques are implemented in RAY.
A detailed description of RAY's algorithms and data structures is given in the RAY documentation package. Here we give a very general description and some results.
At the heart of the radiosity algorithm lies the form-factor computation. RAY approximates the area integral by dividing both sending and receiving patches into small subelements of known size and pretending these subelements are differential. The visibility between two subelements is determined by raycasting.
For computing radiosity values, RAY uses the "shooting" progressive refinement algorithm. This algorithm uses the notion of "unshot", or residual, radiosity. This is the amount of energy which a patch has due to its emitting property or due to illumination received from other patches, and which was not yet distributed among other patches. In the initial state, the only patches with radiosity are those emitting light, and all radiosity is unshot. The 'brightest' patch is then selected and its unshot radiosity is distributed between other patches by increasing their unshot radiosity values. This continues until the total unshot radiosity is reduced below a threshold. The iterative process is illustrated in the following images.
| Iteration 1. |
Light source shoots
| Iteration 4. |
Green wall shoots
| Iteration 7. |
Red wall shoots
| Iteration 8. |
Top of large box shoots
|Iteration 16.|| Iteration 24. |
It is possible, at any stage of the progressive refinement, to get a crude estimate of the solution. This will, however, usually be darker than the true solution. To compensate for this, a technique called ambient illumination is used. It affects only the image display. The idea is to add some amount of radiosity (proportional to the average unshot radiosity of the scene) to every patch before displaying it. This means that, the closer the solution to convergence, the smaller the impact of the ambient illumination. Click here for the same sequence of Cornell Box images as before, displayed with ambient illumination.
Adaptive subdivision takes place while calculating the amount of energy transferred between a source and destination patch. The general idea is that first it is assumed that the radiosity is distributed uniformly over the destination patch, which is then subdivided into smaller patches for more accurate results. By comparing these two results, a decision is made about the necessity of subdivision. The test is applied recursively. The subdivision process is illustrated in the following images:
| Iteration 1. |
Left light source shoots.
Finest division on the floor is
around the border of the shadow
| Iteration 2. |
Right light source shoots.
Division of the floor is refined
around second shadow
The process of rendering the image, although fairy straightforward, poses some
problems. One of the most difficult of them was the so-called
T-Vertex problem (see Documentation).
RAY generates images in 24-bit binary PPM format. The images displayed here were converted to JPEG for Netscape's sake.