Written Questions Due: Tuesday, Nov 18th by 9:30/11:00 AM (in class)

Program Due: Tuesday, Nov 18th by 11:59 PM Late assignments will be penalized 20 points per day.

0. Getting Started

Download CS370_Assign04.zip, saving it into the assignment directory.

Double-click on CS370_Assign04.zip and extract the contents of the archive into a subdirectory called CS370_Assign04

Navigate into the CS370_Assign04 directory and double-click on CS370_Assign04.sln (the file with the little Visual Studio icon with the 13 on it).

If the header files are not already open in the main window, open the header files by expanding the Header Files item in the Solution Explorer window and double-clicking lighting.h and materials.h.

If the source file is not already open in the main window, open the source file by expanding the Source Files item in the Solution Explorer window and double-clicking TeaMan.cpp.

1. Written Questions

  1. Using the example robot from lab 16 suppose we know the position where one of the upper arms is starting and have a specific final location we want the arm to have. Give a method to create the path the robot should follow to get from the starting point to the end point.
  2. Our scene graph nodes and traversal algorithm (depth-first) is dependent on the matrix stack to render objects properly, i.e. such that the position of child objects is dependent on their parent node transformation matrices. Is it possible to design a scene graph data structure that is independent of traversal algorithm? What would be required from such a data structure?
  3. When would it be preferable to sort objects by depth and render in a front-to-back fashion? When would a back-to-front ordering be better?

Hints:

  1. This problem is known as reverse kinematics and is a key area of robotics research. Representing the individual transformations symbolically as T(dx, dy, dz), R(ang), and S(sx, sy, sz), first determine the net transformation matrix for the upper arm in terms of the base angle θ, lower arm angle φ, and upper arm angle ψ along with any translations for each part. Then let the initial base and joint angles be θi, φi, ψi and final base and joint angles be θf, φf, ψf. These angles would be found by solving the transformation matrix equations for the angles (which you may assume can be done to compute all these angles). Using these sets of angles describing the location of the two points, suggest an interpolation scheme to smoothly transition from one to the other.
  2. Consider what needs to be known prior to rendering each node. What would be necessary to avoid using glPushMatrix() and glPopMatrix() in the traversal routine (thus making it independent of the traversal algorithm)?
  3. Consider what effect rendering order has on object clipping, particularly when some of the objects are transparent.

2. Programming assignment

Write a program that draws a 3D scene of a walking robot with articulated arms and legs along with a spinning teapot in a translucent box. A sample executable is included in the skeleton zip file as TeaManSolWin.exe or TeaManSolMac.exe (the Mac version should be run from the command line). The scene should include:

Hints:

The node structure contains fields to store a MaterialType for the node's material, a GLuint to store the texture id for the node, and a GLuint for the shader program identifier that should be used to render the node. Make sure to apply the material or texture on a per node basis in the drawing functions. The shader program will be set in the traversal routine prior to rendering the node.

You might wish to draw a diagram of the scene graph prior to coding to get the child/sibling relationships correct.

The "joints" can simply be included with the corresponding limb segments rather than using separate scene graph nodes for them. Be sure to align the center of the joints properly so it appears as though the limb segment is rotating about the joint.

Define your scene such that the robot is walking on the x-z plane with the y-axis being the vertical dimension.

Consider the necessary rendering order for the objects in the scene graph in order for transparency to work properly.

You may use GLUT objects for a majority of the drawing EXCEPT the torso since it will be texture mapped. You should create a cube_tex[][2] array containing the texture coordinates for each vertex of each face (note the same vertex will require different texture coordinates depending on which face it is being used to render). You may use the included texturecube() function but may need to adjust the indicies of the cube_tex[][] arguments as well as complete the texquad() function to assign texture coordinates appropriately using the last four parameters.

Be sure to enable alpha blending and set appropriate blend factors for alpha blending effects. You will need to create "translucent" materials with non-unity alpha values and render translucent objects in the proper order within the scene graph.

You can use the provided default, basic lighting, and texture shaders but may wish to modify them for additional effects.

Grading Criteria

The program MUST compile to receive any credit (so develop incrementally).

For up to 70% credit: Draw the basic scene with a billboard image, static robot, and static teapot using a fixed camera (i.e. no mouse control or animation), but no translucent box. The robot must use materials and texture mapping but does not need proper texture coordinates.

For up to 75% credit: Draw the basic scene with a billboard image, static robot, static teapot, and translucent box using a fixed camera (i.e. no mouse control or animation). The robot must use materials and texture mapping but does not need proper texture coordinates.

For up to 80% credit: Draw the basic scene with a billboard image, static robot, static teapot, and translucent box using an adjustable camera (i.e. mouse control) but no animation. The robot must use materials and texture mapping but does not need proper texture coordinates.

For up to 85% credit: Draw the basic scene with a billboard image, static robot, static teapot, and translucent box using an adjustable camera (i.e. mouse control) but no animation. The robot must use materials and texture mapping with texture coordinates representative of the proper texture map portions for each face (but not completely correct).

For up to 90% credit: Draw the basic scene with a billboard image, dynamic robot, dynamic teapot, and translucent box using an adjustable camera (i.e. mouse control), i.e. with animation. The robot must use materials and texture mapping with texture coordinates representative of the proper texture map portions for each face (but not completely correct).

For up to 95% credit: Draw the basic scene with a billboard image, dynamic robot, dynamic teapot, and translucent box using an adjustable camera (i.e. mouse control). The robot must use materials and texture mapping with correct texture coordinates representative of the proper texture map portions for each face such that the face labels appear properly.

For above 95% credit: Be creative! For example, enhance the geometry of the scene, use additional animations, and/or provide enhanced lighting. Remember that the program should still have reasonable performance on the lab machines.

Compiling and running the program

Once you have completed typing in the code, you can build and run the program in one of two ways:

(On Linux/OSX: In a terminal window, navigate to the directory containing the source file and simply type make. To run the program type ./TeaMan.exe)

The output should look similar to below (note colors and shapes do not need to be exactly identical but should demonstrate an understanding of the concepts)

image

To quit the program simply close the window.

Submitting to Marmoset

To submit your completed assignment, open a cygwin terminal window, navigate to the working directory and type:

make submit

Then enter your Marmoset id and password. You should see a confirmation that the file was submitted successfully.

You are responsible for making sure that your submission contains the correct file(s).