Recent Changes - Search:

CS559-2006 Web

Staff Login


Project 2: Trains and Roller Coasters!

Because we're a bit behind in lectures, I am going to extend the Project 2 due date slightly. But there is a catch...

We have not yet discussed lighting in class. But lighting is an (optional) part of the project. Therefore, I will give you a choice:

  • You may turn the project in by the original due date (9:30a, Nov 7th) and get the points for lighting for "free" (that is you get the lighting points whether or not you have working lighting).
  • You may move the deadline dates back by 3 days (e.g. the assignment is due at 9:30am, Friday Nov. and considered "very late" after Monday, Nov 13 at 9:30).

Note: assignments cannot be turned in after the demos begin. We expect to do demos starting Wednesday, November 15.

Due Tuesday, November 7th, 9:30am. Late assignments accepted according to the course late policy.

1.  Overview

In this project, you will create a train that will ride around on a track. When the track leaves the ground, the train becomes more like a roller coaster.

The two main purposes of this project are to give you experience in working with curves (e.g. the train and roller coaster tracks) and to give you experience with writing interactive 3D programs.

The core of the assignment requires you to create a 3D world, and to allow the user to place a train (or roller coaster) track in the world. This means that the user needs to be able to see and manipulate a set of control points that define the curve that is the track, and that you can draw the track and animate the train moving along the track. The first part (making a world, manipulating points) was a Programming Assignment, and we gave you sample code - especially the CubeIt programs.

You are to write this program doing the drawing with the OpenGL graphics library under Windows. You may use whatever user interface tools you wish (we recommend FlTk, but GLUT would be an acceptible alternative). See the GL Survival kit for thoughts on this. There is a lot of available sample code, but you do not have to use it.

There are two example solutions to this project in P:/course/cs559-gleicher/public/bin, both from 1999. One is a version that I wrote (called mikes-Train) and another was written by a really good student (robs-train). I recommend that you try them out to get an idea as to what you'll be doing.

Mike's sample train, circa 1999

Rob Iverson's A+ assignment from 1999

While the assignment was a little bit different in 1999, the basic idea was the same. For a totally crazy solution to this assignment, check out RocketCoaster. It was what happened when I let two students work as a team. And they were really good students.

2.  The Parts of The Assignment / Grading

The basic part of this assignment is to provide a train going around the track. You must:

  • Provide a user interface to look around the world.
  • Provide a user interface that allows control points to be added, removed, or repositioned. Note: even if you do a very advanced interface, you should display the control points and allow for them to be edited manually.
  • Have a track that is (at least) C1. Your program should draw the track.
  • Have a train that goes around the track (with a play button to start/stop it). The train should always be on the track. Your train need not be fancy, but it should be obvious which end is the front.
  • Have the train oriented correctly on the track. The train should always face forward if the track is flat, and mostly face forward on a 3D track (some cases, such as vertical tracks or loops can be hard, a basic assignment doesn't have to get those right).
  • Allow the user to "ride" the train (look out from the front of the train).
  • Have some scenery in the world besides the groundplane.
  • Your program is properly documented, is turned in correctly, and has sufficient instructions on how to use it in the readme file.

If you're curious, my sample solution (mikes-train.exe) does not do all of these. (the train has front, and the only scenery is the point light source - also, there's a wierd bug where the train stretches out when it goes down a hill).

If your assignment does all of these basic parts, you will get at least a C. If your assignment doesn't do these basic parts, we will not look at its advanced features.

Advanced features (discussed below) get you "advanced points" which determine your grade above a C. But remember: if your basic features don't work, you can't get any advanced points:
0-20 pts = C
20-40 pts = BC
40-60 pts = B
60-80 pts = AB
76-100 pts = A
more than 100 pts = Extra Credit (although, your grade is an A)

Note: these grades are guidelines. We reserve the right to give you a better grade than what this scale gives you. We will not give you a worse grade

If your code or documentation is bad, we may assess up to a 20 point penalty. (This penalty cannot pull you below zero).

3.  Advanced Features

