Animation interpolation causes jitter between frames

I’m animating a character in Maya that has its head pop off and then returns to its body during the animation. I’m doing this in Maya by space switching from the neck (follows body) to the world (popped off and not following body). It looks fine in Maya, but when I import it into UE4 the head jitters a ton. The GIF below doesn’t do it justice, it looks much worse when in UE4.

I understand that animation isn’t technically based on frames and actually utilizes the delta time, so is there a way to fix this? I should mention that my animation curves are smooth, so no matter the frame rate, the animation looks correct in Maya.

121475-animation_interpolation_jitter.gif

1 Like

I think I’m having exactly the same issue. All of my animations are deviating from where they should be between frames. It’s extremely subtle and very hard to spot but it’s there.

#THE WHY

I found a work around to this, it is a MAYA (3d package) joint problem not a UE4 or game engine problem.

If you go to settings in maya and change from ntsc to miliseconds you will also be able to see the jittering in maya as it begins to interpolate between the keys.

There is a single (or multiple - lord help you) offending joint that was not oriented/frozen during the rigging process among countless other possible problems that cause this.

#HOW TO FIX

There are two ways

1 THE PROPER FIX

Fix the offending joint in the rig source file, be it orientation, rotation order, or unfrozen rotations on the joint etc

2 THE LAZY FIX

  • Select the initial joints connected to the offending joint
  • Parent constraint and bake locators to those peripheral joints in 24/30fps
  • By doing so, the locators will not inherit the jitters as they’re interpolating in world space, not counter animating themselves from the offending joint, neither receiving the interpolation because the frame rate is too small to catch it
  • Delete the constraints on the locators and parent constraint those joints to the locators
  • Bake the constrained joints in MILLISECONDS not in fps, this guarantees it will be counter animated to world space leaving the offending joint to have a tantrum all on its own

The lazy fix makes the animation very heavy, baking to miliseconds balloons animation data considerably

EDIT:

So because baking on milliseconds is kind of daft, I found if you bake a locator to the offending joint as well, then constrain that joint and zero out the locators rotations to force the joint to bake out as if it had zero rotations, then you can happily bake in fps instead of milliseconds

I had a very similar problem when switching between socket bones for a character drawing their weapon. When creating the animation in Blender, I had used a “Copy Transforms” constraint so the hand socket bone would temporarily follow the position of the holster socket bone, and then resume its normal animation. While everything appeared to work fine at normal speed, when played back in slow motion in UE4, the socket bone would jitter crazily. I’m not 100% sure if this phenomenon was just due to the “Copy Transforms” constraint counter-animating the hand socket bone (which itself is a child of the hand bone), or if it was because some dreaded Gimbal Lock was happening (or both!).

Nevertheless, the problem is solved-- and I praise Jesus Christ for showing me a great solution which works perfect even in slow motion! :smiley:

Description of fix using Blender (for an over-the-shoulder draw weapon animation):

Firstly, you can preview your animation in slow motion by increasing the “Playback Scale” of your NLA strip in Blender. This is super helpful to detect any sub-frame wobbles.

For this fix, I didn’t even need to use Quaternion rotations, I was able to stick with Euler. However, the gist of the fix was to keep the hand and holster socket bones in their respective locations as long as possible rather than counter-animating one to match the other’s position with a Copy Transforms constraint.

  1. I kept the weapon attached to the Holster socket bone, and just before the moment of attachment to the hand, I animated the Holster’s socket bone for a couple frames to respond to the hand’s impact.

  2. I then immediately switched to the Hand’s socket bone, temporarily enabled a “Copy Transforms” constraint to snap the Hand socket bone to the position of the Holster socket bone, and set a “Visual Location / Rotation” keyframe, then disabled the constraint. Now the Hand socket bone is keyframed at the last known position of the Holster socket bone. This frame also becomes the same frame to set a Montage Notify for calling your “Attach” logic in Unreal. :smiley:

  3. Next, since this particular weapon needed to rotate 90 degrees and slide into position in the hand, after letting the weapon follow the Hand socket’s motion for a few frames, I reset the location and rotation of the Hand socket bone back to zero and set a Location & Rotation keyframe.

  4. However, this is where some bizarre rotations occurred. But thanks to an extremely helpful 2-part video series from Wayne Dixon, I knew about the “Discontinuity (Euler) Filter” in Blender. After running that on my keyframes, they were automatically corrected to avoid this problem (so instead of 0,0,0 for XYZ it changed the values to -180, 180, -180). Now everything works perfectly smooth in Unreal Engine, even with quarter-speed slow motion! Console Command: Slomo 0.25 :smile:

I will link the videos about Gimbal lock and various ways to fix below. Even if the jitter was not specifically caused by Gimbal lock and instead by counter-animation, the knowledge alone is incredibly useful to have: