Difference between revisions of "Project4S16"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(2. Control Handles)
(4. Physics)
Line 38: Line 38:
 
==4. Physics==
 
==4. Physics==
  
Make the pod slide along the roller coaster track like in the video. The pod should always be aligned with the track: when the track descends, the pod should be tilted down, etc. The pod does not need to lean as if gravity pushes it outwards. The approach to determine the velocity of the pod is to use a friction-less energy preservation model: the sum of the potential energy (proportional to the height the pod is at) and the kinetic energy (determined by its velocity) remains constant. In other words: the lower the pod is the faster it goes. This way, when the pod starts at the highest point of your roller coaster, it should go through the entire track and end up at the highest point again without getting stuck.  
+
Make the pod slide along the roller coaster track like in the video. The pod should always be aligned with the track: when the track descends, the pod should be tilted down, etc. The pod does not need to lean as if gravity pushes it outwards. The approach to determine the velocity of the pod is to use a friction-less energy preservation model: the sum of the potential energy (proportional to the height the pod is at) and the kinetic energy (determined by its velocity) remains constant. In other words: the lower the pod is the faster it goes. This way, when the pod starts at the highest point of your roller coaster, it should go through the entire track and end up at the highest point again without getting stuck.
  
 
Support a reset button to automatically place the pod at the highest point of your track, with a small amount of forward momentum. The reset button can be a mouse button, or keyboard key, or even a GUI widget, as you choose.
 
Support a reset button to automatically place the pod at the highest point of your track, with a small amount of forward momentum. The reset button can be a mouse button, or keyboard key, or even a GUI widget, as you choose.

Revision as of 11:37, 13 May 2016

Contents

Project 4: Roller Coaster

In this project, you need to create a track editor for a simple roller coaster. The roller coaster will have just one car, which will be the pod from project 3. The editor should work like the one in the video shown in class.

Start with your sky box from project 3, along with the code to manipulate the camera with keyboard and/or mouse. If you prefer to different sky box textures for this project, you are free to do so.

You will also need your code to load and draw the pod.

We recommend that you use and further develop your scene graph engine from project 3, but this is not a requirement.

1. Track

Just like in the Bezier curve video, create eight connected Bezier curves. Ensure C1 continuity by forcing the tangents of the two curves in the connecting points to be parallel. Draw the Bezier curves by approximating them with about 100 straight OpenGL line segments each, for a total of about 800 line segments. Make them wider than the default by using OpenGL command glLineWidth, so that they are more easily visible.

2. Control Handles

Make your control points editable by the user with the mouse. You need to support both the interpolating and the approximating control points.

First, draw the control points:

  1. Interpolating control points: these are the control points which the curve goes through, also called anchor points. Highlight the points with spheres or otherwise to make it easy to see where they are.
  2. Approximating control points: these control points "pull" on the curve but the curve does not go through them. Highlight these points in a similar way as the interpolating points, but use a different color or shape to distinguish them from those.

To ensure C1 continuity, you will need to support control handles like in the video. They connect the two last control points from one curve with the first two control points of the neighboring curve, and ensure that they lie on a straight line. Draw all eight control handles (lines).

Finally, use the control handles with the mouse to modify the control points, and update the shape of the Bezier curve in real-time, just like the video demonstrates. To detect which control point is being modified, we will go over a few options in the discussion on Monday May 9th. Examples are ray casting or a selection buffer.

Notes:

  • If you own a 3D input device such as a Razer Hydra or Sony Move, you are welcome to use it in this project as it will simplify the interaction with the control points, but this is by no means a requirement. Note that we can't provide tutoring on anything specifically related to your 3D device.
  • The control point interaction has to be intuitive: when you pull a point with the mouse it should move in the same general direction as the mouse cursor, regardless of the camera position.

3. Environment mapping

Load the pod from project 3. It will be the roller coaster car. Its surface should look like polished metal, so you need to use environment mapping on it.

The Cube map tutorial explains how environment mapping is done with your sky box as the environment. Feel free to follow it and use the code from the site to make it work. The goal is to have the sky box reflect on the pod, to give the impression of the pod's surface being polished metal (i.e., act like a mirror).

4. Physics

Make the pod slide along the roller coaster track like in the video. The pod should always be aligned with the track: when the track descends, the pod should be tilted down, etc. The pod does not need to lean as if gravity pushes it outwards. The approach to determine the velocity of the pod is to use a friction-less energy preservation model: the sum of the potential energy (proportional to the height the pod is at) and the kinetic energy (determined by its velocity) remains constant. In other words: the lower the pod is the faster it goes. This way, when the pod starts at the highest point of your roller coaster, it should go through the entire track and end up at the highest point again without getting stuck.

Support a reset button to automatically place the pod at the highest point of your track, with a small amount of forward momentum. The reset button can be a mouse button, or keyboard key, or even a GUI widget, as you choose.

5. Optional (10 Points Max.)

There are two options for extra credit. Each will get you a maximum of 10 points, for a maximum of 10 points of extra credit overall.

a) Extend the Bezier curve to a band, to give the roller coaster a horizontal orientation and thus make it more realistic. Do this by turning the Bezier curves into patches, defined by a Bezier curve along the track, and a 1st order polynomial perpendicular to it. Note that this is similar to Bezier patches, but those use Bezier curves along both axes. Here, you should use a Bezier curve only along one axis, the other should be a simple line. Add the additional control points and control handles to allow determining the orientation of the track. Render the track with triangle strips, instead of lines. Place the pod so that it sits on the track, rather than the track going through it. Modify the orientation of the pod so that when it moves it always stays flat on the track rather than upright. (10 Points)

b) Make the environment map more realistic by reflecting the track in it, in addition to the sky box. Do this by placing a virtual camera in the middle of the pod, with a square image and a 90 degree field of view. Then take six pictures with the camera, facing in perpendicular directions to cover all six faces of a cube. These pictures now make up your sky box from this perspective. Then use environment mapping on the pod using this temporary sky box. This process has to be repeated for every frame rendered. (10 Points)