CMSC 435/634: Introduction to Computer Graphics

Assignment 3
Modeling
Due October 28, 2014

The Assignment

For this assignment, you will add code to an existing OpenGL application to load model files in a subset of the common obj format. You will find the starting program in your assn3 directory. Since this program needs to use graphics hardware on the machine where you run it, you will not be able to develop on the GL systems. Some development options are detailed below.

The subset of obj format you need to implement consists of:

The obj format has separate indices for each of v, vt and vn. You will need a unique element in the GPU vertex array if any of the v, vt or vn indices differ, but should share the same vertex array element if all three indices are the same. Compute a v/vt/vn to GPU vertex array index mapping using the std::map data structure.

Since you are ignoring the material definition lines, use the same material parameters and texture as used by the cylinder and sphere samples

634 only

If no normal is given (just v#/vt# on the face lines), compute a new average normal per vertex. There are several methods for deciding how to weight the face normals to compute the average vertex normal: weight by triangle area, weight by reciprocal area, weight by angle, ... Research one of these, and explain which you used and why you chose it in your README.txt.

Extra Credit

For up to 20 points of extra credit, add make whatever additional changes are necessary to load and display this castle model. You will at least need to parse some aspects of the mtl file. Do not make changes to the shaders, but do read use the parts of the mtl specification that map to our current shader: Kd, Ks, Ns and map_Kd. You will also need to load multiple object parts from the one file, one part for each material.

You are only eligible for extra credit if you turn your assignment in on time or use your free late. Also, you are only eligible for the extra credit if you discuss it in your README. Extra credit will not be graded for late assignments, or if it is not mentioned in the README.

Development options

The sample code will run on the UMBC PCs in the GAIM lab, ENG 005a. This is the corner lab on the bottom floor of the Engineering building with PCs and XBoxes, not the visual arts Mac lab next door in 005b. You will also need to download the pre-built GLFW and GLEW libraries from umbc.box.com/glfw-glew. Unzip the files, and run the envset script you find there before opening the project in Visual Studio.

There are limited PCs in this lab, so you may want to try working at home. The same code and instructions should work on your own PC assuming you have Visual Studio (as a UMBC student you can get it for free from Microsoft at dreamspark.com).

It should also work on Mac if you have at least Mac OS 10.9. You will need XCode, and CMake, and will need to download and build GLEW and GLFW yourself from source and install into /usr/local. If you are not familiar with building packages from source, post a question on piazza. You can either use the provided Makefile to build and run on the command line in a terminal, or use XCode.

You may also be able to run it on Linux. In addition to installing GLEW and GLFW, you will also need a vendor-provided video driver (the generic driver that comes with many Linux distributions will not support the features we need). Note that AMD and NVIDIA do have recent drivers with sufficient support, but Intel does not. If you have Intel graphics, you will probably be able to use it from Windows, but not Linux.

If you use your own system, you should check out from git directly to your own computer. This will allow you to work locally, then check changes back in directly without having to copy the files back onto the gl systems. You can either use a command-line git client, a GUI client, or one that's integrated into the OS. For Mac or Linux, I usually use the command line client, but for Windows I use SourceTree.

In SourceTree, you use "Clone from URL" and add "ssh://<user>@gl.umbc.edu" to your git repository path. For example, if your GL userid was foo, you would use "ssh://foo@gl.umbc.edu/afs/umbc.edu/users/o/l/olano/pub/435/foo.git". For command-line git, you would use something like

git clone ssh://foo@gl.umbc.edu/afs/umbc.edu/users/o/l/olano/pub/435/foo.git

What to turn in

Turn in this assignment electronically by pushing your source code to your assn3 GIT directory by 11:59 PM on the day of the deadline. We will be looking for multiple checkins documenting your development process.

As always, double check that you have submitted everything we need to build and run your submission, but no generated files (.o's, executables, or images). Be sure to include a readme.txt file telling us about your assignment. Do not forget to tell us what (if any) help did you receive from books, web sites or people other than the instructor and TA.

Be sure to include the details of the system you used for the assignment in your README in case we have problems.