CompSci 344
Spring 2015
Computer Graphics

Flight Simulator - Addendum, Following Curves

Motivation coming soon...

Specification

Allow the user to specify a path to follow in your world. The path can either be on the ground, such as train tracks or a roller coaster, or in the air, such as the flight path for a plane to follow. Which one you choose to model is up to you.

Your input will be an grey-scale image that is the same size as the one representing the terrain, but in which white indicates there is no path and grey indicates there is a path (darker is lower, brighter is higher). These input files could in principle be drawn using any 2D paint program and saved as a image file. You must error check these path image files such that the path "follows" the terrain if it would otherwise go below or into the terrain (i.e., a black line in the given image should follow the height of the terrain closely).

The points drawn in the image will serve as control points for a spline the user be able to follow through the world. Draw the curve represented by your spline in addition to your terrain and skybox (i.e., on the ground this might look like a dark road and, in the air, it might be lighter to show where the plane is heading).

Allow the user to animate the camera along the spline path. To start, move your camera at a constant speed along the spline. You will certainly want to have your camera facing "forward" (along the unit tangent to your spline) as it moves. But you will also need to determine a proper "up" vector for your camera to follow — this is a challenging problem because there is no clear way to determine the continuous path of normals for the spline. An easy algorithm is to decide your up vector is to always set it equal to the normal of your ground plane — however, this will lead to very unrealistic animation. A better method is described here. In either case, you will want to use quaternions to help manage the rotations along the path.

When the user reaches the end of the path, the animation should simply stop (crashes are extra credit :)

Implement the following user controls:

  1. Change from interactive flying mode to follow the path mode (and back)
  2. Toggle drawing the path on/off (so the user can simply enjoy the landscape)
  3. Toggle drawing the spline's control points on/off
  4. Speed up and slow down the animation speed along the spline
  5. Reset the animation back to the beginning of the spline

As usual, please list these controls in your README, along with any others you decide to add.

Extra Credit

There are many parts of the homework that are open ended. You can earn bonus points with extremely creative and efficient solutions. Make sure that you mention your assumptions, extra features, and how to run your program in your README file.

To get you started, here are some extra credit ideas:

Resources