For the second milestone of the Game Engine Programming II class that I took in the spring quarter 2013 at DePaul University, I added animation capability to both my game engine and my FBX converter. It was one of the most difficult tasks that I did for this class. It took a lot of iterations to write a good easy-to-use animation system. My intention was to make the system completely data-driven, having the FBX converter extracting all the needed animation data from the FBX file (an FBX file can contain multiple models, with each model having multiple animations in a so-called animation stacks) and placing these data as a table-indexed binary chunks into a .dpu file for the model data, and into a .bdpu file for the skeleton data. The extracted skeleton data are:
- The skeleton bones hierarchy.
- The skeleton’s animation stacks.
- The keyframes associated with each bone in each animation stack.
I then made the game engine capable of loading these data, and using them to draw the bones and animate them.
The Math Engine Library that I wrote for the first part of this class had to be changed to support quaternion math operations and to fully integrate them with the existing vector and matrix operations. Linear & Spherical Linear Interpolation (LERP and SLERP) operations have been added as well. These operations are crucial to any animation engine.
The Animation Engine Features
- Completely data-driven (loads all needed data from a flexible expandable binary file).
- Ability to draw bones based on the data read from the binary file. Bones colors can be changed by the user of the system.
- If the FBX model has multiple animations in multiple animation stacks, they will all be available for that model’s bones and any of them can be selected to be the current active animation in the engine.
- Ability to play back the animations forward, backward, faster, and slower.
Next thing I will be working on is “Skinning”. The above features are demoed in the below video.