CS 6491, Fall 2006

Project 5: Subdivision Surfaces

Due: Friday, December 8, 2006, 11:59pm


Objective

This project is about smooth surface creation using the Loop subdivision technique. You will write a program that reads in a polyhedral model and subdivides it a specified number of times. Your program will then rotate two models on the screen: the original flat-shaded model and the subdivided smooth-shaded surface.


Program Specifics

Your program should accept two command-line arguments: After your program has read in the model, it should first pop up an OpenGL window and show a slowly rotating version of the original model. This original model should be flat-shaded so that the polygons can be seen individually. Then the subdivided model should be slowly rotated around, and it should be smooth-shaded, which requires per-vertex normal calculations. Each of these two models should be put through 360 degrees of rotation so that all sides can be seen.


Polyhedral File Format

The file format we will use for this project is a simple text format. The first two lines specify the number of vertices and faces of the model, respectively. Then all of the vertex (x,y,z) values are listed, one per line. This is followed by the list of faces, one face per line. The first number that describes a face is simply the number of sides of that face, and for this project, that number will always be 3. Following this, indices into the vertex list are given. The vertices are indexed starting from the value zero.

We have provided several models here model.zip. Look at these files to see the exact file specification.


Suggested Approach

First, write a program to read in the .ply file format into your own polyhedral model data structure. Next, use calls to OpenGL and GLUT to display this model. You can then write the code needed to calculate surface normals at the vertices of a model. Finally, write a routine that takes a given model and subdivides it using Loop subdivision. The key to this program is deciding on a polyhedral representation that will allow the subdivision and the surface normal calculations to be done with relative ease. The "corners" representation and the "vertices, faces, and pointers" representation are two good possible choices.


Authorship Rules

The code that you turn in must be entirely your own. You are allowed to talk to other members of the class and to the instructor and the TA about high-level questions about the assignment. It is also fine to seek the help of others for general C programming questions. You may not, however, use code that anyone other than yourself has written. Code that is explicitly not allowed includes code taken from the Web, from books, or from any source other than yourself. You should not show your code to other students. If you need help with the assignment, seek the help of the instructor or the TA.


What To Turn In

Compress all neccessary files to run your program into a zip archive and email them to the TA (jang at cc). Put "cs6491:prog5" in the subject line so that we can easily find your submission. The filename should be "p{project number}_{your name}.zip", where {your name} is your full name (last name first) without spaces. For example, Justin Jang would create "p5_JangJustin.zip" for his homework 5. When unzipped, one should be able to load the workspace (.dsw) or solution (.sln) into Visual Studio and rebuild and run it (ctrl+F5). Please delete any temporary/compiler-created files such as .obj files and .exe files before compressing. They are typically big files and will be deleted before grading anyway. For example, anything in the "Debug" or "Release" folder should be removed (except for your own data files if you have any). *.ncb files are also large temporary files that should be deleted.