Project : A Tiny Amusement Park with Roller Coasters and Water Shaders

This project would like you to create an amusement park with roller coasters allowing users to have fun and interact with the program. Inside the amusement park, you must also explore a few possibility to simulate the water surface and render the surface with shader programs which become more and more important in graphics. At the end, you can use your creativity to create an interesting environment or an interactive simple game.


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


Once it becomes a roller coaster, loops, corkscrews, and other things become possible


The main purposes of this project is to give you experience in working with curves (e.g. the train and roller coaster tracks). It will also force you to think about coordinate systems (to make sure that things move around the track correctly). Thus, we will provide you framework code so that you don't need to worry about that so much.

The core of the project is a program that creates 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. We'll provide the framework code that has a world and manages a set of control points. You need to draw a track through those points, put a train on that track, and have the train move along the track.

Basically in this project you will need to:

  • Find your way around the framework code.
  • Add the basic functionality: draw a track (curve) based on the control points and draw a train on that track. If you do the latter part correctly, the framework will make it easy to animate the train going around the track. You will also need to implement a "train view" (so the user can "ride" your train).
  • Add more advanced features: nicer drawing of the track, arc-length parameterization, more kinds of splines, physics, ...
  • Add special effects and extra features to make it really fun. Really nice looking train cars, scenery, better interfaces for creating complex tracks, ...

I must emphasize that the basic functionality is most important, and the core advanced features (arc-length parameterization) are the next most important things. Fancy appearance (like using textures and pretty lighting) aren't the focus here - add them only if you have time after doing the more important things.

We have provided a sample solution  of the possible features (at least the most common ones). We recommend that you play with it a bit to understand how it works. The example also has options that lets you see some of the most common mistakes and simplifications that students make.

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. There are two more "normal" example solutions to this project which are by and Rob, 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


Water Introduction


Water is commonly seen in our daily life. However, the interaction and rendering of water involve complex physical computation. Furthermore, interactive graphics is a program which can interact with the virtual world created by you.


Water Surface Generation With GPU

Basically, the water surface can be simply decomposed into two geometric components: high-level surface structure and low-level surface details.

  • The surface structure represent the large scales of the wave movement and can be represented with a set of 2D grid with the y direction represent the height of the grid point. A vertex shader can be used to simulate the movement at the vertices by changing the normal and the y position of the vertex.
  • The surface detail represent the small scale perturbation in the local area and generally can be represented as a normal map. A pixel shader is created to generate a normal map for those perturbation.

Generally, there are several ways to implement the wave on the surface of water:

  • Sine waves (10) (Ref. 1): The sum of the sine waves are chosen to represent the complex water surface movement. The equation can be expressed as


  • Wavelength (L): the crest-to-crest distance between waves in world space. Wavelength L relates to frequency w as w = 2w/L.
  • Amplitude (A): the height from the water plane to the wave crest.
  • Speed (S): the distance the crest moves forward per second. It is convenient to express speed as phase-constant, phi , where phi = S x 2w/L.
  • Direction (D ): the horizontal vector perpendicular to the wave front along which the crest travels. Please refer to Ref. 1 for more direction details.
  • Height maps (10) (Ref. 3): similar to sine wave method, height map method decomposes the wave on the water surfaces into a set of different level of detail represented as a heightmap (the shape of single component and generated by artists) The following shows an example of the height map.


The combination of the heightmap can be expressed as the following equation.


Please refer to Ref. 3 for more heightmap details.

  • Wave equation(Ref. 4): Generally, the movement of the wave can be expressed as a wave equation as listed in the following:


Then by modeling the water surface as cubic Bspline surfaces, the right hand side of the equation can be expressed by the following:


And then the integration can be computed with one of the following integration methods


Then the equation is solved at each vertex of the 2D mesh to generate the water surface. Please refer to Ref. 4 for details.

Water Surface Rendering With GPU

Two important effects for the water surface rendering: reflection and refraction. We assume that we are looking outside the water. The reflection and refraction can be generated with the following different methods

  • Combination of refraction and reflection with an environment map for the sky and a set of texture map for the box. (Ref. 1) (10)
  • Using the refraction map and reflection map to simulate the possible viewing condition from above the water to simulate the refraction and reflection effects. (Ref. 4) (10). The following shows an example of refraction and reflection map


