CS 312: Computer Graphics -- Assignment 4

Lighting, Materials, and Texture Mapping

Due Sunday, November 7, 2010 by 11:59pm


For this assignment, we will be exploring the use of lighting, materials, and textures in OpenGL.  You will implement a scene using steerable lighting that will illuminate objects of different surfaces.  All objects should be smoothly shaded using Gourand shading specified by vertex normals.  You have several options for completing this assignment, one of which is based on the island driving environment while three others have you create new environments.  Choose only ONE of the following to complete the assignment:

1.)  Improve your island driving program from assignment 3 to display the island in a variety of lighting conditions.  Have your island go from dawn-day-dusk-night-dawn-day-... while the program is running.  Time should cycle through a 24 hour day in approximately 2 minutes and repeat. Add headlights to your car that illuminate the scene while it's dark.  At night, the island should be lit by a low level of ambient light with a higher blue component.  You may also add various stationary lights (lampposts, housing lights, etc.) as appropriate.  Texture the island and several objects on it to make them look realistic.  Your scene should use multiple materials.  You only need to populate a small section of the island with objects; if you choose to do this, then the car should always start in the same location.  If you wish to populate the entire island with objects (logs, rocks, trees, houses, etc.), you may place them randomly.  You are welcome to add fog to the scene to enhance realism of driving on the island at various times of the day.

2.)  Create an enclosed room or set of rooms containing a variety of textured objects.  The theme and specifics are up to you, but keep it simple so that you can focus on the lighting and materials.  The scene should be viewed from a first-person perspective and be able to be moved around the scene, controlled by the mouse.  Your room should have windows or an open roof that enables the room to be lit externally.  Have your room go from dawn-day-dusk-night-dawn-day-... when running.  Time should cycle through a 24 hour day in approximately 2 minutes and repeat. At night, the room should be lit by a low level of ambient light with a higher blue component.  When it is dark, the simulated person will hold a flashlight (the lit end of the flashlight should become visible at the bottom of the scene) which can always point forward and will be moved around to illuminate the scene.  You may also add various stationary lights (lamps, etc.) as appropriate.  Texture the room and several objects in it to make it look realistic.  Your scene should use multiple materials.

3.)  Create a 3D fishtank or terrarium containing a variety of rocks, plants, coral, and other appropriate objects.  Keep it simple, so that you can focus on the lighting and materials.  The left/right arrow keys should pan the tank back and forth up to 45 degrees.   The aquarium lights should go smoothly from dawn-day-dusk-night-dawn-day-... while the program is running.  At night, the tank should be lit by a low level of blueish ambient light.  Time should cycle through a 24 hour day in approximately 2 minutes and repeat.  At night, the user can turn on and off (via the space bar) two steerable lights in each of the front top corners of the tank that focus together at a single point in the tank (i.e., the point is where the beams cross).  The user should be able to move this focus point around the tank using the mouse to illuminate different parts of the scene.  You may also add various stationary lights as appropriate.  Texture the objects in the tank to make them look realistic.

4.)  Create a 3D theatrical "black box" stage containing a variety of set pieces.  Keep it simple, so that you can focus on the lighting and materials.  The left/right arrow keys should pan the stage back and forth up to 45 degrees.  The lighting should go smoothly from dawn-day-dusk-night-dawn-day-... while the program is running.  At night, the stage should be lit by a low level of blueish ambient light.  Time should cycle through a 24 hour day in approximately 2 minutes and repeat.  The user can turn on and off (via the space bar) two steerable lights in each of the front top corners of the stage proscenium that focus together at a single point on the stage (i.e., the point is where the beams cross).  The spotlights may be used at any time of the simulated day.  The user should be able to move this focus point around the stage using the mouse to illuminate different parts of the scene.  You may also add various stationary lights as appropriate.  Texture the objects on the stage to make them look realistic.

If you have another idea for a scene you'd like to create for this project, you MUST run it by me first and fully describe it similarly to how I've done above.  I will only approve it if it matches the character and difficulty of these other four options.

Regardless of the option you choose, your scene must include the following elements:
  1. One or more spotlights that can be controlled by the user to illuminate different parts of the scene.
  2. Global lighting that goes through the daily cycle in accelerated time.
  3. Objects of at least three different materials, including at least one texture map.
  4. Smooth Gourand shaded objects using vertex normals.

As always, there will be points for creativity, effort and realism.


Submitting the Assignment

Submit your C or C++ program, all source code, the Makefile, and any other files necessary to run your project.  I must be able to type make on the CS systems and have it produce an executable for grading.  Name your executable "assn4".

Include a README file in your submission describing the various materials and textured objects in your scene.

In your comments, include information about the computer platform (hardware and OS) you used to develop your program, and be sure to include additional comments as needed to describe your code.  A good rule of thumb is that someone should be able to remove all code from the file and recreate a rough semblance of the result from your comments.

If you developed on somewhere other than the cs systems, be certain that your program runs correctly on the cs systems where it will be graded.  Leave time for this step!

Place all submitted files into a directory named LastnameFirstname-Assn4. Then create a tar archive of that directory, such that the tar file expands to the directory (not a bunch of files). Copy that tar archive into ~eeaton/submit/cs312/username/ (where "username" is your cs system username) to complete the submission.

Be certain to use the names specified above for the directory and tar archive!!


Extra Credit Opportunities

The following are some ideas for extra credit for this project, but you may also explore others of your own choosing.  The maximum amount of extra-credit is noted next to each item.  Completing the extra credit will not be accepted in lieu of completing the main assignment.

Be sure to include a README file in your submission describing your extra credit additions and how to use them.

  1. (up to +25%)  Add animated or interactive objects to your scene.  Animated objects move around on their own while the program is running; interactive objects only move when you trigger them.  Examples animations with the corresponding option number: boids (option 1), trees that wave in the breeze (option 1), robots that run around (option 2), a clock with swinging pendulum (options 2 or 4), fish swimming in a simple motion (option 3),  a clam that opens and closes (option 3).  Example interactions with corresponding option number:  trees that fall when you run into them (option 1), a table or chair that you can push around (option 2), a clam or treasure chest that opens when the spotlights shine on it (option 3),  a door that opens when the spotlights shine on it (option 4).
  2. (up to +25%) Add a bump map to an object.
  3. (up to +5%)  Smoothly change the color of the global lighting in response to the time of day.  For example, the light could move smoothly from bluish at night to red/gold at dawn/dusk to more yellow-white in the afternoon.
  4. (up to +8%)  Option 1 & 2 only:  Prevent the user and the camera from moving through objects.  I suggest doing this by using a rectangular bounding volume on the objects.
  5. (up to +4%)  Option 3 & 4 only:  Add user control of the spotlight angle (using the up/down arrow keys) and intensity (using the -/+ keys).
  6. (up to +4%)  Option 3 & 4 only:  Let the user zoom in and out of the scene using a method of your choice (include instructions in the README file).