WPI Computer Science Department

Computer Science Department
------------------------------------------

CS 543, Fall 2010, Homework 5


Homework 5: Due Friday, December 10, 2010, turned in by 9AM (10/100 points)

Homework 5 Overview

In this project, you will create a ray traced scene with at least two types of geometric objects (spheres and meshes). Your program shall respond to keystrokes from the user and draw an input SDL scene either using SDL (which uses OpenGL) as a preview or using ray tracing.

Note on getting SDL to work: Getting SDL to work is a simple three-stage process (listed below, and explained in Hill, section 5.6). Appendix 5 (pp. 897 - 903, 7 pages, of Hill) is an introduction to SDL. Combining SDL with miniGL affects the second and third stages but not the first. So, here are the steps (with miniGL).


One thing to note is that as discussed in class, ray tracing does NOT use the OpenGL view volume and matrices. Hence, to ray trace a scene, you simply have to set OpenGL up to draw in 2D. To draw the same scene using SDL, you will set things up to draw in 3D (i.e. gluPerspective, etc)

To begin, you should create a simple SDL scene that contains at least 2 different types of objects (spheres, cubes and meshes). Then write a simple program that reads in your scene and renders it using SDL. Once your program launches, the default is to draw (preview) your scene using SDL (i.e. using scn.drawSceneOpenGL). Your program should then respond to the following keystrokes.

  • Behavior of your submitted program: Your submitted program should have the following behavior:

    • User hits 'O' or 'o' (Draw scene using SDL) Draw your scene, using SDL (a fast preview).
    • User hits 'R' or 'r', Raytrace your SDL scene at a blockSize of 1
    • User hits '2', Raytrace your SDL scene at a blockSize of 2
    • User hits '4', Raytrace your SDL scene at a blockSize of 4
    • User hits 'A', Super sample each pixel in your scene at 9 rays (samples) per pixel to reduce antialiasing.
    • Requirements: Your scene should include:

      i) at least one reflective object
      ii) at least one refractive (see through) object
      iii) shadows
      iv) at least 2 light sources with an implementation of Phong's illumination model and
      v) At least 1 mesh should be used in your scene. One of those meshes has to be pawn.3vn.
    Note: Your OpenGL preview scene and the raytraced scene should appear in the same exact location on the screen or else points will be deducted.

    Here are the mesh files you used for homework 3. They should be used in raytracing as specified above. .3vn files: The meshes you will render are in .3vn format. Here are a few .3vn files to work with.

    basicBarn.3vn
    bucky.3vn
    cubes3.3vn
    diamond.3vn
    Dodeca.3vn
    icosa.3vn
    octa.3vn
    pawn.3vn
    Tetra.3vn
    wineglass.3vn


    Create documentation for your programs and submit them along with the projects. The documentation does not have to be unnecessarily long. Simply explain briefly what each file does,how to run it and tie things in nicely. Submit your project using turnin


    [Feedback] [Search Our Web] [Help & Index]

    [Return to the WPI Homepage] [Return to CS Homepage]

    mailto:emmanuel@cs.wpi.edu