cos426.jpg (39279 bytes)

Computer Graphics, Spring 2008


Assignment 2: Mesh Processing

Due on Sunday, Mar 9 at 11:59 PM

Art Contest Results


Overview

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

You should use the following skeleton code (COS426_assignment2.zip) as a starting point for your assignment. We provide you with several files, but you should mainly change R3Mesh.cpp.

After you copy the provided files to your directory, the first thing to do is compile the program. If you are developing on a Windows machine and have Visual Studio .NET 2005 installed, use the provided project files to build the program. If you are developing on a Mac OS X machine, type make in the assignment2 directory. In either case, two executables will be created: 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 meshes interactively.

Aside: Visual Studio bug: On multiprocessor machines, Visual Studio will lock object files while building in a way that causes the build to fail. To fix this, use Tools -> Options -> Projects and Solutions -> Build and Run and set the maximum number of parallel project builds to 1.

The skeleton R3Mesh class is able to read meshes in three simple mesh file formats. The first is the COS426 file format, which is indicated by the .ray file extention. This format was created to provide the features required by this course -- it will be extended to handle materials, lights, etc. in Assignments 3 and 4. The others are the Object File Format (.off) and the Wavefront file format (.obj), which are 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 and .obj files on the web -- in particular, there is a large repository of 3D meshes in .off format in the Princeton Shape Benchmark.

Optionally, you can also try the Google 3D Warehouse, which contains SketchUp models, and use an OFF exporter plugin from SketchUp (place the script in the PlugIns directory of Sketchup, then use Plugins -> Export OFF in the SketchUp application). This allows you to obtain more OFF files for your mesh processing needs. We don't provide debugging support for the Sketchup approach, however, so try it at your own risk!


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.ray by a factor of 1.1, and save the result in the mesh out.ray, you would type:
% meshpro in.ray out.ray -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.ray out.ray -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 use meshview

Use meshview filename.ext to open a mesh. Use F to toggle drawing faces, E to toggle drawing edges, V to toggle vertices, I to toggle vertex IDs, S to save a screenshot. 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.

What You Have to Do

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 10 points. There are many ways to get more points:

For images or movies that you submit, you also have to submit the sequence of commands used to created them, otherwise they will not be considered valid.

It is possible to get more than 20 points. However, after 20 points, each point is divided by 2, and after 22 points, each point is divided by 4. If your raw score is 19, your final score will be 19. If the raw score is 23, you'll get 21.25. For a raw score of 26, you'll get 22.

Extra credit points cannot replace the required features (bold items). Your final score will be calculated by adding 10 to the number of extra credit points you achieve, applying the above formula for diminishing returns, and then subtracting the number of required points that you missed.


What to Submit

You should submit one archive (zip file) containing:

The .zip file's name should be your Princeton OIT LDAP username.

The writeup should be a HTML document called assignment2.html which may include other documents or pictures. It should be brief, describing what you have implemented, how you created the art contest images, and instructions on how to run the fun filters you have implemented. It should also include screenshots of example output meshes for each of the filters you implemented, with the corresponding command-line. (Points will be deducted if the screenshots are not included). Finally, the writeup should list the points you think you deserve for each section, and the total, as if your assignment were correct.

NOTE: Please convert your art contest and writeup images to JPEG format before submitting them (to save space).

Should you choose to create a video, there are many options for video encoders available, however we have found that FFMPEG works well and runs on both Windows and linux. MEncoder is another option.

Always remember the late policy and the collaboration policy.


Hints

A few hints: