CS91 Computer Animation: Lab 7

In which, we blend between motions for the purposes of necessity and amusement

In this assignment, you will implement crossfading between two motions.

Step 1: Get the source


Sadly, due to last week's snafu with github and the fact that not everyone has yet checked in their basecode from last week, I must distribute the assignment as a tar file again this week. The tar file is here. The file must be downloaded into the root of your repository and then extracted like so
> tar xvzf blendAssignment.tar.gz
To make things easier next week, let's check in the basecode (as well as our current assignment progress) first thing this lab!

Step 2: Compile and run


Same as before, you should compile all source in a build subdirectory. The compiled applications will be in /bin as with the rotation assignment. Additionally, the asisgnment includes 'solution' versions of the assignment libraries which you can use to build a 'solution' version of the demo.
> cd build
> make
> ../bin/BlendViewer
> ../bin/BlendViewer-Soln

User interface overview


The basecode includes a simple interface and 3D viewer for loading and playing blended 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:

Blend controls

The panel at the bottom left can be used to perform blends between motion 1 and motion 2.

The top section displays the name and number of keys in motion 1. Click the 'Load Motion 1' button to change this file. The next section has the same functionality for motion 2. During debugging, you may wish to hard-code a pair of motions to load on startup. You can do this by modifying BlendMain.cpp in /aMotionBlend.

The last section of the panel contains parameters for controlling the crossfade blend.

Assignment: Crossfading Due April 7

For this assignment, you will implement a crossfade between two motions. The cross fade should begin on motion1 ending on startKeyId and blend to motion2 starting at endKeyId. In other words, your blend regions should be [startKeyId, startKeyId+numBlendFrames] on motion1 and [endKeyId, endKeyId+numBlendFrames] on motion2.
  1. (10 points) Implement MotionBlender::append. Append should add keys from the given input motion to the output motion. Keys can be added by appending poses or by working with motion curves directly.
  2. (25 points) Finish the implementation of MotionBlender::blend() in libsrc/animation/aMotionBlender.cpp. The blend function should combine motion 1 and motion 2 together with a smooth cross frade to transition between them and put the result into the member variable mBlend.
  3. (20 points) Implement MotionBlender::align. The current motion curves contain global position changes for the root. By default, the blend will snap to the starting position of the next motion unless the target motion is transformed to align with the end position and rotation of the first motion.
    • (10 points) Align root positions.
    • (10 points) Align root heading.
  4. (25 points) Implement MotionBlender::crossfade. Compute the transition frames from motion 1 to motion 2. The blend weight should change linearly across the blend duration such that the weight is 0.5 halfway through the fade.

Implementation advice: Create the functionality in this assignment in stages, so you can debug new functionality one step at a time. I recommend building up your assignment as follows

  1. To start, simply concatenate the two motions together. You should see the motion1 snap to motion2. Implement append() and call append from blend() to test it.
  2. Next, match the position of motion2 to motion1. Implement this functionality in align() and extend blend() to call it. Now, your second motion should start playing at the same location where motion1 completes.
  3. Next, extend align() to match the heading.
  4. Finally, implement crossfade between motion1 and motion2

Extra challenge

Creating a unique character

For those of you who would like to create a unique character, here is a modified aCharacterDrawer code to give a simple example of how this can be done.

Submission Guidelines (5 points)

Submitting your assignment

Students should submit their code along with a README and videos. The README can be very brief, consisting of Videos should show results, including any extra challenges. Videos will be collected together and shown during class presentations. Please submit a mp4 of length no more than 60 seconds. For example

About checkins

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: