Raytracers' Recess Design Notes

Jerry Farm

13 May 1993

Raytracers' Recess was rendered using Rayshade version 3, a public domain
raytracer written by Craig E. Kolb.  (Rayshade is available via anonymous
FTP from several sites.)

The Rayshade source code (written in C) was adapted for the Macintosh and
compiled using Think C.  Some changes, described below, were made to the
stereo camera model and to the anti-aliasing code to improve the quality of
the rendered images.

Two versions of Raytracers' Recess were rendered.  The first version is
actually a stereoscopic pair which was created at the conclusion of some
experimentation with stereo rendering techniques.  The second version is a
high-quality mono image created with an extended light source.  The
extended, or area, light source gives realistic, soft-edged shadows rather
than the sharp-edged shadows cast by a point light source.  However,
extended light sources significantly increase rendering time as can be seen
in the table below.


        Rendering Statistics:  Raytracers' Recess


        Image Size:     1800 x 900 pixels
        Platform:       Macintosh II


                                One Image of            Extended 
                                Stereo Pair*            Light Source

        Eye Rays                3.4 million             25.9 million

        Shadow Rays             5.6 million             33.5 million

        Reflection Rays         2.3 million             7.9 million

        Total Rays              11.3 million            67.3 million

        Rendering Time          45.  hours              213.  hours

                                * Point light source


A  small utility program was written to convert the images to color
PostScript files, which were then used to create 35 mm slides on an
Autografix film recorder.

Scene Creation

Rayshade accepts a text input file describing a scene in terms of basic
primitives to which surface characteristics, textures, and transformations
are applied.  Raytracers' Recess is composed of box, cylinder, sphere,
truncated cone, and polygon primitives.  To aid in defining the little
"guys", a short program was written which accepts an input file specifying
joint angles and produces a Rayshade input file describing the positions of
cylinders and spheres to produce arms, legs, hands and feet located
according to the joint angles.

You can download the files for Raytracers' Recess from this BinHex'd Stuffit 
archive (30K). The archive includes the Rayshade input scene file,
plus the source to guygen and it's input files.

Anti-Aliasing

Anti-aliasing was performed on the stereo images using Rayshade's method of
adaptive pixel subdivision.  Rays are traced from the eye point through
each corner of a pixel.  If the corners differ in red-green-blue intensity
by more than some threshold contrast, the pixel is subdivided into four
equal pixels.  The process is repeated on each subpixel, and continues
recursively until no more subdivisions are required or a maximum recursion
depth is reached.  All intensities are combined using a weighted sum to
produce a single red-green-blue intensity for the pixel.

Adaptive subdivision saves rendering time by avoiding pixel subdivision
when there is little contrast across a pixel, as measured at its corners. 
However, this method misses sub-pixel detail when the detail does not
intersect a pixel corner.  This occurred in Raytracers' Recess at the base
of the chess pieces.  Here a cylinder or cone sits on top of a cylinder of
slightly larger diameter, forming a narrow rim.  Because the rim is so
narrow and the two pieces are the same color, it can happen that the rim
appears in a pixel yet all four corners of the pixel are essentially the
same color.  An example of this can be seen in the leftmost pixel in Figure
1.  In this case no pixel subdivision occurs and the pixel is colored like
the sides of the cylinders, causing a dark break in the bright rim.  This
problem was solved by forcing pixel subdivision to occur not only when the
pixel's corner rays exceed a contrast threshold, but also when the corner
rays intersect different primitives in the scene.


Figure 1 - Pixel Corners Missing a Subpixel Detail

The extended light source version of Raytracers' Recess used another method
of anti-aliasing available in Rayshade known as jittered sampling.  In this
method, every image pixel is divided into a grid of subpixels (in this case
a 4x4 grid).  A ray is traced through each of the subpixels, but the
location of the ray within each subpixel is chosen randomly.  The average
intensity of all the rays determines the intensity of the pixel.

Textures

The textures used in Raytracers' Recess are all three-dimensional solid
procedural textures defined in Rayshade.  That is, rather than mapping a
two-dimensional texture map to the surface of an object, a procedure is
called for each ray-object intersection.  The procedure computes the
texture by using a noise function which is based on the x,y,z position of
the intersection.  The value of the noise function is used to perturb the
color or surface normal at the point.

Wood grain and marble textures were used for the chess board and a "blotch"
texture was used for the walls.  These textures affect the color of an
object.  A bump texture was used on the swimming pool to affect the surface
normals, causing reflections to have a wavy appearance.  (Note that the
reflections may not show up in print).


Continue to part 2, Tips for Rendering Stereo Images 


Updated: 2001.06.23