FART is my semester project for the Computer Science 658 class at Grand Valley State University. My goal is for FART to be a distributed, fault-tolerant, object-oriented raytracer. The name is a recursive acronym similar to GNU or LAME.
The input to the program will be a scene description file. Scene description files are structured ASCII documents. The format is a hierarchical layout of scene options and elements. After the scene file is parsed, the scene will be raytraced (rendered) according to the render options. Some of these options can be specified on the command line and others can be specified in the scene description file. When a given option can be specified both places, the command-line options will override what is in the scene file.
Rendering can be done using the built-in task distribution infrastructure. Command-line options will be utilized to specify a "hosts file" which can contain a list of hosts to use while rendering the scene. The algorithm is fault-tolerant so that if any of the worker nodes goes down the tasks can be reorganized so other nodes complete what the faulty nodes did not.
I used an object-oriented model for the program. Each displayable scene object is represented by a C++ object which inherits from the Shape base-class, while light objects inherit from a base Light class.
Shape objects implement an intersect() method. Polymorphism is utilized so that when the scene attempts to intersect a Ray with a shape object, it does not need to know the actual type of shape object being intersected with.
The task distribution infrastructure is implemented in a class called distrib. This package contains methods to start up a server thread, launch slave processes on the worker nodes, and connect back from the slave processes to the master server.
The design document for FART is available here.
To create a scalable parser to read scene files according to a grammar that I supplied, I used the bison parser generator. I used bison because it is very portable and worked directly with my C++ code. The parser produces a hierarchy of Node objects. Each Node object represents some part of the parse tree obtained from the scene description file. Thus, the parse tree can be traversed after parsing is complete in order to evaluate all of the scene objects specified in the scene file, maintaining node order and parent/child relationships.