Looping an animation smoothly

I have an animated armature with a walk cycle that I need to loop smoothly, but when I play through the frames, the animation “jerks” to a stop for a moment when looping from the last frame back to the first. In other words, there’s a discontinuity in the f-curves between the last frame and the first frame (like with the selected blue curve here):


How do I make Blender make those control points line up automatically for all channels? I’m using Blender 2.58.

Thanks!

First make the handles type vector (makes it easier). Next grab the points and scale y 0. Last your loop should be set to frame n-1.

I don’t know what you mean. I tried a few different things and didn’t get any useful results. Which points should I grab, and what will that accomplish exactly? Is it supposed flatten out the curve at both ends? Because that’s not really what I’m looking for.

In the case of the blue curve, they should be flat. Why? Because these keys are extremes. The value doesn’t go higher or lower either side of them. So for these, set them to auto-clamped handles.

For curves where the loop point doesn’t occur on an extreme (as in, the keys either side are higher and lower) they should be set to vector and then have their handles adjusted from there.

From the looks of your curves, you have set the extrapolation mode to linear. It would be easier to visualise the loop by setting it to cyclic (Shift-E add cyclic). Doing this automatically adds a cyclic modifier to your curves, which can be removed later. Be sure to select all channels before doing this.

BTW, there is no need to set your loop point to n-1 as walshlg suggests, as your animation starts at frame 0.

That’s true, the blue curve should be flat since it peaks at the point where the animation loops, but I don’t want that for all curves. I tried shift+e, but it just gave me two options: constant extrapolation and linear extrapolation.

And are you saying that I need to adjust the handles on the ends of each individual curve to get them to line up? There’s no way I’m going to do that for every bone in every action.

Weird. You should get something like this:

The “Make Cyclic” button adds the modifier to all selected channels. The “Clear Cyclic” removes it.
If you have all channels selected you should only need to do it once.

what version of Blender are you running?

I was using 2.58, but I just updated to 2.63 and now I do get the cyclic extrapolation option. My curves are still wrong though:


Okay, so you understand that the cyclic modifier just cycles the animation, right? It doesn’t automagically adjust all your curves for you.
The cyclic modifier just makes it easier to see where the problems are in your loop. (e.g. the blue curve has sharp peaks at the loop point, making the motion look jerky.)

Now you go through and adjust the handles to make it loop smoothly. To change the handles, select your key(s) and press V: for the extremes make the handles “Auto-clamped”, for breakdowns make them “Vector”, then manually adjust the handles till it looks right.

Rethink this idea. Animation takes time and patience. It’s an art and it takes practice.

Well, now I understand. I didn’t before. But if that’s the case, the cyclic modifier isn’t useful to me.

No. That part isn’t art; it’s a tedious and mechanical process that Blender can do for me, and should do automatically. (You proved it yourself by giving me a simple, mechanical rule for fixing the extremes. There’s no creativity in that.) Blender already does this for every other control point, so why shouldn’t it also do it at the point where the loop starts?

Deciding what sort of curve you want is indeed a creative decision. The sharp curve you have there might not look good for this animation, but will for another (i.e. an impact like in a bouncing ball). This cannot be automated; it is up to the artist.
Adjusting the handles on individual keyframes is what is called “polishing” in animation. If you find it too tedious and too much work, maybe animation isn’t for you.

I find it very hard to believe you. I can’t imagine that animators have to edit a control point for every channel of every bone for every keyframe of every animation.

Anyway, I almost get the result I want if I just copy all the keyframes and paste them before and after the animation. But it would be nice if Blender could do it properly and treat the start and end frames as the same control point.

Having such a point of impact as the start and end point for a cyclic animation is clearly a special case in which one would indeed expect to adjust the handles manually. But in the typical case of smooth motion, Blender could and should align the end handles automatically.

The reason it does not is that cyclic extrapolation is not actually implemented as an extrapolation mode, but as a curve modifier, so that the alignment of automatic bezier handles is already decided before the cyclic extension takes place. To get the result the OP understandably desires would require the extension to happen before the alignment of the handles.

Best wishes,
Matthew

Most animators tweak everything. Assuming that they let the computer do the work for them is wrong. I tweak just about every curve on everything when all is said and done. I sometimes have keyframes on just about every frame as well. But doing the work in the graph editor is much easier in some cases. Freen is giving you good advice, I suggest taking it or trying to find another way, not insulting him.

Perhaps you should show us the actual animation and we will be able to give you much better advice.

Don’t get so defensive. I didn’t insult anyone. I’m not saying all the curve tweaking could be automated. I just want Blender to give me a starting point by interpolating correctly from the last to the first loop keyframe (like it already does between every other keyframe!). MCollett gets it, at least.

I’m just gonna call this solved, since it seems everyone is telling me Blender doesn’t support this, and I’ve found a workaround by duplicating keyframes.

You’re right. Not every animation. Only the good ones.

1 Like

How come no one is talking about making Action sequence and repeat it in NLA editor? It has blending mode between action right? Tweaking curve is the last thing one should be doing. No?

I share your frustration. Not that I expect a free program to have everything, but 3dsmax has always had this option. It’s called keyframe out of range types. You can set it to Loop and it will interpolate the curve based on the first / last keyframe on a per channel basis. Unfortunately Blender doesn’t seem to have an equivalent.

Instead I am doing the same thing as you, adding duplicate keyframes outside of my animation range to force the curves to be calculated as if it was set to out-of-range-type: Loop. Unfortunately this method (in addition to being tedious) extends the animation in my Actions so that when imported into Unity it plays all my fake keyframes (there is no way to select a range of keyframes when using Actions).

So I am resorting to putting all my animation on a single timeline and using Unity’s split animation feature to assign ranges of keyframes to my various animations (Idle, Walk, etc).

Its gonna be fine:P I get the animation to run smooth by just chance and I don’t like this, I don’t actually talk like this, I don’t know maybe its these colours…

Just popping in to say that @freen is totally in the wrong here and Blender should be able to do this for you automatically, as 3DS Max can – but I still haven’t found a decent workflow to do it here other than this post, so thanks for that.

Here’s the setup. All you need to loop tween/bezier interpolated animations perfectly is to duplicate your 2nd to last keyframe and put it before your first keyframe, then duplicate your 2nd keyframe and put it after your last keyframe. No “art” to it, just an annoying extra couple steps you’re forced to do.

Would love to hear about an alternative to this because it’s a pretty annoying addition to my iteration time atm.

edit: just found an add-on that automates this process https://github.com/aravergar/aravergar-blender-addons

1 Like

Thank you so much for linking to the addon, it’s exactly what I required.
Why isn’t this a built in function?