Seamless Mocap Cycles Tutorial

September 11th, 2013 — 28 Comments
Share

This tutorial was originally featured in issue 58 of 3D Artist Magazine and is kindly republished with their permission. The brief was for a 17-step tutorial to accompany an interview I gave, but the technique really only takes a few minutes once you get the hang of it, allowing you to quickly pump out mocap cycles as a starting base to work with. Importantly, these are just the first few minutes of a LOT of work required to make them final – that’s where the magic comes in.

BRoxu4vCAAAr60n

To achieve Assassin’s Creed’s style of animation we require a vast amount of animation cycles and transitions, bringing the Assassin to life for even the simplest ground movement before we layer on cutting-edge technology such as reactive physics and IK. This tutorial will take you through the steps required to easily make a flawlessly-cycling run cycle from motion capture using a relatively quick and simple looping technique that can be used on any kind of motion where seamless cycling is required. For this example we’re using Autodesk Motionbuilder but the same technique can be applied in any software that has the ability to blend sections of animation with each other.

Download the .zip file of the motionbuilder FBX scene here – it works with Motionbuilder 2010 and later. (Sorry, your version doesn’t contain the Assassin model). If you don’t have Motionbulider you can download a free 30-day trial here. Additionally, check out 3D Artist on their facebook and twitter,

1.0 – Directing Your Motion Capture

Good mocap starts with good acting – get the most out of your actors.

1.1 – Inspire your actors’ imaginations

Because the run cycle is perhaps the single most important animation in your game, ideally you should have several to choose from, covering a variety in attitude and speed/intensity. An essential tip here is not to ask an actor to simply run fast, but instead give him or her visual direction in the form of “you are chasing after a stolen purse” or “you are escaping a burning building” etc. Employing visual references is more likely to provide a range of performances rather than simply adjusting the speed.

Mocap_Run_small

Try tying weights to legs and modify the terrain for wildly varied motion styles.

Often, an animator’s first approach when directing actors is to first show the action themselves, but this is severely limiting. We pay actors a lot of money to bring their talents to our session, so why not use them! Performances are much better when an actor is more involved and feels they own it, so the direction you give them should be wide enough to allow them to come up with their own interpretation of what you originally wanted, and nine times out of ten this will be much better than what you originally envisioned.

1.2 – Be kind to “The Talent”

Don’t leave high-energy actions like running to the end of the day’s mocap recording, especially if your actor is more thespian than stuntman or is not in the peak of physical condition. This will avoid fatigue creeping into your recordings, plus starting with a quick burst of action is a fun and energising way to start off a session! Importantly, never criticize a performance. Actor’s are emotional beasts, and require encouragement and inspiration to bring something amazing to their performances. The same can be said for animators in general.

Acting and stunt work requires a phenomenal amount of energy.

Acting and stunt work requires a phenomenal amount of energy.

1.3 – Use all of the volume

Unlike stationary actions, running requires that you maximize the use of the mocap volume, (the space the cameras can record), as even large studios typically have enough room for only 8-10 footsteps. Ensure your actors run diagonally across the volume for maximum recording distance, having them run out of the space before decelerating if possible. This minimises wastage of mocap data when on a budget and gives you as wide a range of footsteps to choose form as possible.

It’s easy to re-position and realign performances, as we shall see later.

It’s easy to re-position and realign performances, as we shall see later.

2.0 – Setting up your scene

Before editing, it’s important to ensure you have a cleanly set-up scene.

2.1 – Convert to Control Rig

Once your mocap is delivered the real fun begins! Before we can edit anything in Motionbuilder, we must move the motion from the skeleton to the control rig. Do this by selecting Bake(plot) -> Bake(plot) to Rig from the large blue character button. (You may also want to uncheck Constant Key Reducer in the options box to retain maximum fidelity). Press Ctrl+A to display the control rig in the viewport if it isn’t visible already.

Get into the habit of plotting between the rig and skeleton often as an easy before/after comparison between changes.

Get into the habit of plotting between the rig and skeleton often as an easy before/after comparison between changes.

2.2 – Enable the Story Mode

In order to broadly manipulate the motion we’ll use Motionbuilder’s Story mode. Open the Story tab in the Navigator and turn Story Mode on if it isn’t already. Right-click the space to the left of the timeline and choose Insert -> Character Animation Track. In the Character drop-down, choose your character. Right-click in the empty timeline next to your newly created character track, and select Insert Current Take.

While mostly used for editing cinematic cutscenes, the Story Mode is a powerful blending tool.

While mostly used for editing cinematic cutscenes, the Story Mode is a powerful blending tool.

2.3 – Selecting a segment

From the variety of examples, you’re looking for one that best suits the personality of your character, keeping the rest as backup for other characters or changes in attitude. You’ll want to select a range of at least 3 steps, (you’ll see why later), that have a constant momentum. Ignore the acceleration and deceleration likely captured at the extents, and avoid any noticeable actions that would stand out in a repetitive loop. For our example, we’ll drag the edges of the clip to frames 305-329.

Start and end cycles on a passing pose, (one leg up), to make similar poses most recognisable.

Start and end cycles on a passing pose, (one leg up), to make similar poses most recognisable.

2.4 – Easily scrub your animation

Moving the clip back to zero, make scrubbing through keys more readable by always zooming to extents in the timeline. You can do this by manually typing in the start/end times in the S: and E: Boxes at either side of the timeline, and in the story by simply clicking on your clip and hitting the F key. Note that the Story timeline differs from the viewer’s – the one in which you’re editing and one that you’ll see when you press Play respectively. You can quickly jump back and forward one frame at a time with Ctrl+left/right arrow keys.

Keys are much more readable when the timeline is zoomed to extents.

Keys are much more readable when the timeline is zoomed to extents.

2.5 – Clean up your scene

With the clip at zero, notice that the numbers above and below the clip are out of sync. The top are scene-based and the bottom are internal to the clip, which can cause issues on earlier versions of Motionbuilder when copying/pasting clips. Plot to the Rig by right-clicking the clip and selecting Plot Whole Scene To Current Take. Right-click and delete your original story clip and plot back from the Rig to the story once more. This resets the clips’s local timeline, and is a good habit to get into to better know the real length of clips when you move them around.

Global In/Out is the clip’s position in the scene, whereas Local In/Out is local to the clip.

Global In/Out is the clip’s position in the scene, whereas Local In/Out is local to the clip.

Align_To_Axis

The top view via Ctrl+T is the best angle to rotate to the axis. Ctrl+E to return to perspective.

2.6 – Align to an axis

Now that you have isolated what you want, and because we captured the motion at an angle, we must align to an axis to make the looping workable. Enable editing of position and rotation by clicking on the Show/Hide Ghost (eye) button in your character track. With the clip highlighted, you should now see a green line that represents your character’s traveling motion. On the first frame of your range, select the Translation tool and enter “0.00” into the X,Y & Z fields. Now select the rotation tool, and manually rotate the orientation to have the green line best match the Z axis.

2.7 – Finding your join

This is the key element of what we are discussing today, making the join seamless and unnoticeable. Importantly, identify two complete footstep actions, (NOT single key poses), that are most similar. In our example we chose only three steps, so notice the first and third steps are the two similar actions. We will use the latter two as the basis for our cycle, therefore frame 8 will then be our starting pose.

We identify the second passing pose as our best join frame.

We identify the second passing pose as our best join frame.

3.0 – Blending motion back onto itself

The crux of this tutorial, choosing to match motions rather than poses.

3.1 – Now the trick

We are going to blend back across one full step to ensure the looping motion is seamless, with the momentum of every bodypart retaining constant velocity throughout and avoiding the noticeable hitch that would occur if we simply pose-matched the first and last frames. What we’re essentially doing here is, over the duration of the final footstep, blending back into the keys BEFORE the starting footstep, so we end our cycle at exactly the same pose as the start with all the same momentum as the first frame.

In our three steps, there are two simila Left-to-Right actions we can blend across.

In our three steps, there are two similar Left-to-Right actions we can blend across.

3.2 – Blending back onto itself

With passing-pose 2, (frame 8), as our desired start frame, shrink the clip start to reflect this. Now right-click the clip and select Copy, move the timeline slider to exactly after the clip, and right-click the track and select Paste. We now have two identical clips immediately following one another. Ignoring forward movement for a second, jump into the front view via Ctrl+F. Select the second clip and drag its start half way back across the original. The X shape in the Story shows the original clip blending back across the keys prior to its first frame.

The second step is now cross-blending back to the keys before the first step.

The second step is now cross-blending back to the keys before the first step.

View in the front view only at this stage to see the seamless looping.

View in the front view only at this stage to see the seamless looping.

3.3 – Adjust the blend duration

Now set the timeline to be the length of the first clip only, (8-24). Ensure looping is enabled via the Loop button to the right of Play, and hit Play. We now have a seamless loop! Play around with how long you blend back across the cycle to itself. Longer durations provide most seamless results but will increase foot-sliding, whereas shorter are most stable but will increase the noticeability of the join.

4.0 – Closing The Loop

All that remains is to clean up the action to make it game-ready.

4.1 – Match the forward position

Moving back to perspective view, we still have the issue of the clip returning to its starting forward position. Rectify this by selecting the Translation tool once more, enter the side view via Ctrl+R and repositioning the second clip forward or backward until you reduce foot sliding. Foot-sliding is bound to occur during the blend anyway. (Motionbuilder has an auto-match button in the story mode, but because we only want to match the forward position and not the up/down and left/right we avoid it here).

Use the handy ghost skeletons to line up your clips with minimal guesswork.

Use the handy ghost skeletons to line up your clips with minimal guesswork.

Never, EVER remove the forward, (Z-Axis), movement keys from your character’s root/pelvis bone to see your character cycling on the spot unless you want them to plane forward in an unnatural manner when you key them forward again. We don’t move linearly in real life, and instead push a little with each step in a rhythmic fashion. To see a stationary cycle, add a second layer and key the character backwards linearly, removing the layer again later if required for exporting into your game engine.

4.2 – Quick foot cleanup

Plot from story to rig and back, (meanwhile deleting the old clips), to have one clean clip which you should reposition back at the origin. Plot the story edit onto the Rig one last time and turn off Story Mode as we’re finished with it now. You’ll likely have some lateral foot-sliding remaining that occurs across the blend. Eliminate this by modifying the offending keys, ensuring you don’t change the initial or final pose. In the front view, select the left foot controller and open the FCurves window in the Navigator. Select the Translation X curve and modify the foot inwards before it lands.

Minor foot-sliding clean-up is easy with Motionbuilder’s FCurves.

Minor foot-sliding clean-up is easy with Motionbuilder’s FCurves.

4.3 – Improving the Silhouette

From this point it’s important to retain the cycling motion while editing. In Assassin’s Creed, everything we avoided in this tutorial such as asymmetry and acceleration/deceleration are recreated in the game engine to give personality. How much work you have remaining depends on how close your original mocap was to the desired result, but now we have a flawless cycle an animator is free to begin the real creative work of adding appeal and personality!

While game animations need to look good from 360 degrees, runs are seen mostly from the rear.

While game animations need to look good from 360 degrees, runs are seen mostly from the rear.

Motionbuilder’s layers are where the bulk of an animators work is done to bring appeal to mocap.

Motionbuilder’s layers are where the bulk of an animators work is done to bring appeal to mocap.

4.4 – Final Adjustments

Let’s quickly raise the shoulders for a more heroic posture. Turn on AnimLayer1 and the AutoKey (key) buttons, as well is selecting Full Body in the Body Parts dropdown, all under the Key Controls tab. Next set Reach R to 100% for the Head and Shoulder controllers under the Character Controls in the upper right of the screen – this allows us to blanket key across the entire animation unhindered. Finish off by pulling the shoulders up and back and tilting the head down slightly on your cycle’s first frame for that classic Assassin’s Creed look. Now we’re ready for a first pass in the game engine – many more remain…

Working in this manner to quickly create cycles allows us to see them where it counts – in the game engine. An animation is never done until it’s fully playing and blending in realtime with all the other cycles and transitions – only then can we tell whether the action is good enough and fits the character’s personality. Game animators often have many animations being worked on at once, and make adjustments before exporting, reviewing while playing, then rinse and repeat in this manner until the game not only looks good but feels good with the controller in our hands.

This technique can be used for any cycling action you wish as long as you blend across two similarly large motions rather than two subtle ones – this better masks the blend and reduces the foot-sliding and other cleanup work that follows. Assassin’s Creed requires many, many cycles to blend between in realtime – sometimes only for a few frames at a time, and with this handy technique your project too can have many cycles quickly. How creatively you use them is up to you!

One (of many) I made earlier. Connor’s iconic sprint-impulsion is seen every time he accelerates.

One (of many) I made earlier. Connor’s iconic sprint-impulsion is seen every time he accelerates.

Share