Soft IK in XSI

August 14th, 2006 by Andy Nicholas - Viewed 69922 times -




When an IK chain extends towards its full length, it will tend to snap into it’s final position. To prevent this from happening, it is possible to give the appearance that the IK chain is stiffening as it extends towards it’s full length. This technique isn’t new and similar functionality is already implemented in Cinema 4D.

In XSI, we need a way of allowing the chain to gradually fall behind the position of the effector. This stops the effector from snapping the chain into the final position, and gives rise to a much more natural motion (as seen below).

Soft IK Comparison
(Note: If you are unable to view the GIF animation, you may need to change settings in your Firewall. For example, in Zone Alarm, you need to disable Privacy->Ad Blocking)

The snap effect visible in the top chain isn’t due to some inaccuracy in the IK calculation, but is just down to a simple geometrical effect. It can be shown mathematically (see diagram below) that as the effector pulls the chain into the final position, the velocity of the bones towards their final position tends towards infinity! This is obviously not desirable and can make the animation look jerky and artificial.

Why snapping happens

(click to enlarge)

To achieve the type of motion shown in the lower chain, we need to add an extra object which is used to drive the IK chain effector. A scripted operator links the two objects and we use a mathematical expression to give the desired result. The only bits of information the operator needs are the total chain length, and something I call the “Soft Distance”. This represents the distance from the chain’s full extension that the effect starts to work.

There is one downside with this approach, as it means you can’t fix the end point of the chain in position. However, this can be solved as long as you are willing to put a small amount of extra work to animate the Soft Distance parameter.

The soft effector object has a custom property to allow you to easily control the operator.

Soft Effector PPG

To make things easier for you, the Chain Length is calculated by an expression which sums the length of each bone in the chain. This allows you to change the length of a bone, and still have the Soft IK work.

In the diagram below, the Soft Distance is represented by the distance between the green and the red lines (actually, they’re circles, but too large to see). As soon as the effector reaches the green line, our scripted operator starts to lag the chain effector behind our soft effector. This is done while making sure that we have no jerkiness in the motion of the chain effector.

Soft IK Closeup
(Note: If you are unable to view the GIF animation, you may need to change settings in your Firewall. For example, in Zone Alarm, you need to disable Privacy->Ad Blocking)

The equation used to create this effect is shown below:


Soft Effector Equation

(click to enlarge)

For a chain length of 3 and a soft distance of 1, this equation looks something like this:

Distance Graph
(click to enlarge)

You can use the following link to download the Soft Effector plugin:

Soft Effector Download (3 Kb)

(Note that this also features the Stretchy Bone Chain extension shown in Part 2 of this article)

To install the plugin, just download the zip file, unzip the script, and copy it to a “Plugins” folder. So for example, you can use your “C:\users\username\Softimage\XSI\Application\Plugins” folder, or one in your workgroup.

To use the Soft Effector, create a 2D or 3D Skeleton Chain, select any part of the chain, and go to “Model->Create->Skeleton->Apply Soft Effector”.

17 Responses to “Soft IK in XSI”

  1. The Ki says:

    It”s not more simple to play with the blend slider of the position constraint from the cube to the effector. I mean, just applying an expression that decrease the constraint strength when the distance between chain root and effector is close to the sum of the length of the two bones of the IK chain ? It”s just a question, nice work anyway.

    Cheers,

    The Ki

  2. I just tried playing with that, and I don”t think it helps. Try creating a 2 bone chain and add a null with the effector pose constrained to it. Now set the blend weight to something small like 0.1 and animate the null moving away from the chain at a constant speed. You”ll still get the “snap” effect, and even worse, the chain won”t always be pointing at the null because of the iterative way that XSI solves the blended constraint . I don”t think adding an expression to the blend weight will make much difference.

    I wouldn”t take my word for it though, give it a go and let me know if you have more success than I did!

  3. Carlos Valcarcel says:

    Nice trick, it works very well. Thanks for sharing !

  4. Derek Jenson says:

    Very nice. Even a small SoftDistance value really makes a huge visual difference. An animator would have to really tune their animation to the micro unit get the same padded feel. Good stuff.

  5. Cool technique! Another trick that I use is to never build the bones in a straight line. (i.e. when the leg geometry is straight the knee joint is at a 5 degree angle.) It softens that snapping motion a lot but you can still lock it into position without drift. Then you just have to set a rotation limit to keep the knee or whatever from “breaking” the other way.

  6. I”ve just posted a second part to this article to show how to get it to work with stretchy bones.
    Thanks as always for the feedback. :)

  7. This is fantastic! Thank you very much Andy -just what I needed right at this moment when I started looking deeper into animation in XSI :-) Perfect timing… :twothumbsup:

  8. Nazca.Pig says:

    Hi,I think it”s a useble tool thank u good job!I”ll Download this^_^

  9. nyk says:

    ohh it”s cool~ thanks~

  10. Francesco Botticchio says:

    Hi Andy, just started playing around with your plugin and all i can say is your a life saver. will be using this in all my university projects from now on. great for squash and stretch.

    Thanks again

    f.botticchio

  11. Hey,
    I love what you’e doing!
    Don’t ever change and best of luck.

    Raymon W.

  12. MR says:

    Someone on a Maya listserve pointed out your article, which looks very useful.
    However, the bottom leg of the right triangle is X/2 so shouldn’t h = SQRT(l^2-(x^2/4))?

  13. Yep MR, you’re right. I never got round to changing it :-)

  14. Sirdavid23 says:

    Hi,I downloaded the script, followed your instructions, but I don´t see it appearing in my Xsi 7. Must I do an extra step, configure something -somewhere-? I even dragged and dropped the .js as a button but it doesn´t run on my bone chain.

    Could you point me in the right direction, please?

  15. Hakan says:

    Hi ı am using a quadruped that created from a quadruped guide. I want to use this soft ik plugin on that rig but it doesnt effect my rig. Is there a way to apply this soft effect to the already built up rigs?

  16. molemansd7 says:

    I was feeling my way through this and was wondering how you came across the equation for this behavior. Is this something you created from scratch, or is it a standard thing I’m unaware of?

  17. [...] because the speed of that joint non-linearly increases as we are close to straight. Good sources here and here (softimage blog). My solution for non stretchy is exactly the same as that blog post- [...]