Difference between revisions of "Project3S16"
(→2. Scene Graph Engine) |
(→3. The Wedding Cake Ride) |
||
Line 53: | Line 53: | ||
* <tt>Pod</tt> should draw the [OBJ model of a pod]. | * <tt>Pod</tt> should draw the [OBJ model of a pod]. | ||
− | ==3. The Wedding Cake Ride== | + | ==3. The Wedding Cake Ride (30 Points)== |
First get your software ready to recursively traverse the scene graph for rendering by creating a root node of type Group and calling its draw() function with the identity matrix as its parameter. | First get your software ready to recursively traverse the scene graph for rendering by creating a root node of type Group and calling its draw() function with the identity matrix as its parameter. |
Revision as of 12:19, 22 April 2016
Contents |
Project 3: Wedding Cake
In this project you will need to implement a scene graph to render a novel theme park ride. The ride is the Wedding Cake from the Centrifuge Brain Project video - the relevant part of the video starts 2:00 minutes into the clip.
The total score for this project is 100 points. Additionally, you can obtain up to 10 points of extra credit.
1. Sky Box (20 Points)
Start with code that uses your trackball code to control the camera. (If you didn't get that to work the keyboard controls will suffice.) (5 points)
Create a sky box for your scene. A sky box is a large, square box which is drawn around your entire scene. The inside walls of the box have pictures of a sky and a horizon. Sky boxes are typically cubic, which means that they consist of six square textures for the six sides of a cube. Here is a great tutorial for sky boxes in modern OpenGL.
Here is is a nice collection of textures for sky boxes, and here is an even bigger one.
Draw a cubic sky box and make it big enough to hold an entire theme park.
Make sure single-sided rendering (triangle culling) is enabled with these lines somewhere in your code to ensure that you will never see the outside of the box:
glEnable(GL_CULL_FACE); glCullFace(GL_BACK);
Use the following settings for your texture after your first glBindTexture for correct lighting and filtering settings:
// Make sure no bytes are padded: glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // Select GL_MODULATE to mix texture with polygon color for shading: glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // Use bilinear interpolation: glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
To familiarize yourself with texture mapping in OpenGL, we provide a sample program, which loads a PPM file and uses it as a texture for a quad. If you decide to use one of the above referenced sky box images, you will have to convert them from JPEG to PPM format. The free image processing tool IrfanView for Windows will do this for you. Alternatively, you can use a third party library such as SOIL to natively load JPEG images.
2. Scene Graph Engine (15 Points)
Implement a scene graph structure to simplify rendering of the ride. Use the following hierarchy:
The classes should have at least the following functionality:
- Class Node should be abstract and serve as the common base class. It should implement an abstract draw method: virtual void draw(Matrix4 C) = 0, and also an abstract virtual void update() = 0 method to separate bounding sphere updates from rendering.
- Group should store a list of pointers to child nodes (std::list<Node*>) and provide functionality to add and remove child nodes (addChild(), removeChild()). Its draw method needs to traverse the list of children and call each child node's draw function.
- Geode should be an abstract class. It should update the rendering matrix, and have an abstract render function to render its geometry.
- MatrixTransform should store a 4x4 transformation matrix M which is multiplied with matrix C, which is passed to the draw method.
- Cylinder should draw a cylinder, which you can load from [this OBJ file].
- Pod should draw the [OBJ model of a pod].
3. The Wedding Cake Ride (30 Points)
First get your software ready to recursively traverse the scene graph for rendering by creating a root node of type Group and calling its draw() function with the identity matrix as its parameter.
We provide a 3D model of a pod for the ride. Use a cylinder for the vertical center post, and smaller cylinders for the horizontal arms that hold the pods.
Rotation
The ride should have three levels of pods, each with three big arms to hold three pods each. The center post that holds everything should be able to rotate, as well as each set of three pods, and also each pod should be able to rotate about its pivot point.
Translation
Each of the three arms on each of the three levels should be able to extend its length. Also, the arms that hold the pods should be able to extend as well.
4. Animation
Animate the Wedding Cake ride by modifying the following things:
- Rotate the entire ride about its center post.
- Rotate each set of three pods about its center.
- Rotate each pod about itself.
- Make the posts that extend from the center extend their length, independently from each other.
- Make the arms that hold the pods change their lengths, independently from each other.
5. Cameras
Use your Bear data set from the previous project to place the bear in one of the pods. You'll have to downscale it by adding a MatrixTransform node with a scale operation in front of it, and you'll also have to shift it so that it sits in the right place, and you may have to rotate it as well.
Once Bear is in place, create a camera class for the scene graph and place a camera right in front of the Bear's face, to simulate what he sees. Add keyboard support to switch between the outside view and the Bear's view.
6. Extra Credit: Split Screen (10 Points)
There are two extra credit options. Each of them gets you 5 extra points.
- Implement a split screen view which shows both the scene camera, as well as the view from the bear, side by side.
- Create special event lighting for the Wedding Cake ride. Use at least three spot lights in different colors that are located on the ground and moving to illuminate the ride from different directions, by each following a different pod.