Parallel Deformers

In the last post, we talked about how to add deformers on top of the rig, with influences that ride with the rig, by connecting an inverse matrix to the bindPreMatrix attribute(s) of the deformer.

However, if you use this technique to add multiple deformers on top of the rig, they evaluate in sequence. Each deformer gets the result of the previous deformer as its input. If your deformers have overlapping influence, and a volume based falloff, this can cause problems. Imagine if you had a couple soft mod deformers that affect the same area, but aren’t meant to have priority over one another. Pulling one deformer might move the geometry out of range of the others, making them less effective.

Can we make the deformers behave as if they were evaluating simultaneously?

Yes!

Are they actually evaluating simultaneously?

No! But this post isn’t about rig performance.

Do to this, you need to do a little bit of setup. The end result is a blendshape node whose targets have been replaced with the output of the soft mod deformers. To set this up, create your primary deformer (usually a skinCluster), and then your soft mod deformers on top of it. After you add your secondary layer of deformers, you’ll need to create a blendshape node, with a dummy target for each of the soft mod deformers.

Next, open up the node editor. Make sure auxiliary nodes are visibile (Show > Show Auxiliary Nodes). You’ll see each deformer has two extra nodes associated with it – a groupId, and a groupParts. A groupParts node keeps track of the components being passed to a deformer – remember that it is possible to exclude geometry components from being affected by a deformer for performance. A groupId node merely helps Maya track the object groups. The important thing is a groupParts node is always upstream of the inputGeometry attribute of a deformer.

In simple terms, a blendshape node calculates the delta between the input geometry and the targets, multiplied by the weight of the target, and adds it to the to the output geometry. Thus, if the input geometry and a target are identical, the output geometry remains essentially unchanged. This is the crux of how to make layered deformers act as though they are parallel without having to create a separate mesh for each deformer.

First, connect the outputGeometry of each deformer you want to be parallel to the inputGeomTarget plugs on the blendshape node. You’ll have to dig deep to find that attribute. For example, blendShape1.inputTarget[0].inputTargetGroup[0].inputTargetItem[6000].inputGeomTarget.

Yikes.

Second, connect the outputGeometry of the skinCluster to the inputGeometry of the groupParts node associated with the blendshape nodeand each of the deformers you want to be parallel. When you are finished, your graph should flow from the skinCluster, fan out to the deformers, and come back to the blendShape node, like so

parallel_post_deformers

And that’s it. If you set up everything correctly, you now have a auxiliary deformers riding with your rig that do not interfere with one another, nor cause double transforms.

You can see an example of this on here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s