In addition to the refraction and reflection, the caustics on the floor due to concentration of refraction and reflection is also visually important. Therefore, simulate the caustics effect on the floor is also important for the rendering. (5)


Ground Rules

You can complete the assignment individually or in pair. We allow (encourage) you to discuss the project with your classmates, but the things you turn in must be substantively your own.

Your program must use OpenGL or OGRE3D and run on the computers in RB-508 (like everything else in this class). While we strongly recommend you use the framework code, this is not a requirement. The Framework/Example solution uses FlTk or OGRE3D, but you can use any UI toolkit that you wish, providing its available in the Lab (talk to us) as we need to be able to build your program.

If you want to use other external libraries/code, please ask us. Something like a math library or data structures library is probably OK, but please check.

The Basic Functionality and Framework and Components

The most basic part of this assignment is to provide a "track" for the train track. Your program must do the following things (we provided three version of framework: the ):Project3Framework.rar

  • Provide a user interface to look around the world, as well as providing a "top down" view.
  • You must have a "ground" (so the track isn't just in space).
  • 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.
  • Allow for the control points to be saved and loaded from text files in the format used by the example solution.
  • Provide lighting.
  • Allow things to be animated (have a switch that allows the train to start/stop), as well as allowing for manually moving the train forward and backwards.

If you make your own framework, please make sure you can do all of these things. You don't get any extra points for writing it yourself, but you will lose points if you don't have the basic features.

The basic/essential features and components you must add:

Roller Coasters:

  • Have a CubicBSpline track. Your program should draw the track. The track should be a loop, always, and should be either interpolate or approximate the control points.
  • 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. And your train should not distort in wierd ways as it moves (if it is not rigid, it should be for a good reason).
  • 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. Getting 3D orientation correct in the hard cases (like loops) is a more advanced feature (see below).
  • Allow the user to "ride" the train (look out from the front of the train). There should be a button or keystroke to switch to this view.
  • 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.
  • You should have a slider (or some control) that allows for the speed of the train to be adjusted (how far the train goes on each step, not the number of steps per second).


Amusement Part:

  • at least a water surface with interaction
  • water rendering effects: refraction and reflection
  • Multiple objects moving at any time (besides the ones that I made)
  • Multiple different types of behaviors (besides the ones that I made)
  • Multiple different types of buildings / scenery (besides the ones that I made)
  • Multiple new textures. Some must be hand painted. Some must not be flat (that is, it must wrap onto multiple polygons)
  • You must attempt "enough" technical challenges (see the technical challenges page).
  • You must have at least 3 shaders in your program (by "shader" we mean a pair of vertex/fragment programs attached to an object). At least one of these shaders must provide a procedural texture, and at least one of the shaders must be (properly) affected by the lighting. At least one of the shaders must be affected by the time of day (so you need to figure out how to pass the time of day to the shader).
  • You program must work at a sufficient frame rate (which isn't hard since the tomputers are so fast).
  • You must add something that is effected by the time of day (besides the one shader used to fullfill the requirement above). For example, you can have an object that changes color (the shader is sensitive to the time of day) and shape (something besides the shader is sensitive to the time of day).
  • You must use at least one type of "advanced" texture mapping: multi-texturing, projective (slide projector) texturing, environment mapping, bump mapping, or shadow mapping. (if you want to pick something not on this list, you may want to check with us to make sure it counts) 10. An object made out of a curved surface. You can implement subdivision, or some form of parametric surfaces, or do a surface of revolution, or ... This is described more on the technical challenges page.

The framework code is designed to make it easy to add all of those things. In fact, there are "TODO:" comments explaining where to plug them in. See the the discussion of it here.

The framework code was used to make the sample solution. We didn't give you all of the files, but you can see the "hooks" to the parts we didn't give you (they are turned off with a macro). In some places, we intentionally left extra code for you to look at as a hint. The framework has some spiffier features (like drop shadows), and some features you may not need (the control points have "orientation").


With the advance of GPU technology, GPU becomes more and more popular in computer graphics specially in game industry. It is also noticed by general computation community. This project will provide you with experience at programming shaders with GPUs, modeling objects and creating interactive animations for computer graphics, and introduce you to many more of the features of OGRE3D. Your goal is to make the scene as a scene park based on the roller coaster. The overall goal of this project is to give you an opportunity to explore topics in interactive graphics: how do you make things that look interesting, and be interactive. While some of this is artistic (you need to pick interesting objects to make and good textures/... to look nice), some of it is technical: you need to pick things that can be implemented efficiently and have interesting behavior. Like project 1, this project defines a set of sub-goals with points awarded for each goal. Unlike project 1, the goals are far more loosely defined, so there is scope to try interesting things to get all the points available.


Furthermore, water surfaces are common in computer graphics, especially in games for creating fantastic effects. They are a critical element that can significantly improve the level of realism in a scene. But depicting them realistically is a hard problem, because of the high visual complexity present in the motion of water surfaces, as well as in the way light interacts with water. This project would give you the chance to explore techniques developed for rendering realistic depictions of the water surface. With these two things in mind, this project would like you to have the experience by implementing a shader program and a CUDA program to generate a water surface and then rendering it with reflection and refraction effects. In addition, ray-tracing is very important global illumination algorithm to generate realistic images in graphics community. Therefore, the project also ask you to implement a ray tracer for rendering the water and other scene objects.

In terms of your grade, effort spent on technical are more valuable because we are computer scientist. For example, it is better to spend your time making a simple "blocky" car drive around in an interesting way, or to make a simple shaped car out of parametric surfaces, or to light the car in an interesting way, then to carefully model a gorgeous model of a car. (of course, if you want to make model a gorgeous car, implement bezier patches to display its curved body, have it realistically race around a track ... - we won't complain).

Some specific things we want you to learn from this assignment (which will explain some of the requirements):

  1. To try out some of the technical topics that we've discussed in class (subdivision surfaces, culling, ...) or topics we won't discuss too much in class (particle systems, fractals, ...)
  2. To get some experience with how textures are used to make simple objects look more interesting.
  3. To get some experience with creating geometry for graphics.
  4. To gain experience working with a larger, more complex graphics application.
  5. To gain some experience creating the behavior/motion of graphics objects.
  6. To work with shaders for generating water surfaces and shading effects
The Tasks

Fundamentally, to generate the perception of the water in an interactive application consists of two tasks: 

  1. Your program has to generate a water surface according to some physical rules which are formed for some specific phenomenon in your mind. This generated surface represents the boundary of water for a renderer to generate proper images for illustrating the water surface.
  2. Your program must render the water surface to simulate the effects of refraction and reflection. Furthermore, the caustics caused by water movement on the sea floor can be added to add more reality.

In addition, realistically rendering the water surface is also important for other graphics applications, a basic ray-tracing algorithm is required to simulate the global illumination effect in the scene. The ray tracer will generate an image according to rays through the center of all pixels to interact with the scene object and then compute the lighting effects and shadow effects.

Furthermore, each task requires modeling one or more objects using a specific technique from class. The points available for each technique varies according to the difficulty of the task. In all cases, you get a base number of points for implementing one object with a technique, then an extra 5 points for each additional, but distinct, object with the same technique. You can score points for a maximum of three objects with any one technique. For instance, if you create a texture mapped polygonal ticket booth, and a texture-mapped polygonal roller-coaster carriage, and extrude the roller-coaster tracks, then you get 20 + 5 + 25 = 50 points. If an object involves more than one thing, such as a texture mapped, swept surface, then you can score points for both texture mapping and sweep objects.

The maximum number of points is 100. As with Project 1, you can do as much as you like, and we will truncate to 100 as the final step in computing the grade. The individual tasks, point value, and example objects are:

Roller Coasters Check Point:




Arc-Length Parameterization

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.


Approximating C2 curve

To draw the curves (or to compute arc length parameterizations), you need to sample along the curve (for example, to draw lines connecting the points). The curves are simple enough that simply sampling them uniformly and densely is practical.


Draw nicer looking tracks

The most basic track is just a line. To make something nicer (to make a tube or a ribbon), you need to consider the geometry of the curve.

  • Parallel rails: for parallel rails, simply offsetting the control points (in world space) doesn't work. You need to know the local coordinates as you go around the track.
  • Rail ties: ties are the cross pieces on railroad tracks. Getting them right (uniformly spaced) requires good arc-length parameterization. In the example code, you can turn the arc-length parameterization on and off to see the difference.


Correct Orientation in 3D

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 a loop).

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. The sample solution does this (its why the framework has an orientation vector for each control point). Note that the train still needs to face forward, the given orientation is just a hint as to which way up should be.


Water Simulation Check Point:




Sine Wave

Implement the sine wave on the surface of water.


Height maps

Implement the height map method on the surface of water.


Skymapping reflection

Combination of refraction and reflection with an environment map for the sky and a set of texture map for the box.


Refraction map and reflection

Using the refraction map and reflection map to simulate the possible viewing condition from above the water to simulate the refraction and reflection effects.


If there's something that you want to do that you think is a good task, but not listed, please ask. We may extend this list at a later date as we think of more ideas. We may not be able to help you with some of these, so doing it will require some bravery and determination.

It is important that if you do something, you are able to show it off in the demo/make a picture for your album. So if you model some nice object, make sure there's a fast way to get the camera to go there. Or, if you do subdivision, show different levels of the same object so we can tell you really did the subdivision.

Some of the challenges require something to be complicated. You might wonder "when is an animation complicated enough that it qualifies as a challenge" or something like that. Generally, if you have any doubt, then it probably isn't so complicated. But if you are in doubt, ask.

Advanced Features

To get a better grade, and to really make the assignment fun, you should add some advanced features to your train or amusement part.

Note: the exact point values for each of these is not given. The rough guide here will give you some relative importances (big features are worth more than small ones).

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).

Also, remember that in your demo, you will have to show off the feature, so think about what demonstration will convince us that it works. For example, with arc-length parameterization, you're best off being able to switch it on and off (so we can compare with the normal parameterization), and think about a track that really shows off the differences. You should probably turn in example tracks that show off the features.






Tension control of a spline

  • Tension parameter controls how loosely or tightly the cardinal spline fits the input control points.
2.5 Track
Multiple cars
  • 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.
2.5 Train
Real Train Wheels
  • 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). In the sample solution, the wheels are trucked (they turn independently), but each car still rotates around its center (so its as if they are floating above the wheels). You can do better than that.
