COS 426:
Computer Graphics
Spring 2015

COS 426 General | Assignment 2


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

Getting Started

As in the previous assignment, the mesh processing program has two modes: (1) an interactive mode where you can enable/disable various filters, adjust parameters to these filters, and see the result right away; and (2) a batch mode where all the filters and parameters are fixed. Each version runs in a web page, and for the batch mode the filters and parameters are specified in the URL. This section of the instructions are analogous those of the previous assignment, so by now this should be very familiar.

To get started, download this zip file and unzip it on your computer. Change to the subdirectory cos426-assign2 and run the command python -m SimpleHTTPServer which will launch a web server on your computer, rooted at this directory. (See previous assignment description about why we do this instead of opening the files directly.)

Once you have started the local web server, direct your browser to http://localhost:8000. You should see the web page for Assignment 2 showing a cube. Click and drag near the cube (not on it) and you will see that this is a 3D viewer. In the upper right corner is a GUI, and the top two controls let you change the size of the rending window and choose a picture -- try it. Below that is a collection of controls. Click on the TRANSFORMATIONS folder to open it, and choose the top item -- Translate X. Try adjusting the x-translation by pulling that slider around. It should move the model on the x-axis shown in orange. Try adjusting a rotation slider, and you should see a warning that that feature is not implemented yet. You will be implementing that feature as part of the assignment. Click ok on the warning box.

Using your favorite text/code editor, edit the file ls js/student.js in that directory and fill in your name and NetID. Reload the web page in your browser, and now your information should appear above the image.

New GUI features in this Assignment

This GUI has several new features:

Implementing the Mesh Processing Filters

The assignment is worth 20 points. The following is a list of features that you may implement. The number in front of the feature corresponds to how many points the feature is worth for the full implementation. Partial or partially-correct solutions will receive partial credit. The features in bold face are required. The other ones are optional. Refer to the examples web page for example output images as well as some implementation hints.

Note that the bold operations in the Transformations and Topology sections as well as triangle and quad subdivision should either apply to selected faces (if there are any) or to the whole mesh (if no faces are selected). These operations should apply to all vertices adjacent to a selected face. See the example implementation for translation for how to do this. Operations in the other sections should ignore selection and modify the entire mesh. Also, the triangulation and subdivision operations should propagage selection to the subdivided faces. (Just copy that attribute to the new faces.)

This assignment relies heavily on the "halfedge" mesh data structure, which was discussed near the end of the Polygonal Meshes lecture on 2/24, and extensively during precept 2/25. You can also read about it in Section 3.1 of the Botsch 2007 reading. Links to these notes and readings on the Syllabus.

How to Program the Filters

To implement the features listed above, you only need to edit the files js/meshStudent.js (for mesh traversal functions) and js/filters.js (for most of the rest). Before starting on that, we recommend you take a quick look at the file js/mesh.js because it has some important helper code relating to vertices, edges, and meshes. You are welcome to look at any of the other files, but it should not be necessary and some of them have some pretty byzantine javascript magic.


You should submit your solution via CS dropbox here. The submitted zip file should preserve the directory structure of the skeleton code we provided in the zip file above.

The writeup.html file should be an HTML document demonstrating the effects of the features you have implemented and would like scored. For some features (e.g., sharpen), you can simply show the input and output of your program. (No need to show inputs for the default images in the images folder.) However, for features that take an input parameter (e.g., blur), you should provide a series of images showing at least two settings of the input parameter to demonstrate that your code is working properly.

You should start from the the example writeup.html provided. At the top of that file are a list of features that you might implement, linking to the section where you talk about them. Please remove any features that you do not implement, but otherwise leave this header section in tact. When you include an image, also include a link to the batch.html command that creates that image, as in the last assignment. To save space, please submit images in png format.

Note 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. Partial credit may not be assigned for code without comments. We have mostly tried to conform to the idiomatic JS style conventions.


As in the last assignment:


Here are some answers to frequently asked questions. Check back here occasionally, as we may add FAQs to this list: