In this assignment, you will implement transformations and forward kinematics. The features you implement in this assignment will lay the groundwork for working with motion capture and character animation. Specifically, after completing this assignment, you will be able to load a BVH motion capture file and play back the animation on a character.
> git pullIt appears that Swarthmore github may be down during our lab today. To work around this problem, I've posted the assignment here. Download it to your AnimationFramework directory. Then,
> gunzip fk-assignment.tar.gz > tar xvf fk-assignment.tarThe tar file will replace several files in your repository which you can check in later.
> rm -rf build > mkdir build > cd build > make > ../bin/FKViewer > ../bin/FKViewer-Soln
The basecode includes a simple interface and 3D viewer for loading and playing BVH files. See above for a screenshot. By default, we will load a character and several example BVH files.
The camera can be controled with the mouse:
The player control panel on the top left can be used to load and play files. The panel at the bottom left can be used to load different BVH files.
The basecode includes a framework for organizing transforms into a hierachy and animating them using curves. The core data structure for supporting this functionality is the AnimatableTransform, which maintains pointers to parent and child transforms. The AnimatableTransform primarily contains a Transform which keeps track of its position relative to its parent. It also stores its transform relative to the world coordinate system for convenience.
AnimatableTransforms are arranged into a hierachy with the AnimatableHierarchy class. The root of the AnimatableHierarchy is positioned relative to the world coordinate system whereas all other joints are positioned relative to its parent in the hierachy. Although the AnimatableHierachy could be used to animate any group of transforms, for character animation it is natural to think of the AnimatbleHierachy as an actor and its corresponding AnimatableTransforms as joints.
To support BVH files, we populate an AnimatableHierarchy using the skeleton information from the file. BVH files are located at /AnimationToolkit/motions. A sample file is here.
We then initialize curves based on the BVH file's motion data and store the result in BVHController. In the case of BVH, where joint limbs do not change length, the bvh controller only manages a single translational curve for the root joint. However, the BVHController does manage rotational curves for both the root and every joint. During playback, the BVHController queries the animation curves and then updates the transformations accordingly.
To summarize, the class hiererachy used for this asignment is the following:
BVHController AnimatableHierarchy (aka Actor) ASplineVec3 for the root joint position ASplineQuaternion for each AnimatableTransform (aka Joint).
Input The startpoint quaternion q0
Input The endpoint quaternion q1
Input The normalized time t (range 0,1)
Output The interpolated quaternion
Output Transform objects representing the inverse of this object. Compute the inverse rotation and inverse displacement and pass the result to a new Transform.
Input 3D position to be transformed by this transform
Output Transformed position
Input 3D vector to be transformed by this transform
Output Transformed vector
InputThe first transform t1 in the operation
InputThe second transform t2
OutputThe resulting transform t1 * t2
updateTransforms()\(\quad R_j^0 = R_{i}^{0} R_j^i\)
foreach child in mChildren child->updateTransforms()Note that because we start at the root, we can be sure the parent's transformation matrix \(R_i^0\) has already been computed!
for each joint in mSkeleton if the joint is the root pos = mRootMotion.getValue(time) set joint's local translation to pos quaternion = mMotion[jointID].getValue(time) set joint's local rotation to quaternion.GetRotation() // set matrix update the transforms in the skeleton
In BVHController (aBVHController.h), you will find splines for the root position and for the joint rotations.
In the basecode, joints are implemented with the class AnimatableTransform and the skeleton is implemented with the class AnimatableHierarchy (in aAnimatables.h).
NOTE: If you're running out of space because of big files, try using the /local drive for temporary storage.
You will be asked to briefly checkin (less than 1 minute) about your homework assignment. This is not intended to much work. Please don't prepare slides or a voice over for your video. None of these are necessary! Some ideas of what you might like to talk about: