Rigging for Animation 3 - Deformer Animation
Maya 1 Online - Additional
Resources
Instructor: Adrian
Herbez
Module 8 - Deformer Animation
Animation in Maya can be thought of as breaking down into three categories:
- Transform animation
- Deformer animation
- Dynamics
Dynamics animation involves the simulation of real-world physics and includes things like particle systems and Maya:Cloth. Dynamics is beyond the scope of Maya 1, but is discussed in depth in Maya 2.
Transform animation is animation that involves changing the transform attributes of an object or objects- their position, rotation, and scale. Transform animation operates on entire objects at once, and is therefore limited.
Pretty much everything else consists of deformer animation. A deformer is something that changes the shape of an object. You've already been using deformers, as skinning a model applies a deformer to it. As the skeleton moves, it changes the shape of the mesh by moving vertices in a particular manner. We tend to think of it bending the model at the joints, but it's good to think in terms of it being a deformer like any other. And there are many others. In this module, we'll be looking at a few of the most useful- blend shapes and clusters.
Blend Shapes defined
While skeletal animation is a vital part of the character animation process, there are some kinds of animation that don't lend themselves that well to skeletons. The most typical example is that of facial animation, but there are many other situations where skeletons won't quite do the job. In general, skeletal animation is for animation that involves roatational movement of parts of a model. For everything else, some other method must be used, and that method is often blend shapes. Note that this is not an either-or situation, by any means- you certainly can (and generally will) combine skeletal animation with blend shapes and other kinds of deformers.
So what are blend shapes and how do they work? As the name implies, blend shape animation involves blending from one shape to another. What this ends up meaning is that you create multiple versions of the same model, each altered slightly. Maybe one has a raised eyebrow, maybe one is smiling, etc. These objects are referred to as target shapes, and affect the shape of a single base object. During animation, Maya provides you with sliders controlling the amount of influence each target shape has on the base object. You can utilize as many or as few of the targets as you want at any one time, and by using more than one at once, you can easily increase the number of options you have at hand for animating the base object.
How Blend Shapes Work (technical details)
There are some specific requirements as to the shapes you can use to make blend shapes, and to understand what they are and why they exist, it might be good to talk about how blend shapes do what they do.
Blend shapes are deformers, and therefore work on deformable objects. A deformable object in Maya is simply something that is made of vertices (of one kind or another). Therefore, blend shapes will work with all three geometry types, since NURBS, polygons, and Subdivision Surfaces are all made out of points. Note, however that deformers generally won't carry over from one geometry type to another, as the Modify->Convert commands effectively create new objects. Plan out your workflow so that you don't have to convert geometry after applying deformers.
Okay, so blend shapes are deformers, and deformers work on vertices. In Maya, anything that has vertices has a specific ordering of them. This comes about due to the need for Maya to reference a particular vertex. To get to specific vertices, each vertex needs a unique identifier, and Maya does that by simply numbering them. This ends up being really important for blend shape animation, as the way Maya performs blend shape animation is by looking at the position of each vertex in the base object, and moving it to the position of the same numbered vertex in the particular target object.

So if vertex #34 is at position P in the base object, and in position Q in the target, the blend shape slider for that target would move that vertex from P to Q. Note that for this to work, the vertex that happens to be number 34 needs to be the same part of the model. And therein lies the particular limitations of blend shapes- in order for blend shapes to work reliably, all of the objects involved (the base object and however many target objects), must fufill the following requirements:
- They must have the same number of vertices
- Thier vertices must be numbered in the same order
Technically, Maya will let you violate the above restrictions, but you don't want to, as it can often lead to unpredictable results. So given the above requirements, how do you go about fufilling them?
While the above requirements may seem a bit esoteric, it ends up being really straightforward to keep Maya happy. When creating your target shapes, always start by making many copies of the base object. Create your targets by modifying the base object. You can use any of the modeling tools you like, just make sure that you never:
- Add vertices (split polygon, smooth, subdivide, rebuild surfaces)
- Remove vertices (merge vertices, deleting vertices, rebuild surfaces)
- Convert the geometry to another type
If you don't do any of the above three things, all of your objects will definitely have the same number of vertices and they will be in the same order.
Creating Blend Shapes
Okay, so here I have a simple head that I want to animate using blend shapes. The first thing I'll do is to make several copies of the head to use as starting points for the modeling of my target shapes.

Now I'm ready to start making my targets. This is just modeling, and I go about it just as I would in any other situation, except that I make sure that I don't do anything that would either increase or decrease the number of vertices.
So for starters, I'll make a target with the sides of the mouth raised in a smile, and another with an eyebrow raised. It's a good idea to take a really modular approach when creating target shapes- make each target only do one thing. So even if I was useually going to want to raise both eyebrows at once, I'd make two separate blendshapes, one for each 'brow. That way I give myself a lot more flexibility with how the blendshapes are used in the animation, and I end up with more options for animation with no more modeling work.

So there are my completed models, ready to be set up as a blend shape. To create the blend shape, I'll select all of the target objects (in any order), and then shift-select the base object. Note that the only way Maya has of know which of the objects should change it's shape is by looking at the one most recently selected, so be sure to select your base object last. Having done that, I'll go to Deformers->Create Blend Shape. Lets look at the options that Maya gives us:

For the most part, the defaults are just fine. One possible pitfall would be to select "World" instead of "Local" (the default) for the origin option. That would cause the animated object to not only change its shape, but also move in the world, which you generally don't want to have happen. If you see that happening, delete the blend shape (the blend shape itself, not the target objects- we'll see how in a bit), and re-make it with the "Local" option selected. There is also one you'll occasionally have to change in the "advanced" tab.We'll talk about that in a bit- for now I'll just use all the default settings.
And that's that- we've created a blend shape. If everything went fine, you won't see anything change in the world, but the blend shape will be there, waiting for you to use it in animation.
Animating with blend shapes
To actually use the blend shape, go to Window->Animation Editors->Blend Shape. You'll see something like the following:

This window holds all of the blend shapes in your scene. By default, each blend shape (meaning the entire system of target shapes and the base object), gets a horizontal row, with each target object having a vertical slider. Since I only have two target objects at this point, I have two sliders.

By default, the slider values range from 0 (no influence) to 1 (full influence), but you can use values both less than 0 and greater than 1. Values less than 0 will have an inverse affect to the base object. By using negative values, you can sometimes get extra target models without any additional modeling time. For example, specifying a negative value for a smile target can sometimes produce a workable frown target. In order to do that, you have to type the value directly into the box below the slider. Inputting -1 for the smile will give me a sort of mouth-hanging open expression that might prove useful.

This is really useful, but it's somewhat akward to have to set the smile value to negative one to make the mouth hang open. Also, inputting values less than 0 or greater than 1 changes the range of the slider, usually to something ungainly. It would be nice to make the open-mouth just another target, with a weight value of 0 to 1, and have the smile target go back to it's 0-1 range. That can easily be done via removing and adding targets.
Adding and Removing target objects
A common mistake that begining students make with blend shapes is to make multiple blend shapes for the same object. An object should never have more than one blend shape applied. Note that by "blend shape" I mean the entire system- objects can have as many target objects as they need to, but all of the targets should be a part of the same blend shape (the same bank of sliders).
So what do you do if you've made a blend shape and later realize that you need a few more target shapes? Luckily, Maya makes it really easy to add (as well as remove) targets after the fact. So let's look at how we can use that to clean things up a bit with our face.
To tidy things up with the blend shape we're working on, I'll want to both create a new target for the mouth-open state, and reset the slider for the smile. To make a slider for the mouth-agape expression, I'll need a separate model. It's really easy to make certain desireable combinations of slider settings into targets of thier own by
- Duplicating the animated object (duplicating will copy the current shape, but not the dependancy- effectively freezing the current state)
- Adding the copy as a new target

Creating a copy of a shape that has blend shape animation applied will make a new model that is a frozen copy of the original, but that isn't itself affected by the blend shape.
So now I have the new target,and I'm ready to add it to the blend shape. This is really easy to do. All I have to do is to select the new target, shift-select the object to which the blend shape is applied (just as when you make a blend shape, you always select the base object last), and go to Deform->Edit Blend Shape->Add. You'll see a new slider pop up in the blend shape window, allowing you to set the shape to the new target.

