Computer Science 155: Graphics
Spring 1998
Homework 6

The early due date is Wednesday, March 11 before midnight.
The regular due date is Thursday, March 12 before midnight.
The late due date is Friday, March 13 before midnight.


Please note the unusual due dates for this homework assignment. The assignment has two parts. Please start early! In this assignment, you will be constructing a virtual rollercoaster ride using cubic parametric curves, blending, texture mapping, and cheesy shadows. As described in class, Bezier and Hermite curves do not provide an ideal means of describing rollercoaster position because we have no control of the second derivative using such curves. Therefore, in the first part of this assignment, you will derive a new type of cubic curve that allows the user to specify second derivatives as well as first derivatives. In the second part of the assignment, you will use this new type of curve to implement your own rollercoaster ride.

  1. [15 Points] A New Family of Parametric Curves! In this part of the assignment, you will derive a new type of cubic parametric curve in which the user specifies the starting point, the first derivative at the starting point, the second derivative at the starting point, and the ending point (notice that the user has no control over the first or second derivatives at the ending point). The 3 x 4 geometry matrix will be as follows: The first column contains the x-, y-, and z-coordinates for the starting point. The second column contains the x-, y-, and z-coordinates of the first derivative at the starting point. The third column contains the x-, y-, and z-coordinates of the second derivative at the starting point. The fourth column contains the x-, y-, and z-coordinates of the ending point. Using this convention for the geometry matrix, compute the 4 x 4 basis matrix for this type of parametric curve. (The matrix inversion that's required here is easy enough to quickly do by hand, but you are welcome to use MatLab or another software tool if you prefer.) Write out your derivation of the matrix carefully, showing each step. Turn this part of the homework in on paper. Write the time of submission on the top of your homework submission and slide it under my office door if I'm not there.

  2. [85 Points] The Virtual Rollercoaster! Although there are a number of required features for this assignment, be creative and have fun with this! (A Note on implementation: There are a lot of things going on here. I highly recommend starting simple and augmenting your program with features one at a time. I've described the assignment in terms of augmented features in order to help break things down.)

    1. Construct a floor on the xz plane. Draw a scene on this floor containing a few opaque objects. Keep the objects simple since you're going to be casting cheesy shadows on them later!
    2. Using the cubic parametric curves that you derived above, piece a few of these curves together (perhaps 3 curves) to make a smooth rollercoaster track. This will take just a bit of calculation to work out. (Note that although these curves only allow you to specify the first and second derivatives at the starting point, you can easily compute the first and second derivatives at the ending point. You can then use these values for specifying the next curve.)
    3. Your program should draw a piecewise linear approximation of the track and then take a ride along this track. Specifically, the eye position should be on (or slightly above) the track and the center of attention vector should remain tangent to the curve so that you are always looking straight down the track.
    4. Add at least one semi-translucent object by using blending. Use the trick from class to make sure that semi-translucent objects don't obscure opaque objects (using read-only mode for the z-buffer).
    5. OPTIONAL FOR EXTRA CREDIT. Add a rectangular billboard and texture-map a design onto the billboard. You can obtain the texture by using the scanner or finding something on the web. Allow the user to toggle texture mapping on and off. (The reason for this is that only the two O2's have hardware-supported texture mapping. Texture mapping will bring the other machines to a crawl.)
    6. Finally, add cheesy shadows. Specifically, have just one light source positioned someplace well above the floor. Compute cheesy shadows with respect to this light source for each object in the scene. (Note: If you draw the shadows directly on the floor, the z-buffer algorithm may decide that the floor is on top of the shadow or that the shadow is on top of the floor. The former is bad since you won't see the shadow. To avoid this, draw the shadows just a tad above the floor.)