Ray Tracing with RAYSHADE and EnFuzion

Summary
This application note shows the use of EnFuzion with Rayshade, a popular image rendering program for ray tracing. Computer graphics programs, especially ray tracing programs, are among the biggest users of computing cycles. EnFuzion enhances the quality of rendered images in these programs:

  • It speeds up the computation by distributing the computational load over a network of workstations;
  • It explores the space of input image parameters that are necessary to produce images of the highest quality;
  • It works with little or no code change requirements to the application.

What is Rayshade?
Rayshade is a ray tracing program by Craig Kolb. You can use Rayshade to read a multi-line ASCII file describing a scene to be rendered and to produce a file containing the ray traced image. Rayshade's features also include:

  • ten types of primitive objects
  • use of uniform spatial subdivision
  • constructive solid geometry multiple point light sources
  • solid procedural texturing, bump mapping and two dimensional image texture mapping.

How did using EnFuzion help image rending with Rayshade?
EnFuzion distributed image rendering over a network of computers without code changes to Rayshade. The results were beyond all expectations. For example, it took 18 hours of CPU time on a Cray Y-MP to render Aquarium, a set of stereo images by Alan Kilian and Jerome A. Farm. It took only 37 minutes of real time to render one of the images on 26 DEC Alphas.

How was EnFuzion used?
To distribute rendering, each line of the image was rendered separately. All the lines were joined together at the end. To use Rayshade with EnFuzion, two files were required: a template file for RayShade and a plan file for EnFuzion. The template file contains input parameters. The plan file describes how to run Rayshade and join separately rendered images into one final image. The plan file also describes the necessary input and output files.

EnFuzion and Rayshade had to be installed on all participating computers. The installations were accomplished easily with the EnFuzion installation program.

Rayshade produces an image from a description in a text file. To distribute the rendering of an image over a network of computers, a single line to the Rayshade input text file was added. This line in the text file specifies the line in the image to be rendered. For example, with the screen size:

screen 1280 960

the developers added the following line to the input text file:

window 0 1279 $line $line

At runtime, EnFuzion replaces $line with successive line numbers so that each image line is rendered separately.

The plan file for EnFuzion specifies parameters, execution of the user program and its input and output files. The following plan was used to distribute the rendering of Aquarium over a network of computers:

parameter line integer range from 0 to 959 step 1;
task nodestart
    copy aquarium.ray node:.
    copy granite.map node:.
endtask
task main
    node:substitute aquarium.ray myaquarium.ray
    node:execute rayshade myaquarium.ray aquarium.$line.rle
    copy node:aquarium.$line.rle .
endtask

The parameter statement specifies that image lines range from 0 to 959, therefore 960 jobs are generated at runtime to render the image. The value of $line is different for each job, causing Rayshade to render a different line for each job. The nodestart task specifies files that are required to render the image. These files are copied at runtime to all the computers once, at the beginning of the computation.

The main task substitutes $line in aquarium.ray with the actual line number to obtain myaquarium.ray. myaquarium.ray is different for each job. Next, Rayshade is executed, which produces a single image line. The last statement in task main copies the resulting image back to the main computer.

The task of joining all the line images into a single image is straightforward with the rlecomp command and not shown here. You can obtain rlecomp as part of the Utah Raster Toolkit.

Further information
This application note describes some basic capabilities of EnFuzion. It uses EnFuzion 6.0 release. You can find out more about using EnFuzion from the user manual or on the Axceleon Web site at www.axceleon.com.

 
Copyright © 2002 Axceleon Inc. All Rights Reserved