This lab implements subdivision surfaces, a method of smoothing polygonal objects to create nice, C-2, smooth surfaces from blocky polygon models.
User Interface
Mouse interaction:
Mouse input works exactly the same as Peter's supplied viewer code, which was used for last week's lab as well. The only changes I made to his mouse interaction were the following: Key interaction:
Press 's' to iteratively increase the subdivision of the surface.
Press 'r' to reset the model to its original, blocky form.
Press 'h' to hide and show a wireframe outline of the original model.
Press 'c' to toggle capturing the interactive session to .ppm frames.
Press 'esc' to exit the program.
Input File Format
The program reads an .obj file from stdin. The object should be free of boundaries because my code does not currently handle them properly. Also, the input file should be made up of quadrilateral faces only. I plan to address both of these limitations as soon as I get time.
Good Results
Subdivision worked very well on these objects, making their features much more aesthetically pleasing, orderly, and easy to distinguish. Here are some video captures of the interactive interface demonstrating the results. The pig and cube models were supplied to us, and I threw together the rest of the models in Maya.

Not So Good Results
These models did not turn out well because my implementation of subdivision surfaces does not constrain the surface very tightly to the cage. The person model is especially bad because it becomes obvious that it is constructed from separate blocks.
This program is written in C++ using GLUT. It should compile on most Linux, Windows, and Mac OS X machines if the proper libraries are installed. You should be able to run the program by running:
> make > ./Subdivision < input_file.obj
In the Models directory, you will find a copy of each of the models I used in the examples above.

As usual, please be aware that this is by no means polished software; it was written for a weekly assignment.
Design and code ©2012 Julian Panetta
Valid HTML 4.01 Strict