Assignment 3 Ray-tracing Solution




Write a ray tracer, demonstrate its operation by generating several scenes, and provide a description (see Notes, Point 1). (Quality of the code, the description, and complexity of the generated scenes are factors affecting the mark.)

Basic features

  1. The basic version of your ray-tracer should support:

    • object types: spheres, triangles;

    • Phong lighting model;

    • shadows;

    • reflections (recursive).

  1. Input format: In the basic version of the program you can specify the scene and the viewing parameters in the ray-tracer code.

  1. Output format: The resulting image can be output to the screen (and captured using a standard utility) or to a file and displayed using a standard image viewer. In any case, the user should be able to specify the desired width and height of the resulting image through the command line or an input file.

Advanced features

If you have implemented all basic features, you may choose one or more options from the list below. Each of this features is worth a bonus of up to 10 % of the total assignment mark (= 1.25 of the total class mark).

  1. Support refractions (recursive);

  1. Extend supported object types to polygon meshes with interpolated normal vectors;

  2. Support textured surfaces. The textures may be read from a file and/or be procedural;

  3. Read viewing parameters and scene description from a file (e.g., in the .obj format, cf. Assignment 2);

  4. Support antialiasing through supersampling;

  5. Support extended (area) light sources;

  6. Support rendering with the depth of field;

  7. Create an OpenGL previewer of the scene (this option can only be chosen only if Option 4 has been implemented as well).



  1. Due to the relatively slow speed of ray-tracing, submit at least three images produced by your ray-tracer together with the ray-tracer code, data files (if used) and documentation (a README file). The README file should include an outline of your program and a description of the features demonstrated in each image you submit.

  1. It is up to you to decide on an output file format. One possibility is to use an existing library for bitmap format such as .png, .bmp, .pcx or .ppm to save the output, then view it using a standard viewer. Another alternative is to display the result in OpenGL and capture the screen to be saved on disk.

  1. All your source code must be written in C/C++. Your source code must compile on the lab machines in MS 239 without any special modifications. Your source code must be clear and well commented.

  1. You are allowed to reuse source code that: (a) has been provided by your CPSC 453 TA for use in the course, (b) has been written by you for another assignment, or (c) you have received permission to use from your TA prior to handing-in your assignment.

Other sources are not acceptable for reusing. You are not allowed to share your code. Any instances of code reuse by you for this assignment must be explicitly mentioned within the README.pdf file.