CS 176 Project 7: Subdivision

Introduction

One often desires to construct a smoother version of a given mesh. One's definition of smooth can often vary, but one useful metric is to reduce the size of the largest face. Using subdivision, one can take a triangle mesh and subdivide its faces to produce a smoother mesh.

My program uses Catmull-Clark subdivision to subdivide meshes from .OBJ files. It works on meshes with arbitrary polygon sizes (not just triangles or quadrilaterals).

Running the Program

You can download the source here. Compiling the program require OpenGL, GLUT, Boost, and Boost.ProgramOptions. A Makefile is included, so building the program should be as simple as `make`.

You can download a Linux binary here. The binary also comes with some meshes for you to try.

The program options are as follows:

Options:
  -p [ --precompute ] arg (=0)     number of subdivision levels to precompute
  -s [ --subdivide-only ] arg (=0) instead of displaying the mesh, do the given
                                   number of subdivisions and output the result
  -h [ --help ]                    display help

Commands:
's' - display the next subdivision level of the mesh
'c' - display the previous subdivision level of the mesh (un-subdivide)
'w' - toggle wireframe display
'o' - output the mesh at the current subdivision level to standard output
'[', ']' - zoom in/out of the mesh
left-click + drag - rotate the camera

The program keeps track of all meshes up to the highest requested subdivision level. So, if you view a mesh at level 3 and return to level 1, the program doesn't recompute the subdivision if you want to view level 3 again.

Often you'll want to just save the output of the subdivision, so I provide a useful command line argument for that. For instance, this following command will subdivide the octahedron mesh 'octo.obj' 3 times and save it:

./subdivision -s 3 < octo.obj > octo-sub3.obj

Implementation

Nothing extraordinary was done outside of what the paper and the Catmull-Clark Wikipedia article specify.

Results

For the first example, we see a mesh of cat's head after being subdivided 0-4 times. You can also the difference in lighting between having 0 and 4 subdivisions. As in all of the examples, lighting is done per-face to illustrate the difference due to subdivision as much as possible.

Other Examples

All of the next examples show the original model and the model after three subdivisions.

In this example (and the previous one), you can see that well-behaved initial boundaries tend to stay reasonable.
Notice that the circular edge of the cylinder is somewhat malformed because of the original mesh, the overall subdivision is still very good.

Failure Case

We also present one failure case. In this face mesh, the boundaries become extremely distorted after a single subdivision.

Discussion

Overall, the program produces very nice subdivisions for most meshes.