The due date for this project is Feb. 29, 2008 at 11:59pm.
The goal of this project is create a simple animation. Your animation must have the following elements:
Examples:
Your goal in this assignment is to produce a simple animation. Your models must have at least 6 moving parts. For example, the 4 legs/arms of your animal models can be moving, the head might be moving from side to side, and the ears or mouth might also have small movements. Be as creative as you can. The limbs may be translating, scaling, or rotating. Some of the motion must be rotational. You can use OpenGL functions glTranslate, glRotate, and glScale. The entire model must also be moving, such as walking/crawling down a road or up a hill along a cubic curve.
You may hardcode a simple model in your program using OpenGL, such as the simple car shown below which has 4 movable parts. Use different colors on the faces of the rotating components so that it is clear that rotation is occuring.
The viewpoint should operate in 2 modes: (1) from an external viewpoint (third-person view) looking at the model (as shown in the figure below), and (2) from the viewpoint of the "head" of the moving object (first-person view). The user should be able to toggle between these modes by pressing the v key.
When the viewpoint is in first-person mode, the position of the viewpoint should be the same as the object's "head", and the orientation (view direction) should be aligned with the direction of motion as described in walking/crawling such that the view direction faces foward along the curve of motion.
When the viewpoint is in third-person mode, the viewpoint should be changed by rotating the eye point around an axis and zooming-in and out, as seen below. The viewpoint should be rotated when the user presses the up/down/left/right arrow keys, and zoom-in/out when the user presses the page-up/page-down keys. If you use other keys, include instructions in a README file on how to change the viewpoint. Use the OpenGL function, gluLookAt, to change the viewpoint.
Include environmental components such as the lines that form a road, trees using polygons with multiple vertices and colors, clouds, etc. Your models must be in 3D. You need not have all the suggested environmental components (road, trees, clouds), but part of your grade will be based on the complexity of your environment. You must, however, at least draw the road or path (in the form of a cubic curve) on which your animal walks. See below.
Have your animal walk along a cubic curve and orient the animal such that it faces forward along the curve. For example, if you've got a hill along which your animal walks, it should not just be translated up the hill. It needs to face up the hill.
What this requires is a cubic curve (Hermite or Bezier) that defines the path along which the animal moves. In order to orient your animal correctly, you will need to take the derivative of the curve so that you get the tangent vector. Your animal needs to be aligned with this tangent vector. You can do so by taking the dot product of this vector with the current alignment of your animal. The angle between the 2 vectors (previous alignment and old alignment) is:
angle = arccos (dot (previous_tangent, new_tangent));
Rotate your animal according to the computed angle. 5 points will be given if your creature translates, but does not translate on a cubic curve. Another 5 points will be given if your creature translates along a cubic curve but does not rotate to face forward during translation.
Note that when the program is running in first-person view mode, you will use the tangent vector to define the view direction (look-at parameter).
The sample code (and corresponding makefile) shows the perspective view of a rectangular cube rotating about its center. If you so choose, you may modify the perspective viewpoint using the OpenGL functions (glFrustum, gluPerspective). The sample code shows uses of the OpenGL functions mentioned as well as how to handle key presses (see the Key and SpecialKey functions in the code). Manual pages on the OpenGL functions (gl and glu functions) can be found at: Manual Pages
Use the OpenGL matrix stack (glMatrixMode(GL_MODELVIEW)) and OpenGL functions for rotation, scaling, and translation (glRotatef, glTranslatef, glScalef ) in order to move the components of the model.
Use the function, gluLookAt , to modify the viewpoint.