Specular-Inclusive Radiosity


The components listed and described below are the result of our breakdown of the specular-inclusive radiosity renderer project.

.ray parser

We'll use a subset of the standard .ray file format. The first implementation of our renderer will need to handle #vertex #rectangle and #material directives. The format for #vertex and #rectangle will remain unchanged, but #material may be modified to reflect a slightly different lighting model. We'll be leaving out the #group directive at least initially because of the complexity it introduces when tracking local vs. global coordinates. Future additions should start with a #triangle primitive and group transfomations, along with other primitives.

Our plan is to take the .ray parser from CS155 Fall 2001 project 2, the ray tracer project, and to remove all the functionality we don't need.

patchifier

The patchifier is a processor on the input scene that splits all the primitives into patches of some maximum height and width. It'll be easiest with rectangles, so that's all our first implementation will handle. Future additions should include the ability to split other primitives like triangles, spheres and toruses.

  foreach rectangle
  {
    m = ceil(width  / max);
    n = ceil(height / max);
    patches = new Patch[m*n];
  }

radiosity renderer

There are two parts to the radiosity renderer in this project. The first part is executed only once per scene, and will handle a bit of preprocessing to set up all the appropriate pixel-patch links. The second part is the iterative algorithm that will propogate light throughout the scene, and must be executed multiple times for the scene's lighting to converge.

First, the preprocessor. Each patch will store a u*v grid of pixels which will represent the hemisphere of the world from that patch's center pointing in the direction of patch's normal. Each pixel will store a color and a list of the patches that are visible through that pixel, along with respective form factors for each patch. The preprocessor must create these pixels and the list of patches and form factors for each pixel.

  foreach patch
  {
    make hemisphere
    make list of visible patches
    associate visible patches w/ hemisphere pixels
    calculate visible patches form factors
  }

Second, the iterator. On each pass it will propogate all the exident light from each patch to all the patches' incident light. It will then recalculate the exident light from each patch, which can be used to view the scene and calculate the next radiosity pass.

  pass i
  {
    foreach patch
    {
      get incident light from pass i-1
      store exident light in hemisphere
    }
  }

ray tracer

The ray tracer will be used to render a view of the scene after each radiosity pass. Radiosity only calculates lighting values for each patch - in order to visualize the scene, a traditional ray tracer is still needed to specify a camera position and make a 2D projection. A polygon renderer like OpenGL could be used, but interactivity isn't a goal for this project and since the ray tracer won't have to do any recursive ray casting, it ought to be relatively quick.

Our plan is to take the ray tracer from CS155 Fall 2001 project 2, the ray tracer project, and to remove most of the functionality so we have a small and basic block of code to use. Minimizing the clutter will hopefully make errors less likely.

To help speed up ray tracing, each surface primitive (rectangles, triangles, etc.) will be treated as a group object when intersecting. That way, the ray will first find the correct surface it intersects with, and then can intersect with the patches inside to find exactly where the intersection occurs.

  foreach ray
  {
    intersect with rects
    within rect, get correct patch
    get patch color for viewing angle
  }

All materials copyright 2002 Harvey Mudd College