15-462 Computer Graphics I
Assignment 5 - Roller Coasters and Splines
100 points


In this assignment, you will be working with splines and some features within OpenGL. You will be designing a roller coaster and the surrounding world. Also a "ride the coaster" feature will be implemented.

In order to create a roller coaster, you will have to draw a spline to the screen which represents a roller coaster. After the spline is drawn to the screen, you need to draw the rest of the track so that while you are riding it, there is a feeling of speed. All parts of the track that you draw should be shaded properly. We will give some sample Catmull-Rom track files. However, you are free to create your own roller coasters. There is some starter code which loads multiple spline files and stores them into an array of splines. For more information about splines in general, you can look at the slides for Lecture 10 or [Angel, Ch. 10]. More specific information on Catmull-Rom splines is also available.

After the roller coaster is created, you should be able to ride the roller coaster by having the camera follow the track. When travelling along the spline, you need to keep track of where the camera is, where its looking at, and the up vector for the camera. See the additional camera instructions on how to do this. To make the feeling of riding a coaster seem complete, you should create a ground plane and sky, these should be texture mapped so that everything looks nice.

Functionality Requirements

This is the list of requirements that are required for the assignment. The order that they are in would probably be a good order to implement them while working on the assignment.

  • Write a function which will interpolate between the control points to find all the points along the spline. A good value for the step along the spline might be 0.1. See the description of Catmull-Rom for details.
  • Just as a temporary step, not one that will be graded, draw the spline which you just calculated.
  • Draw a ground plane and sky, texture mapping isn't necessary just yet.
  • Create the ride the coaster feature. At this point, the camera doesn't have to be physically correct, it should just move at constant speed along the coaster. Use the camera instructions provided to orient your camera properly.
  • Draw cross sections along the coaster. The cross sections could be something like rail ties, or a ribbon along the spline.
  • Texture map the ground and the sky.
  • Change your camera so that it appears more realistic (speed up on downhills, slow down on uphills, for example) or achieves another interesting effect. You may want to set a minimum and maximum velocity for your camera so it doesn't completely stop or start going too fast along the coaster. Your animation does not need to be physically realistic---this is left as an extra credit option.


In addition to your program, you are also required to hand in an animation in the form of JPEG files. See the sample code jpegwrite.c from Assignment 3 for how to write such these files.

  • The animation should be something which shows the scene and roller coaster you have created.
  • The animation should consists of a series of JPEGs stored in a subdirectory called movie/.
  • The JPEGs should be numbered consecutively starting from 000.jpg.


  • Roller Coaster: proper use of splines, and good camera controls for the riding part.
  • Scenery: ground plane and sky.
  • Lighting: proper lighting, appropriate surface normals for shading, artistic impression.
  • Texture Mapping: proper application and appropriate textures for the surface.
  • Animation: a good creative demonstration of your scene and roller coaster.
  • Style: appropriate use of OpenGL features, properly structured program.

Handin Instructions

In your graphics handing directory, /afs/andrew/scs/cs/15-462/students/user/, create a subdirectory called asst5. In that directory submit all your files (source code, Makefiles, texture maps, ...). MAKE SURE YOU INCLUDE A MAKEFILE. Please also include a README file that describes your "physics" model, as well as any extras you implemented. In a subdirectory called movie/ copy all your JPEGs into it. Number them consecutively starting from 000.jpg; no more than 180 frames will be included in the video.

Starter Code

The starter code takes a file at the prompt which contains a list of splines to use and an integer which specifies the number of splines listed in the file. There is a sample one called track. The code will then load all the splines from that file into a structure called splines. Splines is an array of spline structs. Each spline struct contains an integer which has the number of points, and an array of coordinates.

As usual, you are free to use any language you like, but we will only actively support C and C++, and we will require that your code compile and run in the graphics cluster.


  • Start soon, there are many parts to this assignment.

Possible Extras

  • Create a support structure for your track.
  • Instead of using one spline to represent the track, create a track using multiple short spline segments so that you can mix and match and create a random track.
  • Random or interactive roller coaster generator.
  • Whatever creative additions you can think of for your scene
  • Secondary animations in your scene.
  • Implement correct physics along the spline, using e.g. a work-energy formulation or a constrained differential-equation solver. Here is a lecture Jernej Barbic gave last semester suggesting one way to do this.


[ Home | Schedule | Assignments | Software | Resources ]

Frank Pfenning