CS 424: Computer Graphics, Spring 2012
Lab 6: 3D Modeling Project
This lab is a group project. For this lab, the class will break into two groups of two students and one group of three. At least one member of the group should post the group's work in his web portfolio, and you should make sure that I know where to find the solution. The project is due before the next WebGL lab, in two weeks. (Last week's lab, on Blender, is due next week, before the next Blender lab.)
The Project
Your assignment is to write a model viewer program, or possibly two programs for different types of models. The program should be similar to my teapot viewer, with a similar set of controls. You should be able to use that program as a starting point for your work. You might also want to look at cubetest.html. You can find both examples and supporting files in /classes/cs225/webgl-simpleview3d. Your program should be able to view:
- The polyhedral models in /classes/cs225/polyhedra. These models are flat-faced polyhedra. When drawing a face, the same normal should be used for all vertices of the face.
- A model that you create in blender and export in OBJ format. The model should have coordinates and normal vectors, but not texture coordinates. I suggest exporting a single mesh object, but not one of the standard objects. You can export it as triangles only if you like.
While I would prefer a single program to handle both types of models, you can write two programs if necessary. It would be nice if the program also had the option of viewing the teapot, and maybe some other models of the same type.
It should be possible to view these models with or without textures, just as in my teapot demo. For texture coordinates, you can use cube-mapped object coordinates, as we will discuss in class. You might make it possible to use other kinds of texture coordinates, such as tube mapped.
The three person group should also implement texture transforms and should make it possible to animate the texture on the models in some way. You can use the AffineTransform2D class, which was used in Lab 3, to represent texture transforms. This feature is optional for the two-person groups. We have discussed this in class. The idea is to add another mat3 matrix uniform to the shader program and use it to transform the texture coordinates. The value for the matrix uniform would come from the AffineTransform2D that represents the texture transform.
I don't care how you get the OBJ file from Blender into JavaScript, as long as you do it in a general way that could be used with other, similar OBJ files. You could, for example, write a Java program that converts the OBJ file into some JSON format. Or you could read it and parse it in JavaScript. (You should not, however, just translate it by hand!) You can provide more than one model of this type if you like.