2.5 Train
Simple 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.
  • Note: you should implement arc-length first. Once you get it right it is much easier.
2.5 Train
Adaptive subdivision
  • To draw the curves (or to compute arc length parameterizations), you need to sample along the curve (for example, to draw lines connecting the points). The curves are simple enough that simply sampling them uniformly and densely is practical. Adaptive sampling (when the curve is straight, fewer line segments are needed) is a better approach, but the benefits may be hard to see. If you implement adaptive sampling, be sure to have some way to show off that it really works.
2.5~5 Track
Make totally over-the-top tracks
  • This is more of a piece of artwork, but to do something really fancy, you'll probably write code to create the points.
  • If you're really into trains, you could have different kinds of cars. In particular, you could have an engine and a caboose.
  • Switches and more complex connections in the layout
5 Track
Multiple tracks and trains
  • The track could have branches, ... You'd need to have some way to tell the trains which way to go, and some way to deal with branching curves. The framework is pretty much set up to have one track and train, but you could change this without too much hassle. You would need to make multiple World objects, but the hard part would be adapting the UI.
5 Track, Train
Sketch-based interface
  • Allow the user to sketch a rough shape, and then create a smooth curve from that. This is difficult to do well, but if you're interested, we can suggest some interesting things to try.
10 Track
Have People on your Roller Coaster
  • 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.
