CS 294 Project 2
Steve Martin
For this project, I implemented Catmull-Clark subdivision surfaces [1] using OpenGL and Glut under Win32. The surface meshes themselves start out as Lightwave .OBJ files parsed by my program. In addition, I added some extra features that allow the user to pick edges via a GUI that will be forced to become 'sharp' via extra rules in my subdivision scheme.
Required Features Immediately upon opening, my program reads in and parses the specified .OBJ file. Only the points and faces are used from this file; the application recalculates the normal vectors on the mesh as a part of each subdivision step. Figures 1-3 show the application displaying three different OBJ files. Smooth shading is disabled as per directions.
Once the mesh is loaded in, pressing the 's' key on the keyboard will perform a subdivision step using Catmull-Clark subdivision. Figures 4-9 show the results of four steps subdivision on a simple cube mesh. Figure 5 draws outlines around each polygon in the mesh.
Now, the same procedure is repeated with the boar mesh. Figures 10-15 show the results of four subdivision steps using the Catmull-Clark subdivision algorithm. Figure 5 draws outlines around each polygon in the mesh.
My subdivision application is implemented using three major data structures: a Point, an Edge, and a Face. Vectors of these make up a surface, with all of the actual point data residing in one location and referred to within the other data structures. Although there is additional work that could be done to optimize my algorithm, this arrangement works very efficiently.
Additional Features Sharp Edges An extra feature I added to my program is the ability to designate certain edges as 'sharp' via clicking on them in the GUI. Figure 16 shows the cube mesh with an edge selected to remain sharp.
'Sharp' edges maintain their sharpness through the application of different subdivision rules. When subdividing an edge that has been tagged 'sharp', adjacent face points are first calculated using the normal Catmull-Clark method. Next, the new edge point is set to be the average of the two vertices making up the edge. Finally, different rules are used to calculate the new vertices adjacent to the edge. [2] These rules are presented in table 1.
The descendants of a 'sharp' edge are also tagged as sharp, ensuring that unless the edge selection is cleared the entire original edge remains sharp throughout the subdivision steps. Figures 17-19 show the results of multiple subdivisions of the cube mesh with two of the edges tagged as 'sharp,' while figures 20-25 show the results of experimentation with this method on other meshes.
Conclusion I found this assignment much more challenging than the previous one, mostly because it took me a while to design a data structure and algorithm that would allow quick subdivision. However, once everything was put together, it was extremely satisfying to see Catmull-Clark subdivision in action. I feel I have a good understanding of subdivision surfaces as a result of this assignment; I only wish I had more time to experiment with my program and add more features.
References [1] Catmull, E. and Clark, J. Recursively Generated B-Spline Surfaces on Arbitrary Topological Meshes. Computer Aided Design 10, 6 (1978), 350-355. [2] Efrat, Alon. Course notes for CS534: Advanced Topics in Computer Graphics. http://www.cs.arizona.edu/classes/cs534/ (also our class notes, and various OpenGL web pages) |
|||||||||||||||||||||||||||||||||||||||||