CS 294 Project 2

Steve Martin
U.C. Berkeley, Fall 2003


Introduction


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.

 

Figure 1.  A render of a mesh of
a baby with a mohawk.
Figure 2.  A render of a WWI sub
mesh.
Figure 3.  A render of a mesh of a
running boar.

 

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.

 

Figures 4-9.  The results of four Catmull-Clark subdivision steps on a cube mesh.  Figure 5 shows an outline around each face in the mesh.  Note the 'exceptional points' at the cube's vertices.

 

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.

 

Figures 10-15.  The results of four Catmull-Clark subdivision steps on a mesh of a running boar.  Figure 11 shows an outline around each face 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.

 

Figure 16.  A render of a cube mesh with the edges around one of the faces designated as 'sharp,' indicated by the yellow line.

 

'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.

 

Table 1. Rules for vertex calculation and classification if it is adjacent to an edge that has been designated as 'sharp.'

 

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.

 

Figures 17-19.  Subdivision results with 'sharp' edges designated on the cube mesh.  Figure 19 is a composite of several different views of the mesh at the same subdivision level to better show the results.

 

Figures 20-21.  A comparison of the mohawk baby's eye after subdivision without and with 'sharp' edges designated on the mesh.  The version with sharp edges defines the cornea much more clearly. Figures 22-23.  A comparison of the WWI submarine after subdivision without and with 'sharp' edges designated on the tail fins of the mesh.  Sharp edges help maintain the shape of the fins. Figures 24-25.  Likewise, a comparison of the hoof of the boar mesh without and with some sharp surfaces designated.


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)