2.5 Train
  • 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.
2.5 Train
Particle system Model a complex, moving object as a set of little particles. You can make fireworks, rain, snow, fountains, fire, ...


(5 for first, 2.5 for each extra one)

Foundation, firework, ...
Non-flat terrain
  • This is mainly interesting if you have the train track follow the ground (maybe with tressles or bridges if the ground is too bumpy).
5 Terrain
Support Structure
  • When the track is in the air, you could create tressles or supports to hold it up (like a real roller coaster). Of course, you'd want to handle the case where the track crosses.
2.5 Track
  • Having other (non-moving) objects in the world gives you something to look at when you ride the train.
2.5 Scenery
  • Make hills with tunnels through them for your train to go through. The tunnel should adapt its shape to the track (so it should curve like the track curves).
2.5 Scenery
Texture Mapping
  •  You must create your own texture (at least 3) to earn the point from this score.
  • Add texture mapped polygonal objects to the environment. Each "object" for grading purposes consists of at least 5 polygons all texture mapped. Different objects require different maps.
2.5~5 Buildings, walls, roadways Hierarchical Animated Model
Parametric Instancing
  • Add an object described by parameters. You must create multiple instances with different parameters, and each class of model counts for separate points, not each instance.
5 Trees (cones on sticks), buildings, even rides

Sweep Objects(other than rail)

  • Add an object created as a sweep, either an extrusion or a surface of revolution. The important thing is that it be created by moving some basic shape along a path. The overall object must use at least three different uses of the swept polygon. In other words, something like a cylinder isn't enough, but something like two cylinders joined to form an elbow is.


trash bins, trees

Something cools

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. In the past people have come up with crazy stuff - some of them have become part of the assignment. 2.5 ~ 10 ...

Really Cool Shaders

  • Graphics Processing Unit(GPU) has become very important aspect in graphics. We would like to explore the usage of them such as environment map, particle simulation, water simulation, and so on. Everyone has to write 3 shaders. But if the shaders do something really cool, that counts for technical challenge. Bump Mapping definitely counts as a technical challenge. A properly anti-aliased procedural shader would be a technical challenge. Phong shading would be a technical challenge except that you can get the code from just about anywhere - combine it with something more imaginative to make a technical challenge. We'll give technical challenge points for really imaginative shaders.

2.5 ~ 7.5

Foundation, firework, ...

Hack Rendering Tricks

  • Local lights (2.5~5): have a light that only effects nearby objects. You can't just do this using the OpenGL falloff since that limits the number of lights you have - you'll need to switch lights on and off depending on what object is being drawn. Note: local lighting is NOT the hack "spotlight cones" that my sample program does. Consider putting a flashing (or even spinning) siren on a police car, or ...
  • Inter-object shadows and reflections (2.5-7.5): Shadows on the groundplane are easy. Shadows cast from one object onto another are much harder. Reflections of actual (dynamic) objects are really tricky - as opposed to using environment mapping with static environments. Implementing shadow mapping (or shadow volumes) is one way to do this.

