CSCI 4530/6530 - Spring 2012
Advanced Computer Graphics
The goal of this assignment is to try your hand at various mesh processing tasks. A half-edge mesh adjacency data structure is provided, along with a very simple .obj mesh parser. As you modify the triangle mesh, it is critical that the manifold properties of the input surface are maintained, and that the adjacency data structure remains consistent. Throughout this assignment you are asked to consider the efficiency of various mesh operations: is it quadratic, linear, logarithmic, constant, etc? Since this assignment is rather long, it's ok if you don't always implement the most efficient strategy (which may require additional data structures), but please discuss the tradeoffs in your README.txt file. Please use the provided README.txt template.
Warning: This assignment has one small component (Gouraud shading) & two large components (simplification and subdivision). Start early, and just get the basics working first. Spend a reasonable amount of time coding and write about what you've learned in your README.txt file. Also, to streamline grading, please indicate which portions of the assignment are finished & bug free (full credit), attempted (part credit) or not started (no credit) by filling in the provided hw1_gradesheet.txt and submitting it with your assignment. The instructor will then check, edit as needed, and finalize your assessment.
./mesher -input cube.obj -size 300 ./mesher -input cube.obj -size 300 -wireframe ./mesher -input open_box.obj -size 300 ./mesher -input open_box.obj -size 300 -wireframe
Notice that the adjacency data structure detects boundaries in the mesh and draws them with thicker red lines in the wireframe visualization:
./mesher -input bunny_1k.obj -size 500 ./mesher -input bunny_1k.obj -size 500 -gouraud
Note that the average normals for each vertex can be efficiently computed without any adjacency information at all, but that wouldn't give you practice with the data structure! For extra credit, don't average the normals across "sharp crease" edges (whose faces differ in normal by more than a user-defined threshhold angle).
Comment on the efficiency & order notation of your implementation in your README.txt.
First implement the topology of an edge collapse. Identify a target edge to collapse. For now, just pick a random edge (or any edge) in the mesh. Using the adjacency data structure, identify which two triangles will be removed permanently from the model, and which other triangles will change. Choose a simple location for the remaining vertex (e.g., it's old position, or a position averaged with the deleted vertex). Note: in the provided adjacency data structure it is recommended that you will delete and then re-create triangles rather than modify them and the related edges. Initially you may want to just collapse one edge each time the "d" key is pressed.
./mesher -input bunny_1k.obj -size 500 -wireframe
Even though a single random collapse works great, you will probably quickly run into problems: 1) the mesh looks bad with small triangles and big triangles that don't represent the high-resolution model very well, 2) it creates self intersections of the surface (it turns itself inside out and you can see the blue side), and 3) (worst-of-all) it sometimes crashes with an error like:
assertion "opposite == NULL" failed: file "edge.h", line XXX
Think about what that error might indicate is wrong with your implementation. (If you get a different error, of course, try to explain that one.) Certain edges should not be collapsed because it would cause the surface to become non-manifold. For example, the "ring" of vertices surrounding the target edge should be unique. In the diagram below, if vertices 1 and 4 refer to the same vertex, then after the collapse of the solid black edge, four triangles will meet at the same edge. This proposed edge collapse will alter the topology of the model and yield a non-manifold condition. Write code to check for these conditions. NOTE: This code can be tricky. It's ok if you only just catch some of these conditions and your program still crashes occasionally. Don't spend too long trying to make it perfect. Discuss this in your README.txt file.
Now implement something to make a smarter choice for which edge to collapse (this might also minimize the occurance of lingering bugs from the previous part). Collapsing the shortest edge first (or actually make that the shortest legal edge) will usually do a very good job at preserving overall surface shape. Done naively, repeatedly selecting the shortest edge for collapse can be an expensive operation. That's fine for now, you can implement something very inefficient. Discuss these performance issues in your README.txt file and what common data structures would help.
./mesher -input open_box.obj -size 300 -wireframe
Once you have the correct topology and vertex sharing, you can adjust vertex positions according to the Loop Subdivision rules. To handle general shapes you must implement the rules for regular vertices (valence = 6, i.e., 6 edges meeting at a vertex), extraordinary vertices (valence != 6), and boundary conditions. Here are the Loop Subdivision Rules from the SIGGRAPH 2000 course notes - Subdivision for Modeling and Animation (page 70).
Finish off your subdivision surface code by implementing the simple binary (infinitely sharp or infinitely smooth) crease method described in: "Piecewise Smooth Surface Reconstruction." H. Hoppe, T. DeRose, T. Duchamp, M. Halstead, H. Jin, J. McDonald, J. Schweitzer, W. Stuetzle. ACM SIGGRAPH 1994.
./mesher -input creased_cube.obj -size 300 -wireframe
Please read the Homework information page again before submitting.