Thursday, February 10, 2011

Animating with Deformers in Maya

Although animating with deformers is a commonly used technique in the VFX industry, a lot of people don’t know about it’s benefits. Well, after this tutorial that’’s going to change. We’ll be looking at how to animate complex expressions with deformers, along with why they can be extremely useful. Enjoy!

Step 1

First of all, open Maya and import your model. For this tutorial I’ll be using a version of ZBrush’s standard head model as it will help to easily show the main benefits of deformer-based animation, however this technique will apply across all models no matter how complex. Now go to the front view, duplicate your model (Ctrl+d) and rename the new copy. Be sure to use a descriptive name as this will later become the name of your blend-shape – in this case, I’ve used Male_Head_Smiling. Position both models next to each other to make things easier to work with. Now I’m going to actually deform the second mesh to make it smile!

Step 2

First we need to setup our mesh selection tools. In the top menu, go to Modify > Transformation Tools > Move Tool > Option Box. Turn on Soft SelectFalloff radius. This is, of course, a relative value due to the fact the every model you work with will likely be different in size. In this case I want to select an area just large enough to move the cheek a little bit to create the realistic effect I’m going for, so have chosen a value of about 0.35. Now turn on the Reflection setting, lower the Tolerance to about 0.04 and set the Reflection axis to X. This enables us to easily make the same changes to one side of the model as we do on the other, saving us time! We can now start deforming! and set the

Step 3

Next, right-click on the model and go to Vertex mode, which will allow us to move the vertexes instead of the mesh itself. As I’m intending to make the model smile, I’m going to be affecting the vertexes around the corners of the mouth, so I start by dragging a selection from the right corner of the mouth, slightly to the right and then slightly upwards. As you can see below, both sides of the model are affected because of the Reflection setting we previously enabled. The brightly colored areas represent the extent of our falloff.

Step 4

So with our vertexes selected, and with our falloff in place, now activate the move tool. To make this model smile, I needed to move the affected verts slightly to the right and slightly up, and with a little bit of trial and error, this is my result :

Step 5

Now that we’’ve got our original model and our deformed model, we need to create the blend shape deformer itself, so first select the Animation menu-set and then in the top menu choose Create Deformers > Blend Shape > Option Box. In the background, first select the deformed model (in my case the smiling man), then shift click the original model (it’s very important to select the model you want to have the blendshapes implied to last of all.) Enter a name for our deformer in the BlendShape node box, for instance something like Smile.
Now we come to a very important setting – Origin. The default setting is Local, and although you may need to choose World for some rare circumstances, the Local deformer the most useful one. Just to cover it quickly, if you set the origin to World, all deformations are created as relative to the model, meaning that if you move the model around the scene, the won’t move with it! So, for now we’re going to stick to the Local setting. Leave the other settings as they are and then click Create.

Step 6

To use the blend shape we’’ve just created, go to Window > Animation Editors > Blend Shape. You should now have a single slider there (in my case Male_Head_Smiling) and if you move it up and down you’ll quickly start to understand the advantage of animating using deformers – if you move the slider halfway, you see a mix of both models, meaning that with a few blend shapes you can create literally thousands of expressions!

Step 7

To do a little animation test, go to the first frame, move the slider all of the way to the bottom and click Key. Now move forward a few frames, move the slider to the top, and click Key again. If you play back the animation you can actually see the mouth moving.

 You can actually add as many blend shapes together as you want, so I’m going to add another one to control my model’s eyebrows.

Step 8

Start by duplicating your original mesh, moving it over to the left of the original, and renaming it, in my case to Eyebrows. Now repeat step 3 as above. This time I moved the area above the eyes downwards slightly, ensuring the eyes themselves remained untouched. Now go to Create Deformers > Blend Shape > Option Box, and select first your newly deformed mesh, and then shift-click the original. Give the blend shape a name and then click Create. On returning to the Blend Shape editor you can see we now have two sliders, in my case one for the mouth and one for the eyebrow expressions.

Step 9

To have more control we can do something else that you may have seen before – interactive controlling. Interactive controlling uses geometry ‘rig’ to control the motion of the blend shapes – something that can be very handy for facial expressions!
In the top menu go to Create > EP Curve Tool, and draw a curve something like that in the picture below – in my case, as this will be the eyebrow controller, I’ve styled it to match. Now go to Modify > Center Pivot, then duplicate your curve and move the duplicate to one side. Select both curves and group them by going to Edit > Group and give the group a clear name – in my case, Eyebrows_Controller. Finally select both of your curves and go to Modify > Freeze Transformations to reset their initial positions.

Step 10

We’’ll now setup the curves to control the blend shapes, using Maya’s Set Driven Keys. First of all ensure that all of your blend shapes are set to 0 – this is very important! Then go to Animate > Set Driven Key > Set to bring up the Set Driven Key window.
Open the Outliner and select your controller group. Then select it again in the Set Driven Key window, and click Load > Selected as Driver. Now back in the Outliner, right-click in the main section and deselect Show DAG Objects Only. This will allow us to see all of the nodes currently in our scene, as shown below :

Step 11

Locate your blendshape node in the Outliner – it will have the name we entered earlier on creation followed by a number, in my case Eyebrows1. Then in the Set Driven Key window, click Load > Selected as Driven. Now you should have something like the picture below :

Step 12

First all you want to work out the axis on which our controller is going to affect the blend shape. As I want the eyebrows to move up and down I’ll be using the Y-Axis, so I’m going to select Translate Y in the right side of the driver pane, at the top of the Set Driven Key window.
Now to create the keys themselves, we first need to setup the start states for the blend shape and our controller curve. I want the eyebrows to be lowered initially, so that moving the controller group up has the effect of raising them. So I’ll set the Translate Y value of my controller to 0 in the attribute editor, and then set the Eyebrows blend shape the value to 1 (lowered). When you’re happy with your initial setup, click the Key button at the bottom of the Set Driven Key window.

Step 13

With the first key created, we now need to set up the second. First of all I set the Eyebrows blend shape value to 0 in order to bring them back to their original position. I can then select the controller group and move them up on the Y-Axis to sit along side the newly raised eyebrows. When you’re happy with your second position, hit the Key button one last time.
With that done you can now close the Set Driven Key window, and try to move the curves around – your mesh is actually responding! I could now go on to apply this technique in exactly the same way to control the position of the mouth, eyes and any other object you can imagine.

 So that’s it for today! I hope you enjoyed this tutorial and I especially hope that you’ve learned some new useful techniques you can apply to your own models. Be sure to stand out and be creative!


Blogger said...

If you want your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you got to watch this video
right away...

(VIDEO) Win your ex back with TEXT messages?

Post a Comment