Ray Tracing, Version 5.0
Day #14

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
  • in addition to material attributes,
    • all the objects may be textured with a 2D image
    • all the objects may be textured with a 3D generated texture, such as wood and marble
  • the images are defined in ppm formatted files
  • multiple lights may be placed in the scene
  • each light has a diffuse, specular, and ambient component
    • each light may be
      • positional, specified by postion
        • positional spotlight, specified by
          • position
          • cutoff angle
          • spotlight direction
          • spot exponent
      • directional, specified by directional vector
  • the light may be attenuated, specified by
    • kc, constant coefficient
    • kl, linear coefficient
    • kq, quadratic coefficient
  • a value for global ambient light may be assigned
  • shadows are correctly rendered, including on textured surface
  • descriptions of the objects, lights, and camera, as well as the names of the image files, are read in from a file, using SDL
  • value for backgroundColor is now read in from the scene description file, using SDL
  • the ray tracer correctly handles reflections
    • value for maximum recursive depth (for calculating reflections) is read in from the scene description file, using SDL
    • value for "shininess" of an object (0.0 to 1.0) is read in from the scene description file, using SDL

Ray Tracing Tools:

and change its constructor so that it initializes recurse_level to 1.

Scene:

and change its constructor so that it is initializes to 1.

 

Examples:

Example files are in /classes/cs3114/Advanced_Graphics/files/reflection and use the usual assortment of ppm files.

refl_1.scn (uses maxRecursionDepth = 1; no reflection)
refl_2.scn
(uses maxRecursionDepth = 2)
refl_3.scn (uses maxRecursionDepth = 3)
refl_4.scn
(uses maxRecursionDepth = 4)
refl_5.scn
(uses maxRecursionDepth = 5)
refl_globe.pos.scn
(uses positional light, square is textured and reflected onto the sphere)
refl_globe.dir.scn (uses directional light)
refl_globe.pos_above.scn (uses positional light, as viewed from above the scene)
refl_globe.pos_reverse.scn (sphere is textured and reflected onto the square)