New FK/IK switch

Hello,

recently I have seen very nice examples of new seamless FK/IK switch without any “hopping”. This is really advanced feature and definitely blenderheads should have a look.

Nice introduction and example has presented Malefico:

There is also nice application by Matt:

Unfortunately I have huge problems to solve how to apply this in Blender. So if anyone could help, provide “simple three bones arm” set up for research or even refer to some step-by-step tutorial that would be highly appreciated.
(It is quite shame nowadays that sometimes great new advanced features are introduced to Blender but there is nearly no end user documentation.)

I have never had a problem with the IK/FK switch ‘snapping’. What is the problem?

During animation it is possible to seamlessly switch between FK and IK mode as the controls in matter do follow each others. As this is possible in Blender I would like to learn how to make such a rig as seen in these videos :slight_smile:

I have never had a problem with the IK/FK switch ‘snapping’. What is the problem?

I find its more an issue of undesirable rotations, rather than ‘snapping’ when keying the influence of IK.

While I saw the rig video, Matt also pointed out the animators had issues with the space handler script from Maloyo. But I can’t seem to get any problems with Maloyo, even when its linked. What are the problems?

I’d like to know the issues before implementing them in my own rigs.

While I saw the rig video, Matt also pointed out the animators had issues with the space handler script from Maloyo. But I can’t seem to get any problems with Maloyo, even when its linked. What are the problems?

When I was first developing the rigs for BBB I took a look at the Maloyo scripts as a possible way to do IK/FK switching. But honestly, it didn’t take me long to reject them. It’s a cool idea, but in practice it’s painful and unintuitive to tweak after you’ve already set keys with both IK and FK. I think that was the problem Matt was referring to (though please correct me if I got that wrong, Matt).

Mind you, there are also problems with the way I did it for BBB. I haven’t seen a good solution in Blender yet.

don’t know of any built in method, but essentially the rigger will have three versions of the chain…

For illustration purposes:

Bones are Upper arm, forearm and hand.

the first version of the chain is for animating FK, the second version of the chain is invisible and controlled by an Ik goal (and maybe a pole vector too)

The third version of the chain is the one that actually deforms the mesh.

It is constrained between the other two. There will usually be some control in the rig that weights the positioning … eg 0 100, (ik) 50 50 (ik fk blended half from each, 100, 0 (fk).

In blender you may be able to do this with the constraint system, though it’s a while since I looked there, or you may need to use pyconstraints.)

You would either animate the blend from fk to ik over a series of frames or use stepped interpolation to hand off over a single frame

In this sort of system you may also write a “hand off” script that aligns the fk bones to the IK bone chain and turns on IK in one smooth move… (single click moves and keyframes everything for you)

This is just what the point in question is :slight_smile:

But I am really thankful for all hereabove mentioned experiences.

hey guys

Maloyo script was more the presentation of a concept than a real production solution. My plans for it are to combine this kind of access to rig features, with driven constraints now that you can drive constraints with bones in same armature (thanks to Cessen annoying Ton for it).

Also there are lots of tiny details my script doesn’t take account of like what to do with the poles of an IK chain… so, you better use it to study it and improve it, instead of just producing with it.

Regards !

In blender you may be able to do this with the constraint system, though it’s a while since I looked there, or you may need to use pyconstraints.)
I read that bassam used this Maya-style IK/FK switching. ( you can see it linked from his blog ). Apparently it worked well.You don’t even need pyconstraints. Just a driven bone.

www dot watchmike.ca/wp-content/uploads/2008/mayastyle_switch9 dot blend ( replace the dots with . )

But I’m unsure what you mean by a “hand-off” script…

say frame 10 is posed with ik and I want to change to fk at frame 15… I could either manually allign the fk controls at frame 10 and 15 and set keyframes to closely match where the ik bones are, then key the control that blends between ik and fk to blend the ik in to 100% influence over those frames…

or right a “hand-off” script that automates that…
this could all be over a single frame , but the trickis to get the fk controls following the IK ones whilst IK is the “boss” so that it doesn’t interpolate wrongly when you switch,

which is the point of this thread, which I misread as I hadn’t seen the examples…

Thank you, I have just discovered his blogging in matter - http://www.sparkde.com/blog/?p=32#comment-37

Mike has also explained the concept in blog discussion “having 3 separate chains, 1 IK controlled, 1 FK, and one doing the deforming, the deforming one gets weighted to both the IK and FK and the strength of the constraint determines ik/fk.”

I hope Bassam will join this thread to share his experience with this in real production.

Interesting news in matter.

This was just committed http://cia.vc/stats/project/Blender :

Commit by theeth r15735 /branches/harmonic-skeleton/source/blender/src/autoarmature.c: (link)
Propagate control bones repositioning (can deal with chains of control bones)

Retargetting IK/FK switcher setups should work ok now (worked on a setup I did, need to test with more)
Does anyone have any detail information?

Wow interesting developments for that. But if better switching doesn’t get
hard-coded, maya-style still works.

Like I said, you can find a quick test I did at:

www dot watchmike.ca/wp-content/uploads/2008/mayastyle_switch9 dot blend ( replace the dots with . )

Thank you for your blend file, I have also used this Maya solution lately for testing. But the question of this topic how to make it that in IK mode FK controllers follows and vice versa. And this is not what this blend can do.

