COS 426:
Computer Graphics
Spring 2013


General | Syllabus | Assignments | Final Project


Assignment 2: Mesh Processing

Due Tuesday, Mar. 12, 11:59 PM

In this assignment you will create a simple mesh processing program. The operations that you implement will mostly be filters that take an input mesh, process the mesh, and produce an output mesh.

Getting Started

Download the starter code code (cos426_assignment2.zip) and read README.txt.

Compiling the code produces two executables: meshpro and meshview (or meshpro.exe and meshview.exe). meshpro is the program that processes mesh (just like imgpro from assignment #1), while meshview provides a way for you to visualize and process meshes interactively.

The skeleton R3Mesh class is able to read meshes in two simple mesh file formats: the RAY File Format (.ray) and the Object File Format (.off), the latter of which is commonly used for interchange between mesh processing programs. We provide several sample meshes that you can use to test your program. However, you are not limited to these files -- you should be able to find .off files on the web. For example, there is a zip file with 400 .off format files from the SHREC 2007 Watertight Benchmark here.

How the Program Works

The user interface for this assignment was kept as simple as possible, so you can concentrate on the mesh processing issues. The program runs on the command line. It reads a mesh from a file (the first program argument) and writes a mesh to a file (the second program argument). In between, it processes the mesh using the filters specified by subsequent command line arguments. For example, to scale a mesh in.off by a factor of 1.1, and save the result in the mesh out.off, you would type:

% meshpro in.off out.off -scale 1.1 1.1 1.1
For each available mesh filter there may be one or more optional parameters -- e.g., -scale takes three factors (sx sy sz). To see the complete list of filters and their parameters, type:
% meshpro -help
If you specify more than one filter on the command line, they are applied in the order that they are found. For example,
% meshpro in.off out.off -scale 0.8 0.8 0.8 -rotate 0.5 0 0 0 0 0 1
would first scale the mesh by 0.8 in all three dimensions and then rotate the mesh by 0.5 radians around a line through the point (0,0,0) and with direction vector (0,0,1) -- i.e., the z-axis. Of course, you are welcome to create your own filters and add program arguments for them by editing meshpro.cpp. However, please do not change the program arguments for the filters already provided.

How to View a Mesh and Try Commands Interactively

Use meshview input.off to view a mesh file named input.off interactively. After a window pops up with the mesh, drag the cursor with the left mouse button down to rotate it, with SHIFT-left-button to scale it (or the middle mouse button), and CTRL-left-button to translate it. You can also type F in the window to toggle display of faces, E to toggle display of edges, V to toggle display of vertices, I to toggle display of vertex IDs, N to toggle display of normal vectors (not visible unless they have been computed), C to toggle display of curvature at vertices, B to toggle display of the bounding box, and F1 to dump a screenshot (in "imageN.jpg", for N=1,2,etc. increasing each time an image is dumped in the same session). You can display the position on a mesh (and the active face index) under the mouse cursor by moving the mouse over the mesh and pressing spacebar.

You can also use meshview to try out some of your mesh processing filters. Clicking the right button will bring up a cadcading popup menu of commands that call functions from the R3Mesh to process the mesh being displayed. Using those commands, you can try out your implementations of the R3Mesh functions with immediate visual feedback.

You can use meshview meshfile -output_image imagefile.jpg -exit_immediately to create an image of a mesh you've created. A window will popup briefly, and then program will save an image of the mesh as seen from the default camera view. Please use this feature to make image files for your writeups (as is done by the top-level Makefile and NMakefile).

How to Make Your Writeup

The starter code includes a Python script make.py and a data file writeup.txt that you can use to generate a Makefile/NMakefile and corresponding writeup (tested with Python 2.7.3). The format of writeup.txt is:

name
login

feature 1 title
feature 1 implementation description
feature 1 meshpro argument, with %s for parameter substitution

feature 1 mesh input 1
comma separated list of parameter substitutions

feature 1 mesh input 2
comma separated list of parameter substitutions

=====

more features
...

=====


Using this script is optional; you can do things however you like, provided your submission makes properly on Linux. Note that if you're a Windows user and want to use make.py to produce a Linux Makefile for submission, you will need to run the script on Linux or edit it to produce the Linux Makefile when run on Windows.

Feature List

The assignment is worth 20 points. The following is a list of features that you may implement (listed roughly from easiest to hardest within each group). The number in front of the feature corresponds to how many points the feature is worth. The features in bold face are required. The other ones are optional. Refer to the examples web page to see images of inputs and outputs for several of these filters.

By implementing all the required features, you get 14 points. There are many ways to get more points:

It is possible to get more than 20 points. However, implementing more than 6 points worth of non-required features incurs diminishing returns: each successive point is worth 3/4 as much as the previous one. Thus, the adjusted extra credit score is computed according to the following formula:

extra credit = 3 * (1 - pow(0.75, points - 6))

Extra credit points cannot replace the required features (bold items). Your final score will be calculated by adding your score on the required features (up to 14 points) to your score on the optional features (up to 9 points, with diminishing returns past 6).

Notes / Hints

Submitting

This assignment is due Tuesday, March 12 at 11:59 PM. Please see these slides and the assignments page for general notes on submitting your assignments, including the late and collaboration policies.

Please submit a single .zip file named [your NetID]_cos426_assignment2.zip containing

The Dropbox link to submit your assignment is here.

writeup.html should be an HTML document demonstrating the effects of the features you have implemented. For some features (e.g., Bezier), you can simply show the input and output of your program. However, for features that take an input parameter (e.g., Random Noise), you should provide a series of images showing at least three settings of the input parameter to demonstrate that your code is working properly. Also, for filters that can be run repeatedly (e.g., Smooth), you should show the results of multiple iterations (e.g., meshpro -smooth -smooth).

We remind you that you are expected to use good programming style at all times, including meaningful variable names, a comment or three describing what the code is doing, etc. We will test your code on Linux by running make in your src/ subdirectory, followed by make in the main assignment directory to create the output images. Please ensure that your code builds/runs in this way.