New version page

Purdue CS 53500 - Assignment 1

Upgrade to remove ads
Upgrade to remove ads
Unformatted text preview:

1CS535: Assignment #1 – Camera Projections Out: August 30, 2010 Back/Due: September 13, 2010, 4:29pm Objective: This focus of this assignment is to obtain a good understanding of 3D transformations including translations, rotations, perspective projections, and coordinate transformations. You have two weeks and I recommend you start immediately. You will write a program that draws and animates one or more objects on the screen using wireframe rendering and gives the user basic 3D navigation tools to move the camera within the scene. Summary: The assignment is to implement a program which renders one or more bouncing 2D objects within a rectangular-shaped plane. The objects are to lie in the XY plane at Z=0. The width and height of the plane in which the objects can move is determined by the user. The objects will be one or more of square or triangle (other shapes are optional). The objects will remain completely inside the rectangular plane and will each have an initial position and velocity. Upon hitting the “wall”, the object should bounce. The user will be provided with interactive camera controls and all control is via a GLUI interface. Specifics: (0) Transformations: you will have to write a library and/or object-classes that support basic point, vector, and matrix manipulations (e.g., addition, subtraction, multiplication, dot product, cross product, etc.) as well as 3D transformations including rotation, scaling, translation, and 3D->2D perspective projection. You may *not* download existing libraries. For this assignment you have to create at least a minimal subset of such functionality in order to implement the required operations of the assignment. Note that you might find this library useful in later assignments and thus applying good software engineering principles is good. (1) Camera Navigation: using the GLUI-interface, you will provide the user with the ability to translate and rotate the camera viewpoint around the objects bouncing in the XY plane at Z=0. All assignments should include at least 6 “spinners” to change the XYZ position of the camera and then the roll, pitch, yaw of the camera *at the current position* (note: this is not the same as specifying the roll/pitch/yaw and then specifying the XYZ translation). For this assignment, roll corresponds to rotation about Z, pitch corresponds to rotation about X, and yaw corresponds to rotation about Y (this is in logical agreement with the standard camera coordinate frame of “looking down –z axis with y up”). The moving/bouncing objects should continuously move even if the user is interacting with GLUI controls or not (e.g., use GLUT idle function and/or glutPostRedisplay). (2) Object rendering: each object should be rendered in wireframe and moving continuously. The program shall select a random initial position and velocity for each object (the velocity should be in a ‘reasonable’ range to generate smooth and not excessively slow nor fast rendering). Upon each newly drawn frame, you will have to update the position of the object. An object should *never* leave the interior of the bounding rectangle of the object space. This means that if the object touches or will pass the wall in the next frame, it should “bounce” off the wall. To render an object, you have two options: a) use OpenGL functions2(i.e., glRect, glBegin/glEnd with GL_LINES) but you must do all the matrix multiplication yourself, or b) use a for-loop to render/rasterize pixels along the edges and use glDrawPixels to draw the pixels to the framebuffer. In the former case, you will have to ensure an identity modelview matrix is loaded and that a trivial orthographic projection matrix is used (for this you can create it using glOrtho or by hand). In both cases, the object points/pixels will have to be “projected” from 3D space to 2D space. Use a simple perspective projection transformation for this as explained in class. Please allow the user to change the field-of-view (FOV) of the virtual camera via the GLUI interface. The default FOV should be 60 degrees. (3) For this assignment, you may *not* use OpenGL/GLUT functions for the matrix/vector/point manipulations – you may for rendering functions and “mouse picking”, such as for the optional part below. Also, you may *not* use any downloaded libraries for geometric calculations, manipulations, rendering, or any part of this assignment except as indicated in the template of Assignment #0. You must implement yourself all necessary routines – this ensures you know the basics; in later assignments you can use this code or OpenGL. Extra Credit (15%): The extra credit item is to implement a virtual trackball interface using the mouse. For this item, you will have to use the GLUT mouse and mouse-button callbacks. The trackball interface mimics there being a “sphere” surrounding the bounded plane containing the objects and then the mouse effectively rotates this sphere on which the camera is fixed. When you “left click” the mouse grabs onto the sphere and then as the mouse moves (and the left button is held down), the sphere rotates according to the movement of the mouse. This enables intuitive rotations around the world space. To provide translations, an alternate mode must be provided. Use the right button to specify translations. Thus, when the right button is held down, the XY movements of the mouse correspond to moving the bounded plane within the *current* image plane (i.e., not in its original XY plane but in the current plane corresponding to the image plane for the current camera viewpoint and viewing direction). Scale factors have to be computed to generate reasonable rotation rates and translation rates. Grading: Your program will be tested against the aforementioned functionality and your code will be inspected. In summary, the GLUI should at least contain the following controls: bounded-plane width, bounded-plane height, camera x/y/z, camera roll/pitch/yaw, and field-of-view. For all of these, use GLUI “spinners”. Please note: for camera control, you cannot use GLUI’s built in camera transformation tools (that would, of course, defeat the purpose of the assignment). We will use the interface to alter the aforementioned parameters and expect to see the correct behavior. If the interface does not allow a certain parameter to be changed, it will be considered not implemented at all. If the program does not compile, zero points will be given.

View Full Document
Download Assignment 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...

Join to view Assignment 1 and access 3M+ class-specific study document.

We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Assignment 1 2 2 and access 3M+ class-specific study document.


By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?