The solution seems very easy but maybe difficult to code. There could be just implemented the feature (possibility) for constraint influence that when you zero it the influence will be inherited anyway. Some thing like For Transform feature that some constraints have

May be very useful for all constraints. E.g. you have Child of constraint, so the child follows its parent. You would press this “Save Transform” button and if you would zero constraint influence the child would not move to its original state but keep the one transformed due to previously used Child of constraint.

Definitely this would be very useful and seems not hard to code. But I am not a coder.I guess this would also enable the IK/FK switched with the discussed possibility shown in videos hereabove.

Pardon me if I’m wrong, but can’t you achieve exactly the same with using just 1 chain?
When you switch the IK constrain on the arm off it reacts as a FK setup. This also eliminates the need for a defromation chain arm setup.
I’ve seen some people make rigs like that, with those 3 arm sets setups, when just using 1 armset could do the exact same thing. Or does it somehow give glitches during animation? why would you use such a chain when you can just set a slider for the IK effect instead?

I was just explaining the theory… haven’t done it in blender, only did it back in my Lightwave days…

doing it with more chains is safer. In a production recently I found (the hard way) that the behaviour of <1 influence Ik is bad, specifically with the pole vector. a blended copy rot (or copy rot+copy scale if you do stretchy) is much safer.

the maloyo script is nice, but it doesn’t do anything hard to do by hand; you can get “seamless” by simply keying visual rot on your fk chain at the IK on point, using constant IPO for your IK/FK switcher. Of course this is “by hand”, but that’s it. The hard part is somehow tracking that change as you change the animation poses or timing; this requires either moving the keys along with the blend, or rekeying visual rot; something to be done by hand. in practice it’s easier if you did it by hand the first time, to remember to do it again. otherwise, it’s something hidden that comes and bites you in the a$$.

I’m not experienced enough with maya to know, but our maya animator said (in his experience) that the same problem (with seamless blending) exists in maya too; that is, once you have made the switch, it is a pain to keep track of it as you edit the animation.

bassam, could you be more specific concerning your “by hand solution”? To be honest I did not quite get it even though I have tried to play this way in Blender :frowning:
Thank you in advance.

well, what a seamless blend does is key one set of controls to the same location as the other when you do a blend, and do the switch across one frame.
i.e.: none seamless blend: take 10-15 frames to go from IK to FK, so the viewer sees motion as result of constraint animation (and the animator sees the arm move when he/she switches IK/FK)
seamless blend: take 1 frame to go from IK to FK. at (e.g.) the IK side, the FK bones are keyed to their visual rotations, so that the FK chain is responsible for the animation from one position ot another. If an animator is using an automated setup this is done (surprise) automatically: i.e. the animator switches to IK, resulting in moving the IK target to where the chain already is, and keying the visual rot of the FK chain, so there is no visible jump. the animator could of course, do this themselves (more or less) in practice.

my workflow:

animate in FK in frames 1-30 (e.g.)
at IK switch point: (frame 40 for example)
pose and key the armature in IK
then select the FK chain and key->visual rot
you’ll notice after you’ve done this that (at frame 40) the chain doesn’t move if you turn IK on or off- that’s a manual seamless blend!, furthermore, the interpolation between frame 30 and frame 40 is due to the FK bone interpolation, not to the IK influence, so it is a tad more predictable.

you can go the opposite way:
at your FK switch frame (say frame 61) turn the IK off
go to the last IK frame (frame 60), key your IK controllers for safety, select your FK chain and key visual rot
go to frame 70 and make your next pose in FK

yes, I realize it’s a hassle, but at least this way there is no mystery as to what happened during hte blend. if you want to adjust the poses or timing, you should know exactly what keys you need to move, or which bones you need to re-key, without mysteries. If a script does it, but doesn’t somehow automate over tweaks, it becomes slightly nightmarish…

btw, I still think there is a way to do this entirely automated, either in python completely or with some blender enhancement. you basically need a way for the software to keep a record of each constraint switch, store the keys it made to keep the visual appearance consistant, hide the info from the animator and just expose a “blending key” that they can then use to easily change where the blend happens. If you change the pose, the script/blender could automatically change the visual keying of the opposing (IK if you change the FK pose, FK if you change the IK pose) pose without disrupting the blend.

of course, this might result in some new sideffect I haven’t thought of.

This fast fast, thank you very much.

Edit: I understand your concept bassam and I definitely agree that the attitude to have the switch under control by animator is preferred way. I have tried it with new cessen`s rig “Simple biped rig”, http://blenderartists.org/forum/showthread.php?t=131079, but it is tricky to set it up add still I am not able to produce satisfactory result. I have also noticed that this rig has the feature that FK controllers follows the IK ones but it do not work opposite way.

Edit: I have tried the hereabove mentioned attitude of bassam this morning once again and it works really good!!! I guess this is very clever attitude and provides lot of control. In fact animator fully controls FK till the frame when IK should be applied (so uses VisualRot values of FK “driven” by IK) and vice versa. I also guess this may be automated somehow, just to key VisualRot when the swithc is activated. Some kind of “bone driven keying” :slight_smile: Maybe someone fluent in python could come with such python expression drive channel.