Interactive Graphics

Tuesday and Thursday 3:30pm-4:45pm

719 Broadway, room 1221.

Denis Zorin, office hours: Thursday 5-6 pm and by appointment

TA: Yotam Gingold, gingold@cs.nyu.edu, office hours: Monday, 3:30-4:30.

Description

This course is an introduction to interactive computer graphics techniques, with primary focus on techniques used in computer games. Topics covered (time permitting) will include 2d interactive techniques, sound, 3d graphics basics, game physics, and AI for games.

Prerequisites

All programming assignments must be implemented in C or C++, with a strong preference for C++. Some familiarity with basic linear algebra (vector operations, matrices) will be assumed.

Requirements

Assignments. There will be four programming assignments (this number may change, as I may split some into subassignments). These will count for 80% of the grade.

Midterm and final. There will be no midterm; the midterm grade will be determined based on assignments. There will be a written final, primarily focused on geometric foundations of 2d and 3d graphics techniques.

Reading materials

There is no textbook. All necessary course materials will be posted on this page.

Software

We will use only cross-platform tools. You can use either Windows or Linux, but please avoid introducing operating system dependencies into your code. The focus of this class is on fundamental principles and techniques; thus we will use the simplest available APIs, to minimize the time you need to spend learning API details.

Compilers. Linux users are likely to have gcc installed; if you need help with installation please contact the instructor. For Windows machines you can either use gcc with cygwin, or Micorsoft Visual Studio. If you do not own a copy, you may be able to get one for free through MSDNAA (declaimer: this is a new service, and I do not know how it works in practice). Update 9/14/04. The person from ITS in charge of this program has told me that software will be available on 9/20; you need to send a request with your name and netID to the e-mail address listed on the program page to get it.

OpenGL. All graphics programming will be done in OpenGL. It is a standard part of any recent Microsoft OS; a package may need to be installed for Linux. If you need help with this please contact the instructor. The Web site www.opengl.org contains many useful links and references.

GLUT. OpenGL provides functions for drawing 2D and 3D objects, but no support for window operations and user input. GLUT is a simple cross-platform package that adds functions for opening windows and processing keyboard and mouse input. Detailed information and downloads can be found on the GLUT Web page

GLUI. Neither OpenGL nor GLUT provide support for standard GUI elements (buttons, sliders etc) GLUI is a cross-platform C++ library that provides such functionality. All GUI objects are implemented using OpenGL, and can be easily integrated with 2D and 3D graphics.

ImageMagick is a comprehensive image manipulation library. We will use it primarily to be able to load images into our programs to be used as sprites or textures. It can be downloaded from www.imagemagick.org. When installing windows binaries, make sure you choose the option to install the headers and libraries.

OpenAL is is a cross-platform 3D audio API appropriate for use with interactive applications. It provides basic tools for 3D sound. The documentation for OpenAL can be found at www.openal.org. The SDK for Windows and MacOS X can be downloaded from Creative Labs developer site. Linux binary packages are also available for various distributions of Linux.

Assignments

Late policy: No extensions will be given on the day the assignment is due, all extensions (excluding emergencies) should be requested at least 3 days in advance. The penalty for assignments up to 2 days late is 10%; uo to a week late, 20%; up to two weeks late, 40%; no points will be given for assignments submitted more than two weeks late.

Assignment 0. Due: September 16.
1. Install (if necessary) OpenGL and GLUT on your computer. Make sure you can compile template.cpp
You do not have to submit anything for this part.
2. Write a detailed plan for a 2D game you are going to implement. Please follow (to the extent it is possible for the game you describe) the plan for Pong. You may want to take a look at variants of some classic games; a few can be found on the web (ask me for links if you cannot find any).

Assignment 1. 2D game. Implement the game that you have described in your plan. Please make sure you take my comments into account. Requirements and submission instructions.

Assignment 2. Due: October 22. Images and sounds. Add images and sounds to your game. Requirements and submission instructions.

Assignment 3. Due: November 4. 2.5D game. "Three-dimensionalize" your game. Requirements and submission instructions.

Assignment 4 plan. Due November 23. Write down your plan for assignment 4, following the pattern for the plan you wrote for the 2D game. You may choose to develop further the 2D game you have, (but, unlike assignment 3, it should have real 3d scene and motion) or put together something completely new.

Assignment 4. Due: December 8; dealine extended to December 13. 3D game. Requirements and submission instructions.

FinalThursday, Deceember 16, 4:00-5:50pm, rm 1221 715 Broadway (same as class). The final exam will include questions on topics covered in the lecture notes.

