Home » 3D, Download, Featured, XSI

Soft Effector

30 May 2009 20,424 views 6 Comments

Extending Soft IK to stretchy bone chains

When I wrote the first article for XSIBlog, I hadn’t planned on writing this part, but a couple of people on XSIBase asked me to look into how I could extend the Soft IK system to work with a stretchy bone chain.

Initially, figuring out how this could work seems like a pretty tricky problem. The bone chain needs to stretch intuitively to give the impression that it’s stuck to the IK effector. But we also need it to flatten gradually to avoid the snap effect. Unfortunately, the only thing we have available to us to control these two effects, is the ability to change the length of the bones, since the end position of the chain must always be located at the effector.

So we need to scale the bones to allow them to stretch, but at a specific rate to make sure we avoid the snap. Like this:

Stretchy Soft IK

The first thing to do is to look at how we solved the problem for the non-stretchy bone chain. When we look at what happens when we move the Soft Effector past the point where it starts to leave the original IK effector behind, all we want to do for the stretchy bone chain system is make sure that the bone chain gets longer so that the original IK effector is at the same position as the Soft Effector. But we need to do this while also keeping the bones angles the same, this avoids the snap effect since the bone angles would change at exactly the same rate as in the non-stretchy bone chain system.

A diagram should make things a bit clearer. Basically, given a non-stretchy chain, we want to match the position of the two effectors by scaling the chain length, but without changing the bone angles, like this:

Scaling the Soft IK chain

Okay, so that doesn’t seem too hard. We just need to figure out how much to move the IK Effector to match the position of the soft effector.

The only way we can do this is by changing the length of the bone chain. Again, this initially looks like quite a tricky problem, until you realise that scaling the length of each bone by some value X, also scales the distance of the original IK effector from the IK root by a factor of X as well. A simple test proves it (and it can be easily shown with a little maths too):

Scaling bone lengths

This diagram shows a bone chain with bones of different lengths, before and after I scaled each individual bone length by a factor of 2. It can be seen that the IK effector has travelled directly away from the IK root and has doubled it’s distance from it. Not only that, but the bone angles have remained unchanged. This is exactly what we need!

Now, all we need to do is to figure out the amount we need to scale each bone length to make the original IK effector match the position of the soft effector. That scale factor is just the ratio of the distances of the two effectors:

Scale Factor = EvalDistance(IK root, Soft Effector) / EvalDistance(IK root, original IK effector)

Where EvalDistance() is just a function that measure the distance between the two objects.

Finally, we need to position constrain the original IK effector to the soft effector, so that it follows it. Otherwise, all that would happen is that the length of the chain would change.

So that’s it, we’re there. All that remains is to package it all up into a plugin with a handy custom property to drive it all. This is what the new property page looks like:

Stretchy Soft IK PPG

The bone lengths can be adjusted (and even animated) from this PPG, as well as the Soft Distance parameter, which behaves in exactly the same way as in the non-stretchy Soft IK. The bone lengths are all driven from this PPG using expressions. Note, that for extra performance we only have one Scripted Operator here which operates on the BoneScale parameter of the PPG.

I’ve updated the original Soft Effector script to include a new menu item to apply the Stretchy Bone Soft IK system to any chain you select.

Incidentally, if you ever want to remove the Soft IK (stretchy or otherwise) from a bone chain. All you have to do is delete the Soft Effector object. All the expressions and operators will be automatically deleted since they will have lost their connections. Nice and tidy!

P.S. Thanks to Daniele Niero for suggesting I cache the math objects inside the operator user data!

Installation

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.
Download... Windows V1.0 (3Kb)

Usage

To use the Soft Effector, follow the install instructions and create a 2D or 3D Skeleton Chain. Select any part of the chain, and go to “Model->Create->Skeleton->Apply Soft Effector” for standard Soft IK or select “Model->Create->Skeleton->Apply Stretchy Soft Effector” for Soft IK with a stretchy bone chain.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

6 Comments »

  • Michel M said:

    rly great share, ty 🙂

  • Nassos Y said:

    Hi, I made a modified version of the script and uploaded at the Autodesk AREA (link http://area.autodesk.com/downloads/scripts/softeffector_that_respects_existing_constraints )
    I added the ability to check for any positional constraints on the effector
    and move them to the newly created SoftEff Null,
    so that it integrates nicely with existing Rigs (ex. XSI Biped)
    Hope you don’t mind.
    cheers

  • Chris D said:

    Hi Andy, thanks again for sharing this, I need to create this effect for some rigs I’m building just now. I saw it a few years ago but I couldn’t remember where! Your explanation really helped me – nice one

  • AndyN (author) said:

    Hi Chris, cool, glad you’ve found it useful 🙂
    Cheers!
    Andy

  • Naoki_Ohta said:

    Hi Andy.
    Soft IK was awesome in XSI era and helped us a lot.
    I came back to your blog post from 2019, to create same function in maya.
    Thank you so much for sharing this. Your Soft IK is still staying gold and necessary.

  • AndyN (author) said:

    Hi Naoki, thanks for your kind words!

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.