COMP 4004: Advanced Computer Graphics (REVISED Jan. 25, 2006)

Slides:

Lecture 1: Introduction
Lecture 2: Files, Widgets and Coding
Lecture 3: Keyframing and Interpolation
Lecture 4: Complex Numbers and Quaternions
Lecture 5: The Arcball and Quaternion Interpolation

Reference Material:

The OpenGL Programming Guide (the Red Book), Version 1.0 (OpenGL 1.0). OpenGL is now up to 2.0 (Red Book 5th edition), but for the purposes of this course, this web version is nearly complete.
The OpenGL Reference Manual (the Blue Book), Version 1.0. Again, the current version of the Blue Book is 2.0, but this web version is good enough. The Blue Book consists principally of the man pages for the various OpenGL functions.

Assignments:

Coding Rules: All code used must be your own, must be code provided to you on this web page, or (support) code in the form of free cross-platform libraries. See Lecture 2 slides for details. You may also use code from COMP 3003.

A0: Rendering a Character (Worth 10%).

The task is to read in an ASCII text file describing a character and render it on screen. All of this should be feasible based on your work in COMP 3003 last year. You should set up a new GLUT main.cpp file instead of reusing files from COMP 3003. You will be marked on code quality and comments as well as output.

Due: Friday, February 3, 4:00 pm.
  1. Read in the ASCII text file. See Lecture 1 slides for details of format.
  2. Render the character in a window with correct normals & shading.
  3. Document your code appropriately.

A1: Interpolation (Worth 10%).

Part I: Rotation
Download A1_rotate.zip . Add a makefile and compile it. When you run it, specify a file on the command line: e.g.
A1_rotate m2/747.m2
This code has the following features: Part II: Bezier Curves
Download A1_bezier.zip. Add a makefile and compile it. The only key command is 'q' to quit. The mouse drags the individual points around. You should edit the display() routine so that it correctly displays the control polygon and the bezier curve. It would be nice if it also had an option for turning the control polygon on & off.

A2: Flight Simulator with Collision Detection (Worth 15%).

Part I: Flight Simulation
Download A2_flightsim.tar. This code sets up some random bricks in 3 dimensions (in space), and renders them with three grids (x = 0, y = 0, z = 0). Add to this code to get the simple flight simulator discussed in class. There are three distinct ways of doing this:
Part II: Collision Detection
Implement collision detection between your plane and the bricks you see floating in space. They each have a flag, isWireFrame. When you detect a collision, set this flag to true, and the blocks will render in wireframe. You should be able to fly around the environment turning blocks into wireframe by flying through them.
Since the bricks are convex, the test discussed in class for testing whether a point is outside a triangle should be all you need. Conveniently, the bricks are stored as a set of triangles, and the triangle class now has a routine Outside() which performs the test for you.
Your plane should be 4 units long, 1 unit wide and 1 unit high (i.e., it too can be represented as a brick), and you may find that the simplest approach is to add a function to the Brick class to test whether two bricks intersect. Due Date: Monday, March 13, 4:00 pm.

A3: Reflecting Pool (Worth 20%).

In this assignment, you will be creating a small scene with several effects, roughly similar to this:

Shadow Pool

Part I: Shadows
Download A3_shadowpool.tar. This code is based on the running man assignment from COMP 3003, and renders a running man next to a hole in the ground representing a reflecting pool. The 'a' key can be used to turn the animation on and off. Speed of the animation can be controlled with the '+' and '-' keys. The position of the sun can be controlled with the arrow keys.
You should implement projected shadows to draw the running man's shadow on the ground.

Part II: Reflection
Implement reflection so that the man is reflected in the pool as he runs. As discussed in class, the equations are simplified because the ground plane is z = 0, and the existence of the green ground means that you do not need to use stencil buffer tricks to restrict the drawing. As a bonus, if you rotate the scene, you can see the man's reflection running upside-down underground. Remember also that you must flip the light position as well as the man.

Part III: Trees
Implement a method for drawing a tree procedurally, and place at least one tree in your scene so that it's reflection is visible in the pool. Remember to cast its shadow as well. You will probably find the function drawTaperedCylinder() to be extremely useful for drawing parts of your tree.

Part IV: Rain
Add a particle system to draw rain.

Part V: Optimization
At this point, especially if you have multiple large trees, your animation may be running quite slowly. How would you optimize this scene? You do not need to write the code for this. Your solution should be contained in a text file called A3_Q5.txt.

Happy coding!
Due Date: Friday, April 28, 5:00 pm.

Installing OpenGL on your home machine:

Students are encouraged to install OpenGL on their home machine, as this reduces dependence on a fixed lab time. Installing OpenGL &/or GLUT is up to the student: difficulties installing & / or running at home will not be taken into account when determining grades.

Information on installation on various platforms is given to help you get started. For further information, or if you are having trouble installing, please talk to the lecturer.

Windows

If you are running Windows 2000 or later, OpenGL should already be installed, but you will still have to download and install GLUT. Go here for details. Earlier releases of Windows may require separate installation of OpenGL.

Mac OS

If you are running OS X, then OpenGL and GLUT should already be installed, although versions of OS X prior to 10.2 had some problems with GLUT. You will have to install the Developer Tools if you wish to compile on OS X. These can be found either on one of the installation CD's, or at Apple's Developer web site.

Linux

If you are running Linux, there is no official implementation of OpenGL. There is however an open-source workalike library called Mesa 3D. It is nearly 100% compatible, and will certainly be sufficient for this course. Unfortunately, Mesa 3D renders in software, not in hardware, and is quite a lot slower, unless you also install a suitable set of hardware drivers. For nVidia cards, start at nVidia's driver page. For ATI cards, start at ATI's driver page.

Everything Else

For other operating systems, Mesa 3D will probably work, but there may be O/S-specific solutions available.