You may pick as many advanced features as you want to implement. If you're happy with a C, you don't need to implement any. Otherwise, pick as many as you want to get enough points.

We will only check the features that you say that you have implemented correctly. Partial credit will be given for advanced features, but negative credit may be given for really incorrect features. (so, its better to not say you implemented a feature than to show us something that is totally wrong).

Arc-Length Parameterization (15pts)

Having your train move at a constant velocity (rather than moving at a constant change of parameter value) makes things better. Implementing this is an important step towards many other advanced features.
You should allow arc-length parameterization to be switched on and off to emphasize the difference, you should also provide a speed control.

Give a tension control for the splines (5 pts)

This is so simple, but it will give you some intuitions for what the tension parameter does. For cardinal splines, you could have a different tension value for each control point. You should allow for tension to be adjusted interactively (like with a slider).

C2 Curves (10 pts)

Having C2 Curves are better than C1 curves. (the 2nd order discontinuities would make the motion unrealistic). With C2 curves, your train may not go through the control points, but only approximate them.

Direct Manipulation of C2 Curves (10 pts)

If you implement C2 Curves that are approximating, you might try to implement some scheme where the user manipulates the track and the control points are adjusted automatically. One relatively easy method for doing this is the paper:
Barry Fowler, Richard Bartels. "Constraint-Based Curve Manipulation," IEEE Computer Graphics and Applications, vol. 13, no. 5, pp. 43-49, September/October, 1993. If you're on the UW campus, you can get the article here.
Note: to get full credit for this feature, you need to provide for total control over the curve - just translating a control point when the user tries to move the curve doesn't apply.

Draw nicer looking tracks (8 pts for parallel rails, 5 pts for rail ties)

Drawing rail ties (uniformly spaced lines perpindicular to the tracks) and parallel tracks is a little bit tricky. The rail ties require good arc-length parameterization (to get uniform spacing). For parallel rails, simply offsetting the control points doesn't work. See the comments on multi-part points below.

Correct Orientation in 3D (5pts for looping correctly, 10 pts total for "up" controls)

The simple schemes for orienting the train break down in 3D - in particular, when there are loops. Make it so that your train consistently moves along the track (so its under the track at the top of aloop).
One good way to provide for proper orientations is to allow the user to control which direction is "up" at points along the curve. This allows you to do things like corkscrew roller coasters.

Save and Load Tracks (5 pts)

Being able to write out track designs and read them back in makes it easier to show off what your program can do. This feature will save you time as it will make your program easier to test.

Have Real Train Wheels (8 pts)

Real trains have wheels at the front and back that are both on the track and that swivel relative to the train itself. If you make real train wheels, you'll need arc-length parameterization to keep the front and rear wheels the right distances apart (make sure to draw them so we can see them swiveling when the train goes around a tight turn).

Have Multiple Cars on Your Train (8 pts, 2pts for different designs)

