Ray Tracing, Version 3.2
Day #7

Goal: Ray trace a scene where

  • the only objects in the scene are generic spheres, planes, squares, tapered cylinders, and cubes.
  • the objects may have been translated, scaled, and/or rotated with respect to an axis
  • in addition to color, the attributes of each object may include material coefficients for diffuse, specular, ambient color
  • a positional light may be placed in the scene
  • the light has a diffuse, specular, and ambient component
  • a value for global ambient light may be assigned
  • shadows are correctly rendered
  • descriptions of the objects, lights, and camera are read in from a file, using SDL

Ray Tracing Tools:

Add this new class: Cube. Like all the other object classes, it will have one method: hit. Be sure to test it before entrusting it to your ray tracer. If you would like to have separate classes for cone and cylinder, you may add these. Be sure to calculate the appropriate generic hit normal for each type of object.

ReadScene:

As you add each new generic object to your ray tracer, the readScene method needs to be updated to reflect this.


Test Files:

cube.scn

All files are located in /classes/cs3114/Advanced_Graphics/files directory

Optional:

The ray tracing process should speed up if we use the concept of extents, and the generic cube makes an ideal extent for our other generic objects. In the hit method for each object, first test the inverse transformed ray against the generic cube. If it misses the cube, no further testing is necessary. If it hit the cube, then test it with the generic object. You may not notice much of a speed up yet, but it should be more apparent as our tracer becomes more complex.