2.5 ~ 12.5 (Depends on TA's decision)


Non-Photorealistic Rendering

Give your world an artistically styled look to the drawing. For example, make everything look like a pencil drawing by tracing object edges and making things squiggly, or use "toon shading" to make things look like a cartoon. Note: if you are really going to do an NPR world, we might be willing to remove the texture requirements - but only if you'll be doing enough NPR stuff.

5 ~  10(Depends on TA's decision)

Foundation, firework, ...

Very Advanced Texturing

  • Skybox (2.5): make a textured sky - have clouds and stars (at night). But note that a proper skybox stays fixed relative to the camera (so it doesn't have to be so huge that it causes Z-Buffer issues).
  • Billboard Object (2.5): model a complex shape by using a flat object that moves to face the viewer (and probably transparency). Nice trees can be done this way.
  • Projector Textures (2.5): make a slide projector or something that creates an unusual effect. To get full credit, it needs to be clear that you are using the texture matrix stack to get a projection.
  • Environment Map (2.5~5): Use environment mapping to create a reflective surface. Be sure to describe how you made the map.

2.5 ~ 12.5


Artistic Points

About how beautiful or cool is your amusement. It is a good decision to decorate your amusement part with a theme. 2.5 ~ 12.5 ...

Upload it to the FTP site.

What to turn in

 By the deadline you must turn in:

  • Everything needed to compile your program (.cpp files, .H files, .vcproj files, .sln files, and UI files or other things your program needs). Be sure to test that your program can be copied out of this directory and compiled on a Storm computer.
  • if you work with a partner, only turn in one copy of the project. In the other person's directory put a single file in your handing directory - a README.txt that says where to look.
  • Your README file.
  • You should make a subdirectory of the project directory called "Gallery." In this directory, please put a few JPG pictures of the best scenes in your town. Please name the pictures login-X.jpg (where X is a number). Put a text file in the directory with captions for the pictures. (note: to make pictures, use the screen print and then use some program to convert them to JPG).
  • You must also make a subdirectory of the project directory called "Video" to put a 1~2 minutes of video capturing your world.
  • Some example track files. You should not turn in the track files that we distribute (we give you a bunch) - only turn in ones that you made.

In your readme, please make sure to have the following (you can break it into seperate files if you prefer):

  1. A abstract of your work
  2. Instructions on how to use your program (in case we want to use it when you're not around)
  3. A list of all the features that you have added, including a description, and an explanation of how you know that it works correctly.
  4. An explanation of the types of curves you have created
  5. A discussion of any important, technical details (like how you compute the coordinate system for the train, or what method you use to compute the arc length)
  6. A list of the objects you modeled (if you made lots of different objects, just list the 5-10 most interesting ones). Please order the list so the most complicated/impressive one is first.
  7. A list of the behaviors you made. Please order the list so the most complicated/impressive one is first.
  8. A list of the shaders that you made with a brief description of each.A list of the technical challenges that you attempted / completed, with a description of what you did and what you used it for.
  9. Any non-standard changes that you make to the code
  10. If you used the sample, code, a file that describes any changes you made to the "core" of the system (e.g. other than changing main.cpp and adding new Objects and Behaviors).
  11. If you did not use the example code, an explanation of why you chose not to, and a discussion of your program's features.
  12. Anything else we should know to compile and use your program
Some Hints

Use the framework. It will save you lots of time.

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 it understand the effects)

  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. You approximate the curve as a series of line segments (that we know how to compute the length of). 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.

Alternatively, you can do a little search to compute the arc length parameterization. If you have a starting point (u) in parameter space, and a distance you want to move forward in arc length space, you can move along in parameter space, compute the next point, find the distance to it, and accumulate.

  • Have fun and be inventive.
  • A key thing to consider is polygon count. Graphics hardware can only display so many polygons in a second, and if you try to display too many the frame rate will collapse. Texture maps also use memory, so too many textures can even more dramatically affect performance.
  • The way the train alignment is set up, it is simplest to do just a single carriage, and a short one at that. Doing lots of cars makes it harder to keep then on the track, although it is possible.
  • Make use of the OpenGL error checking mechanism. It is described in the OpenGL Programming Guide.
  • Start simple - just try to get a polygon to appear in the center of the world.
  • The way the current carriage transformations are set up, the origin for the train is assumed to be at the bottom (at track level).
  • It is OK to have multiple modeling techniques in one object. For instance, you could have a carriage made up of some texture mapped polygons with some subdivision areas. You get all the points if you do a sufficient amount of each technique.
  • It is OK to borrow code from other sources - but not other students. You will probably learn as much trying to figure out how someone else's code works as you would doing it yourself.
  • Texture images abound on the web, so feel free to use them. Or you can use a program like Photoshop to create your own. You might even find a use for the first project.

林育生, and 郭俊廷, A Tiny Amusement Park with Roller Coasters and Water Shaders -- 林育生_郭俊廷


陳泳峰, and 陳宥潤, A Tiny Amusement Park with Roller Coasters and Water Shaders -- 陳泳峰_陳宥潤


留希哲, A Tiny Amusement Park with Roller Coasters and Water Shaders -- 留希哲


韓悅華, and 陳洛翔, A Tiny Amusement Park with Roller Coasters and Water Shaders -- 韓悅華_陳洛翔