Raycasting consists of two separate processes. The first, called the preprocessing step, is illustrated below. The first task is to take the face and patch statements from the SDL files. The SDL file has been created by storing a model using Render in the interactive package, or by writing it using a text editor. Each geometric object has its control vertices transformed in accordance with the SDL hierarchy of transformations. The renderer then converts the geometry into a number of triangles. This number depends on the adaptive or non-adaptive subdivision for patches and "divisions" for a face. The vertices of each triangle store the local surface u, v parameter values, the tangent vectors, the surface normal and the surface position in world space.
Once created, the triangles are transformed using the perspective viewing transformation. This is controlled using the location of the camera, the viewpoint, the field of view and the twist. The viewing transformation transforms the triangles from world space into the perspective (screen) space. The triangles are then "scanned out" into the triangle buffer. This means that each pixel is flagged if it corresponds to a point inside the two dimensional boundary of the screen space triangle. The preprocessing step is now complete.
The raycasting step loops for each pixel to compute the visible colors.
This must take into account both the light reflected (towards the camera) by each surface and the effects of fog or smoke in the atmosphere between surfaces. The pixel coordinate points to a location in the screen space triangle buffer. Each triangle overlapping the pixel is tested against the ray to see where it intersects. The intersection point is used to interpolate between the geometric parameter values for the vertices of the triangle. The intersection point now has u, v parameter values, tangent vectors, a surface normal, and position.
The ray may well intersect more than one triangle, resulting in a list of such intersections. This list is then sorted into order of depth from the eye point. The sorted list of surfaces is processed from back to front in order to compute a final visible intensity for the ray which is placed in the corresponding pixel. (This will include a transparancy or "matte" value for the pixel to allow subsequent compositing operations when several rendered pieces can be combined to form a complex whole.)
The processing of the ordered list of intersections is a complex process and is shown in the following illustration.

Step 3 - Intersection Processing
The visible universe is assumed to extend to the distance "far" away from the camera location along the current ray; backgrounds, for instance are assumed to be this far away. In practise this only affects the atmospheric calculations. An atmospheric effect takes the two end points of a ray segment and computes the amount of light scattered along the ray. This is expressed as an RGB value. The effect also determines the visibility through the fog; i.e., how much light from one end of the ray segment will reach the other end. How this is done precisely is explained in the Procedural Textures and Natural Phenomena section of the SDL Reference Manual. In the absence of surfaces, the atmospheric effect merely attenuates the background color, based upon the far point along the ray and the camera location. Surfaces, however, both reflect light from light sources, and obscure things further away. Thus, the algorithm processes the intersection list computing the atmospheric effects between surfaces and the color and transparency of the surfaces themselves. These are combined to give the aggregate color and transparency value for the ray.
The process of determining the color value and transparency for a given surface is a complex one and is explained as follows.

The above diagram illustrates the direction the rendering process takes. Starting at the farthest point the eye sees, the renderer calculates the properties of the atmospheric effects that extend from this farthest point to the farthest surface. Next, the farthest surface is calculated, and the next step in the process is to calculate the properties of the atmosphere between surface 1 and 2. This process continues through the segments of atmosphere and surfaces until the camera is reached.