RAY


RAY was born as a project in the
Image Synthesis
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 finiteelement calculations, the scene surfaces are discretized to n elements (patches). A radiosity b_{i} is associated with each patch P_{i} (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 P_{i}, received by element P_{j} is the formfactor F_{ij}. 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 n^{2} 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.
RAY accepts input scenes in IRIT data format, using the IRIT library to parse these files. Click here for a summary of RAY options and input file format.
At the heart of the radiosity algorithm lies the formfactor 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. Final 
cbox.scr 
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 

shadow.scr 
The process of rendering the image, although fairy straightforward, poses some
problems. One of the most difficult of them was the socalled
TVertex problem (see Documentation).
RAY generates images in 24bit binary PPM format. The images displayed here were converted to JPEG for Netscape's sake.
droom.scr  office.scr  kitchen.scr 

The input scenes were converted from VRML by wrl2irit written by Oded Sudarsky.