CS 551/645: Introduction to Computer Graphics
Assignment #3, part 2
Goal: Environment Maps
URL: http://www.cs.virginia.edu/~gfx/Courses/2000/intro.fall00.html/Assignments/assign3-2.html
Assigned: Thursday, November 2, 2000
Due: Thursday, November 16, 2000 at 9:00 a.m.
Cliff Woolley's Code (which works really well, though it doesn't
do any tricks when intersecting multiple cube faces)
Note you'll have to update the Makefile to change the location of the
INCLUDE and LIB for GL and glut.
Relevant reading/files/software:
Synopsis: The goal of this two part assignment is to generate three-dimensional models with interesting color and texturing. In the first part, you used a program called Teddy http://www.mtl.t.u-tokyo.ac.jp/~takeo/teddy/teddy.htm to create a three-dimensional model. You used Teddy to save a model in OBJ format. Hopefully, your part one code successfully read this model and allowed you to view it in an OpenGL/Glut window. If not, the quickest way I suggest to get up and running is to use Nate Robins's code http://www.xmission.com/~nate/smooth.html.
In part two of the assignment, we will add mouse interaction and textures.
Specifics: As in assignment 3, part 1, your program must accept a filename (ex: foo.obj) as a command line argument. The program must then read the .obj file and create the GL polygons that represent the model. You may use the model you generated with Teddy or you may use another one you find someplace. Nothing too trivial, though.
We want the model to look good, so compute vertex normals. Position at least three lights in the scene to nicely illuminate the model. Include in your README a brief description of the light types you selected and your decisions regarding position/direction.
We will develop a robust way to describe the rotation of the world, quaternions. This topic will be discussed in class, though there are plenty of tutorials on line. Your system must use quaternions to represent the rotation of the world and to support the interaction with the mouse. The entire world, including the cube, lights, and model should move. Conceptually, you are moving the camera. As in assignment 2, the left button of the mouse will be used to control rotations and the right button of the mouse will be used to control zooming.
The OBJ model you load will be enclosed in a six-sided box that you can create using GL_POLYGONs. Pick a size for the box that produces the most dramatic texturing effect. Each of the six sides will have a texture map attached to its inside face. You can hardcode the textures you use, but you will want to write or find a file reader.
You can find images to use as textures in many places. Many web sites include sample textures. Images you've already scanned will work too. If you want to capture a particular image, Brian will have access to a digital camera and he will be able help you grab images during his office hours. The SGI's provide some handy image editing/conversion tools:
Your model should be texture mapped to look like it is reflecting the textures from the walls of the cube, an environment map. To achieve this effect, you will have to compute texture coordinates for each vertex. You can evaluate the texture coordinates by computing the intersection between a vector cast from each vertex (in the direction of the polygon normal) and the cube sides. Some of these texture coordinate mappings will be straightforward, whereas others will not. For example, how do you handle a polygon with vertices that project onto two or three different sides of the cube?
Extra credit will be provided for including extra GL effects or other eye candy. The TA and I are simple-minded and easy to impress with all those cool tricks. Make sure to document your additions in the README file.
Points:
Turning in the assignment:
Collaboration: You may talk with one another about your projects, but one should not take written records during the collaboration. Your recollection of the concepts should be the product of the collaboration. Similarly, no side-by-side coding.