EECS 598-1: Winter 2002

Programming Assignment 1: due 1/30/2002 at 11:59pm

an image from Desbrun et al. '99

In this assignment you are asked to implement a number of simple mesh processing procedures. You are given a simple mesh viewer and an edge-based mesh class. You will need to implement the following:

  1. (25pts) A procedure that reads simple Wavefront OBJ format files and builds a mesh. The file name is specified on the command line. Please see the description of OBJ format at the bottom of the assignment.
  2. (20pts) A procedure that computes normal at each vertex using Zorin's formula from Siggraph 2000 Subdivision notes ( equation 4.1 and 4.2 on page 71-72 give you tangent vectors, and normals are cross products of those). Both inside and boundary vertices should be handled properly. This procedure should be called after the file is read. Do not forget to normalize the normal vectors so that they are of unit length. (NOTE: formula 4.2 in the notes is wrong for k=3 it should be: t_across = p_{1,1}-p_0) Figure 4.2 on page 69 of the same notes explains the notation p_{i,j}.
  3. (15pts) A procedure that counts number of edges, triangles, vertices, boundary loops, and connected components in the created mesh, and prints these numbers on standard output together with the correspondent Euler characteristic and the genus of the surface (The formulae for the Euler characteristic and genus are given on page 4 of the notes for lecture 1). This procedure should be called after the file is read.
  4. (15pts) A procedure that computes the mean curvature value for every vertex using Desbrun's method and assigns colors correspondingly. The procedure should assign zero values at the boundary. It should be called after the file is read. Please make sure that the curvatures with high absolute value are assigned red color and curvatures close to zero are assigned blue color. The VertexT::Valence() function in the mesh.h shows an example of how you can use UmIt -- umbrella iterator to go around a vertex. Note that UmIt goes through vertices in the clockwise order however (this should not matter for curvature computation but may matter in normal computation above). Use equation 14 of Desbrun et al. for this curvature computation.
  5. (10pts) A mesh smoothing procedure that applies one step explicit smoothing using regular umbrella smoothing. This procedure should be called upon pressing the "u" key. The mesh should be rendered with recomputed (Desbrun) curvature values and normals after the smoothing. Page 7 of the notes for lecture 3 talks about fairing/smoothing a mesh. Try using tau=1 or tau=0.5.
  6. (15pts) A mesh smoothing procedure that applies one step explicit smoothing using Desbrun curvature. This procedure should be called upon pressing the "d" key. The mesh should be rendered with recomputed curvature values and normals after the smoothing. Use normalized version of curvature from section 5.5 of Desbrun et al. for this fairing computation (the weights should sum up to one).

Important:

I will be grading the assignment on a Windows machine (2000 or XP), and your code should compile under Visual C++ version 6.0 possibly using Glut library. Please do not use any graphics card-dependent features or extensions.

Additional materials

An examples of OBJ files and the viewer can be found below.

Files

GLUT viewer and mesh class code zipped tar.gzipped See description of the mesh class in the course notes from lecture 3.

My code may have some bugs. Please let me know as soon as you find any.

The viewer code should compile under Visual C++ 6.0. With a proper makefile it should also compile on other platforms. Do not forget to check if glut.h file is in the standard include/GL folder. If it is not please download GLUT package from the web at www.xmission.com/~nate/glut.html

A number of OBJ files on which your code can be tested are given below:

Papers:

Suggestions for pseudo-coloring:

You will need to transform absolute value of curvature into a color value, that is RGB triple. One neat way of doing that comes from Blackbody radiation colormap. Otherwise, use some simple linear interpolation between blue and red.

Wavefront OBJ file format

Here is one example of an OBJ file describing a tetrahedron:

# OBJ file format with ext .obj
v 1.0 0.0 0.0
v 0.0 1.0 0.0
v 0.0 0.0 1.0
v 0.0 0.0 0.0
f 2 4 3
f 4 2 1
f 3 1 2
f 1 3 4

The vertices are indexed starting from 1. The faces are given as triples of vertex indices. There are three kinds of lines allowed. Comment is any line starting with '#', like

# this is a comment

Vertex lines start with 'v' and give three coordinates of a vertex:

v x y z

Face lines start with 'f' and give three vertex indices that form a face:

f v1 v2 v3

You can assume that the vertex indices in face triples are given in a consistent order, that is, counter-clockwise as you look at the object from outside.