If you want more options for a particular object, always use the above method to add targets, rather than creating a new blend shape, as it will make things much more straightforward to animate. You can also remove sliders if you find yourself not using them much and want to have less clutter. This can also be used as an easy way to re-set the range for a particular target back to 0 to 1. If I select the oringial smile target and shift-select the animated object, I can use Deform->Edit Blend Shape->Remove to remove it from the blend shape (note that that doesn't delete the target object, just takes it out of the blend shape). I can then re-add it to the blend shape by using Edit Blend Shape->Add, and it will come back in with the default range (0-1).
Using Blend Shapes with skeletal animation
As mentioned at the start of this module, blend shape animation often goes hand-in-hand with skeletal (and possibly other kinds) of animation. If you create your blend shapes before you apply the skeleton, everything will work fine. If you apply your blend shapes after having skinned the model, however, you'll encounter a frustrating (though easily solvable) problem.
Let's say I've skinned my model, and now I want to add in some blend shapes. Here's a skinned model, after having had a blend shape applied. Notice that the blend shape seems to be working just fine

However, watch what happens if I try to combine skeletal animation with the blend shape, say by having him bend over and then raise his eyebrows:

Notice that the blend shape effectively un-does the skeletal animation, causing the model to snap back to its oringial position, leaving the bones hanging in midair.
This is due to the order in which the deformers are being applied. If you create the blend shape, then sking the model, Maya applies the blend shape animation and then applies skeletal deformation, giving you what you would expect. If you skin the model then create a blend shape, however, Maya goes is the opposite order. First, Maya applies the deoformation that is caused by the bones. Then it applies the blend shape. Since blend shape animation works by moving the vertices of the base object to thier positions in the target, it ends up moving the vertices of the model back to where they were before the bones moved them, which causes problems.
Fortunately, there's an easy way to deal with this. If you've already skinned your model, and you want to add in blend shapes, create the target models just as you would normally. When you're ready to create the blend shape, be sure to go to Deform->Create Blend Shape->Option Box. Switch over to the "Advanced" tab, and you'll see a "deformation order" setting. By default it will be set to "default", and that's generally where you want it to be. To get blend shape animation to apply after skinning without undoing skeletal animation, though, you'll want to select "parallel" from the drop-down list.

That will cause the two deformers (the skeleton and the blend shape) to be applied to the model at the same time, meaning that niether will ovverride the other.
Using Cluster Deformers
Another really useful deformer, and one that is really good to talk about alongside blend shapes is the cluster deformer type. A cluster deformer is basically a handle with which you can animate a group of vertices. What makes clusters so useful is not just that they can control vertices, but that they can have influence that falls off smoothly away from the handle.
Clusters are also good ways of going about certain kinds of modeling. Every deformer in Maya can be used as a modeling tool as well as an animation tool, by simply deleting history on the object after changing it's shape with the deformer. Clusters are especially useful in this way, and can often be a good way to go about creating your targets for blend shape animation.
Let's say I have a relatively dense mesh that I want to create targets for:

If I wanted to create a target model with a raised eyebrow, I could do that simply by moving the vertices of the model around, but that would take quite awhile to do effectively, and could lead to glitchy areas. An easier way to do it is to use a cluster. To create a cluster, you start by selecting all of the vertices you want to be affected by the cluster. Note that this means all of the vertices that you want the cluster to have any affect on, even if it's minimal, so be sure to err on the side of selecting too many. For a raised eyebrow, I' want something like the following:

Next, I'll create the cluster by going to Deform->Create Cluster. I'll see a small "C" (for "cluster") displayed in the scene. That C is the handle for the cluster, and moving it will move the vertices that the cluster controls.

This is good, but still less than ideal, as the effect that the cluster has is far too drastic. That can be changed, and the effect made more gradual, by using the Paint Cluster Weights tool, which works in a way very similar to the Paint Skin Weights tool. If I select the model (not the cluster, just like with Paint Skin Weights you select the model and not the skeleton), and go to Deform->Paint Cluster Weights Tool, I'll see something like the following:

This is just like Paint Skin Weights, in that vertices are colored depending on the degree to which they are controlled by the cluster. The left image is what I start with, with every vertex involved being completely controlled by the cluster, and therefore displayed as pure white. After using the scale and smooth operations, I would get to somethign more like the image on the right, with the influence of the cluster falling off gradually, which would result in much more fluid and smooth deformation as the cluster moves:

Once I have the cluster causing fluid deformation, I could move it to where I want it to be, delete history on the shape (which will also delete the cluster), and use the shape as a target object for a blend shape. Alternatively, I could just use the cluster directly by setting keyframes for its position. Clusters are really useful as modeling aids, but they are also great animation tools in thier own right.