Having multiple cars on your train (that stay connected) is tricky because you need to keep them the correct distance apart. You also need to make sure that the ends of the cars are on the tracks (even if the middles aren't) so the cars connect.
If you're really into trains, you could have different kinds of cars. In particular, you could have an engine and a caboose.

Have People On Your Roller Coaster (5pts)

Little people who put their hands up as they accelerate down the hill are a cool addition. (I don't know why putting your hands up makes roller coasters more fun, but it does). The hands going up when the train goes down hill is a requirement.

Implement simple physics (5pts for momentum, 5 more for roller coaster physics)

Roller coasters do not go at constant velocities - they speed up and slow down. Simulating this (in a simple way) is really easy once you have arc-length parameterization. Remember that Kinetic Energy - Potential Energy should remain constant (or decrease based on friction). This lets you compure what the velocity should be based on how high the roller coaster is.
Even Better is to have "Roller Coaster Physics" - the roller coaster is pulled up the first hill at a constant velocity, and "dropped " where it goes around the track in "free fall." You could even have it stop at the platform to pick up people .

Have a "sketch-based" interface (10-20 points, depending on features implemented)

Make an interface where the user draws a curve on the ground, and figure out how to fit a spline to it.
If you're really interested in this, there are methods for sketching 3D curves (such as sketching 2D at a time). Ask us.

Lighting (5pts)

Having proper lighting makes things look more 3D. Its really easy to do in OpenGL.

Hack Shadows (5pts)

Having hack shadows "dropped" onto the groundplane are more than just eye candy - they actually make things more usable by giving a depth cue. The sample programs do this - although to get full points, you'll need to use a stencil buffer to make overdraw work correctly.

Headlight for the Train (5pts)

Have the train have a headlight that actually lights up the objects in front of it. This is actually very tricky since it requires local lighting, which isn't directly supported.

Something so cool we can't predict it

Yes, you might think of something to do that we didn't mention here. If its really cool, we might give you points for it. We'd like you to focus on trying to do more with the curves aspect of this assignment (rather than making arbitrary eye-candy), so we won't give you points for just making eye candy (e.g. putting textures on things) - there will be a whole project devoted to that. If you want to do something and you want to make sure it will be worth points, send the instructor email.

4.  A note on grading

For different features that have multiple parts, sometimes the parts do add up.

  • Having both rail ties and parallel rails is worth more than having either one, but probably not as much as having both (if it were really amazing you could get all points, but it would have to be amazing). Just drawing a line for the rails and drawing lines for the rail ties is a simple way to do "fancy tracks" (better is to draw polygons to give the them some thickness).
  • The other "multiple parts of one things" vary. simple physics would be 5 points for momentum, and 5 more points for having the "ramp up".
  • for multiple cars, 8 points is for having multiple cars on the track at the same time with the correct spacing. 2 additional points (for a total of 10) if the cars are different designs.

You should also be aware that the point values are for doing things correctly. You will get some subset of the points for doing simpler variants.

5.  Documentation

Your documentation must have 3 parts:

User Documentation

In a file called user.txt (or user.htm, if you want to make it a web page so you can include pictures - just make sure all the links are local and the pictures are included) you must explain how to use the program.

Technical Documentation

In a file called technical.txt (or technical.htm, if you want to make it a web page), you must list all of the advanced features that you have implemented, as well as a brief description of how you implemented in. Tell us the technique you used. Sometimes, this is simple ("C2 Curves: I implemted Uniform, Periodic, Cubic B-Splines"), or you might have some explaining to do (say, if you make a sketch-based interface).
Your list should only include the features that work (the ones you want us to grade). When we do the testing of your program, we will only try out the features listed.


You should have the normal readme file, explaining where everything is.

6.  Some Hints

In case it isn't obvious, you will probably use Cardinal Cubic splines (like Catmull-Rom splines). Cubic Bezier's are an option (just be sure to give an interface that keeps things C1. For the C2 curves, Cubic B-Splines are probably your best bet.

You should make a train that can move along the track. The train needs to point in the correct direction. It is acceptable if the center of the train is on the track and pointing in the diretion of the tangent to the track. Technically, the front and back wheels of the train should be on the track (and they swivel with respect to the train). If you implement this level of detail, please say so in your documentation. It will look cool.

In order to correctly orient the train, you must define a coordinate system whose orientation moves along with the curve. The tangent to the curve only provides one direction. You must somehow come up with the other two directions to provide an entire coordinate frame. For a flat track, this isn't too difficult. (you know which way is up). However, when you have a roller coaster, things become more complicated. In fact, the sample solution is wrong in that it will break if the train does a loop.

The sample solution defines the coordinate frame as follows: (note: you might want to play with the sample solution to understand the effects of this)

  1. The tangent vector is used to define the forward (positive Z) direction.
  2. The "right" axis (positive X) is defined by the cross product of the world up vector (Y axis) and the forward vector.
  3. The local "up" axis is defined by the cross product of the first two.

Doing arc-length parameterizations analytically is difficult for cubics. A better approach is to do them numerically. A simple way to do it: create a table that maps parameter values to arc-lengths. Then, to compute a parameter value given an arc length, you can look up in the table and interpolate.

Edit - History - Print - Recent Changes - Search
Page last modified on November 06, 2006, at 04:40 PM