Lectures

September 7 Introduction and history of computer games.
September 9 First example: Pong.
A GLUT appliction skeleton
A 2D vector class
A 3D vector class
The moving square code
The makefile for cygwin
September 14 Pong continued; bouncing the ball.
Slides with formulas
The bouncing ball code
September 16 Pong continued; paddles. Overview of the OpenGL pipeline and transforms.
The complete pong code
VC 6.0 project file
Ch.2 from E. Angel's book "OpenGL primer".
September 21 2D linear transformations. Homogeneous coordinates. Transformation hierarchies.
Slides
Sample transform code
VC 6.0 project file

September 23 Loading and drawing raster images. Blending.
Sample code using ImageMagik
VC 7.0 (.NET) project file Please note: the precompiled ImageMagick libraries work with VC 7 only. I will try to provide libraries for VC 6.0
Winnie the Pooh image

September 28 Drawing images using texture mapping.
Sample code for texture mapping
The project file is the same as for the previous lecture.
Images for textures: image 1, image 2, image 3.
4d vector and 4x4 matrix templates: cvec4t.h, hmatrix.h, testhmatrix.cpp.
If you want to edit alpha cannel in png images in Photoshop 6 or 7, get a plugin here. Adobe's new PNG import converts alpha channel to transparency.
September 30 Image filtering and texture mapping.
Slides
October 5 Mipmapping.
Code with checkerboard examples
October 7 Sound; OpenAL.
Sample OpenAL code
VS 7 project file
Sound files: mono.wav stereo.wav ding.wav Footsteps.wav wave1.wav wave2.wav wave3.wav wave4.wav
October 12 Ken Perlin's lecture.
October 14 Sound continued. Overview of 3D.
Pong with sound source VS 7 project file Tennis sound Crowd sound
October 19 3D viewing. Projection matrices and camera positioning.
Lecture notes.
October 21 3D viewing continued. Multiple views.
Sample code for 4 views.
VS 7 project file
October 26 3D viewing continued. Moving the camera: navigator interface.
Sample code for navigator.
Note: visualization of camera frustum in 3 orthogonal views added after the class. This code uses hmatrix.h in addition to vector classes.
October 28 3D viewing continued. Moving the camera: trackball interface.
Sample code for trackball.
Note: the files cvec3t.h and hmatrix.h was updated to fix some typos, make sure you load the new versions.
November 2"Three-dimensionalizing" a game.
pong3d.zip
2.5 dimensional version of pong. In addition to the code discussed in class, a texture example is added and a "ball camera": pressing "b" in the lower-right window switches between trackball and ball camera view.
November 4Texture mapping in 3d.
texture3d.zip
Texture examples in 3d: a texture mapped cube around the scene to create a background; texture mapped ball.
November 9Point dynamics, forces, collisions of point masses.
November 11Rotations in 2D, angular kinematics and dynamics.
Physics references:
Several inroductory articles and a bibliography by Chris Heckler.
SIGGRAPH course notes by A. Witkin and D. Baraff, more advanced.
MyphysicslabA collection of Java applets with detailed explanations by Eric Neumann.
A particle system API by David McAllister with good examples.
November 16Collision response for rigid objects, rotations in 3d.
November 18Collision response for rigid objects, rotations in 3d, continued.
November 23Sample rigid object simulator code.
2D simulator source code
VC 7 project file
zip archive with 3d simulator source
November 30Complex objects in interactive applications. SMD file format, MDL viewer.
Zip archive with source code for mdlviewlib library (extracted from Half-Life SDK).
Zip archive with sample code using mdlviewlib; includes the library compiled for Windows.
A document from Half-Life SDK with file format descriptions etc. (mostly about how to use 3D Studio Max, but Mikshape3D also works and is much more affordable).
Milkshape3D Web site.
How to make an mdl modela step-by-step explanation. A dummy texture in correct format.
Complete Half-life SDK
December 2Collisions: different object types: spheres,boxes, planes. Object fragmentation. Springs.
December 7Mesh data structures and operations on meshes.
Lecture notes.
Mesh libraries: OpenMesh
GTS
CGAL (includes much more)
3D model web sites:
3D Cafe
Turbo Squid
The 3D Studio
Planet Half-Life
Avalon
December 9Game AI: path fining, flocking
A survey of path-finding methods (free registration required).
An A* algorithm tutorial by P. Lester.
Craig Reynold's boids page and his OpenSteer software.
December 14

Denis Zorin