Ray Tracing, Version 4.1
*Adding 2D Texture (From Image File) to the Sphere

Goal: Ray trace a scene where

  • the only objects in the scene are generic spheres, generic planes, generic cubes, generic squares, and generic tapered cylinders, which may have been
    • scaled
    • translated
    • rotated with respected to an axis

  • in addition to color, the attributes of the generic primitives may include material values for diffuse, specular, ambient color
  • in addition to material attributes, the plane, the square, and (*15) the sphere may be textured with a 2D image.
    • the image is defined in a ppm formatted file

  • a positional light may be placed in the scene by specifying its position
  • the light has a diffuse, specular, and ambient component
  • a value for global ambient light may be assigned
  • the intensity of lights may be attenuated by including values for
    • constant attenuation factor
    • linear attenuation factor
    • quadratic attenuation factor
  • a spotlight may be placed in the scene by specifying its
    • position
    • spot direction
    • cutoff angle
    • spot exponent

  • shadows are correctly rendered, including on textured surface
  • speedup: extents are used around each generic primitive (generic cube around the generic primitive is test first; if hit, then primitive is tested)
  • the camera is set up
    • at position (eyex, eyey, eyez),
    • looking at point (look_atx, look_aty, look_atz), with
    • the original up-direction for the camera being <upx, upy, upz>.

  • speed-up has been accomplished by more wisely computing the ray's direction, for each ray.
  • 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