Rendering
Digital Image Synthesis, Fall 2008

Jump to...

project #2
project #3
final project
assignments


project #1: Accelerator

Assigned: 2008/10/01
Due: 11:59pm 2008/10/26


Project description

This is a two-part project. In the first part, you are asked to replace the ray-sphere intersection with the geometric flavor presented in the class. Note that you should replace both Intersect(...) and IntersectP(...) for Sphere. Please compare its performance and the original one on this scene.

In the second part, you will write an accelerator plug-in for pbrt. Pbrt already has accelerator plug-ins of uniform graid (grid) and Kd-tree (kdtree). You are free to implement any other one, such as hierarchical bounding volume, octree or BSP tree. You can refer to this paper to find out the popular options for ray tracing acceleration and the reference papers for those algorithms. Please notice that your score for this project only depends on the relative rating of your plug-in in the group of those who implement the same algorithm, not the absolute rating of the whole class in terms of execution time. To maximize the number of algorithms implemented by the class, bonuses will be awarded to those who choose the algorithms less students implement. This is basically an individual project. If you want to team with others, please have my permission first.

Write pbrt plugins

To add a plug-in for pbrt, assuming that you are adding a "hiererchical bounding volume" accelerator plug-in called hbv, you will do the following

  1. Add the source file hbv.cpp in accelerator/ directory. (Note that the file name has nothing to do with your class name. However, the file name must be consistent with your plug-in's name)

  2. In Makefile, add hbv into the variable ACCELERATORS. The resulted Makefile will have a line which looks like
    ACCELERATORS = grid kdtree hbv 
    
  3. Type 'make' and you will have the plug-in hbv.so in bin/
To invoke hbv as an accelerator, in your pbrt scene file, add the following line before WorldBegin

Accelerator "hbv"

To extract parameters from the scene file, at the end of the source file of your plug-in, you have something like the following (excerpted from sphere.cpp, the meaning of the above function should be very intuitive.)
extern "C" DLLEXPORT 
Shape *CreateShape(const Transform& o2w, 
                   bool reverseOrientation, 
                   const ParamSet& params) 
{
    float radius = params.FindOneFloat("radius", 1.f); 
    float zmin = params.FindOneFloat("zmin", -radius); 
    float zmax = params.FindOneFloat("zmax", radius); 
    float phimax = params.FindOneFloat("phimax", 360.f); 
    return new Sphere(o2w, reverseOrientation, radius, zmin, zmax, phimax); 
}
For accelerator plug-ins, check the function CreateAccelerator near the end of grid.cpp or kdtree.cpp for examples.

You can extract the parameters for your plug-in by calling FindOneFloat and the like. The interface for extracting parameters from ParamSet is defined in core/paramset.*.

To sum up, for your project #1, your don't have to touch the pbrt kernel. The only thing you need to do is to add a file under accelerators directory, add it into Makefile and invoke it from scene file.

Submission

You have to turn in the source code for your plug-in and a very brief report in html format. The report should describe which acceleration algorithm you have implemented (no need to explain the algorithm if you just follow the original algorithm) and what variants you have used. Most importantly, you should test your accelerators on five designated scenes (balls, buddha, tt, sibenik, plants-directsun) and report the execution times of your plug-in and the standard kd-tree plug-in of pbrt. Please be as fair as possible when measuring the execution time for both plug-ins. For example, you should use the same machine and compilation setting for both. After measuring these ten times, please fill them into this xls file and send it to TA (sula -A-T- cmlab.csie.ntu.edu.tw) with your source file and report. Note that the accelerator I measured in this file is the uniform grid provided by pbrt and it is generally 2 to 7 times slower than kd-tree!

Reference