Math 155B - Spring 2001
Getting Started with the Ray Tracing Project  

    For the new version of   the ray tracing software with Bezier patches, there is a new directory with all the new code  See the instructions in red below for the differences in using it instead of the original code.   There is no reason to switch to the new code other than support for Bezier patches.

To get started using the RayTrace project, you should be aware that it is broken into four projects, all contained in the single RayTrace workspace.   The three projects are:

  1. Two top level  projects RayTrace and RayTrace2.  This is the level at which the scene is described (in terms of lights, materials, and viewable geometric objects).  The source files RayTraceData.cpp and RayTraceData2.cpp specify these items.   In addition, the recursive ray tracing algorithms are implemented in the main programs RayTrace.cpp and RayTrace.cpp.

  2. The second level is the the Graphics project.   This contains the implementation of the lighting model calculations and the geometric intersection routines.  It also contains the implementation of the pixel array.   Most of you will not need to look at this, except  at the .h header files to learn more about the interface.

  3. The third level is the VrMath project.  This has low level linear algebra routines.  Most of you will not need to look at this at all.

Getting started:  You should first set up your own copy of the RayTrace project.  For this, do the following:

  1. Copy the the folders P:/RayTraceProjects/RayTrace and P:/RayTraceProjects/RayTrace to your H:Projects folder.  (It is best to use exactly these names, otherwise, you will have to do extra work in telling Visual C++ where to find files, etc.).  You should not need to copy Graphics or VrMath if you are doing all your work on insci14.
    For the new version
    , make a folder P:/Projects/NewRayTraceProjects.   Copy the two folders H:/NewRayTraceProjects/RayTrace and H:/NewRayTraceProjects/RayTrace2 into this new folder.
  2. Open the RayTrace workspace (using the RayTrace.dsw file).  You will see that it includes four projects, RayTrace, RayTrace2, Graphics, and VrMath. 
  3. Compile and run the program (either RayTrace or RayTrace2).  It should open a very small window.  After 5 seconds to a minute, a picture will appear in the window.  Refrain from making it bigger at this moment.
  4. Right-click on a blank area in the menu bars, and turn on the Build menu (you can close the redundant MiniBuild menu if you wish).  Notce how you can change from Debug to Release mode.  The first allows debugging as usual.  The second one creates optimized code that runs about three to five times as fast.  You should debug your code using Debug mode of course, but use Release mode when creating larger, slower images.
  5. You may find it handy to know that Shift-F5 (in the C++ compiler window) will halt a running program, in case you accidentally start too long of a calculation.  You can also halt the program by closing the console window that opens with the application.

If you transfer files to a home computer, or otherwise do not follow the above directions: You will have to tell Visual C++ where to find the various projects: if necessary, remove the projects from the workspace and then re-add them.  In addition, Visual C++ may not be able to find the right source files: in this case, remove them from the project and then re-add the correct files..  The programs RayTrace.cpp, RayTraceData.cpp, RayTrace2.cpp and RayTraceData2.cpp explicitly mention the P:RayTraceProjects path name, so you will also have to change various #include commands to get the correct header files.

You can save time copying or transferring files if you do not transfer the contents of the Debug or Release directories, or files that end with .opt or .ncb.