Final Project: OpenGL Skateboarder
CPE-471 - Michael Haskell
Modern smartphones have gyroscopic sensors and accelerometers built into their hardware. The final goal (outside the scope of this project) will be to use a smartphone as a game input controller. A player will throw the device in the air in a combination of flips and spins that mimics the movement a skateboard makes while a skateboarder performs tricks.
For example, in skateboarding there is a trick called a "kick-flip". In order to perform a kick-flip a human skateboarder needs to kick down hard on the tail of the skateboard, sending the skateboard into the air, then they must kick the upper side of the skateboarding to make the skateboard flip 360 degrees on the z-axis before landing back on the skateboard.
Performing a kick-flip using the smartphone as a game controller will require a player to throw the game controller in the air and flipping it 360 degrees on the z-axis. This project's aims is to render a hierarchical skateboarding model performing the trick that is completed using the game controller. Simply put, when a user flips the phone in the air to perform a kick-flip, they will see a computer-generated animation of a skateboarding performing a kick-flip.
471 - Final Project Requirements
As discussed with professor Zoe Wood the scope of CPE-471's final project was to implement a simple prototype of a kickflip scene and more importantly, build a keyframing tool to support further animations. I believe the project was a success. Below are some of the technologies used.
Highlighted Graphic Technologies
- Hierachical Modeling - The skateboard was downloaded from turbo-squid and is composed of 7 elements, each rendered with phong shading and texture mapped colors for realism. Moving the primary object (skateboard), the other child object move as a single object. All components can move independently
- Skinned Mesh Animation - The character was downloaded from turbo-squid and is a skinned and rigged 3dmesh. The skinning is not weighted to the bones and looks very much like a hierarchical model. In order to color the character accurately, I modified the fragment shader to pull in Vertex Texture 2d coordinates (vt) from the .obj file which mapped to texels on the texture object(.bmp)
- Maya Animation and Exporting - The rigged character object was used to make a smooth animation using keyframes every six seconds. Keyframes were set by rotating the skeletal bones; the model supported 3D joints and rotations which would have been very difficult to represent using only Euleur angles. Using Maya I was able to create smooths animation and it allowed me to animate the character with a freedom of motion that was intuitive. The following link has a very useful tutorial on how to animate a simple lamp within Maya.
- Camera & Lighting - The camera is controlled by the mouse and keyboard for basic straffing and navigating through the world. A single light lights the stage and can be controlled via the keyboard.
- Scene Building - A C++ Scene class was written to load a scene directory containing a .scene file and an optional series of .obj files. The .scene file can be used to key transformations for any object with xyz parameters for scaling, rotation, and transformation. When .obj files are included in a scene's home directory the Scene class provides the ability to load each shape into the GPU buffers for fast rendering. An additional feature of the C++ Scene class including public functions for changing the animation duration in milliseconds, this was useful to ensure proper playback speed, rather than rely on cpu render limitations.
- Looking forward - I would like to implement frame interpolation using OpenGls mix() function.
Skeletal Animation Tutorial (PDF)
The two images above show how the textures are pulled in via the fragment shaders. And the third shows the texture map used for the skinned mesh coloring, prior to it being converted to a 24-bit bmp file.
An image showing the structure of the scene directories
The images above show the format of the .scene files for the skateboard animation and for the character animation.
Without the texture mapping and shading, the object looks a bit plain.
Here we see a still-shot representing a combination of all the computer graphics techiniques listed above.
Video of the rigged mesh's skeletal joints in Maya.
Video of keyframing in Maya.
Video of the animation in Maya.
Navigation of the OpenGL scene.
Kickflip animation in OpenGL.
Slow-motion kickflip animation in OpenGL.
Changing skateboard textures in OpenGL.