From BlenderWiki
If you want to document Blender 2.5 features please edit pages under Doc:2.5/Manual.
If a "2.5" page doesn't exist please copy the text from 2.4x Manual and edit the new page (i.e. you should paste the wikitext from this 2.4x page to this new 2.5x page and then update the latter with 2.5 features)
[edit] Setup the Shape Keys
We will start with a simple example, which shows all essential elements.The Basis Mesh is shown in Image 1. It is seen from Top-View (Num-7). Now we're going to insert five Shapes.
Select the mesh in Object mode.
First create the "Basis" shape by pressing i->Mesh. (Or by pressing the Add Shape Key button under the Shapes tab in the Edit/Buttons window).
Note
Make sure that you have created/edited the mesh to your liking before you create the "Basis" shape. If you edit the mesh after creating shape-keys unpredictable results may occur.
|
We create the following four shapes directly at the beginning, so they all originate from the "Basis" shape. Repeat the i->Mesh process four times.
You can switch between the shapes by selecting the respective shape in the Shapes panel in the Editing buttons (F9). Now we're going to change the shapes.
The shapes:
- Basis - Basis position, Mouth half opened.
- Close - Mouth closed.
- Smile - Corners of mouth pointing upwards.
- LeftUp - Only left corner upwards.
- RightUp - Only right corner upwards.
See the images ------------>>>>>>>>>
To drive the Ipo curves we use the bones of an armature. One bone to open and close the mouth, another one to lift or lower the corners of the mouth. Since we can use all three directions in space separately as drivers input, we can move both corners of the mouth by moving in vertical direction, by moving in horizontal direction we move the right resp. left side only, etc.
It's up to you how many bones you use and how you want to control the shapes, it depends on the amount of control and ease of use you would like to achieve.
In our example the armature is inserted in ZX (Front) view (Num-1). You may insert it on it's own layer and use a separate 3D window to move the bones around. You should align the bones along the global axles, it is easier than to confine their movement.
Name the left bone "Close", the right bone "Smile". Name the armature object "Driver" (F9->Link and Materials panel, OB: field.). (The name "Driver" is arbitrary and has no relation to the IPO->"Driver")
Select the mesh in object mode.
Split the 3D window and change to the Ipo Curve editor. Select the Ipo Type->Shape (Image 3).[edit] Connecting Shape key and Driver
To connect the Shape key with the controlling object - the Driver - you select the Shape key (LMB from the list on the right side of the IPO window), and press n in the Ipo window in order to call the Transform Properties panel. Click on Add Driver. Insert the name of the armature in the OB: field and select Pose in the drop down box. Insert the name of the controlling bone in the field BO: (here "Close"). We use LocZ to control the pose (Image 4). If you're in doubt about the correct coordinate, select the bone in the 3D window and use it's transform properties panel in the 3D window to watch it's coordinates.To insert an Ipo curve press i in the Ipo Curve editor and confirm Default one-to-one mapping. A linear curve transition from (0,0) to (1,1) is inserted. The symbol for the Ipo curve in front of the shapes name receives a point, in order to indicate that a Driver for the curve is present. The Ipo curve maps the movement of the bone to the Key value of the shape, e.g. if you move the bone one Blender Unit (BU) in Z direction, the Key value of the shape changes from 0 to 1. If you move in negative Z direction the shape is inverted, i.e. the vertices move in opposite direction. If the Ipo curve runs horizontally the shape does not change if you move the bone.
We will use that to specify the borders of a meaningful movement of the bone. Set the mapping to (-1, -1), (1, 1) by selecting the curve and pressing ⇆ Tab to enter edit mode. Right click on the point at (0,0), press G to grab it, and move your mouse down and to the left until the point has shifted to (-1,-1). You also can, once the point is selected, directly type its new coordinates in the fields Vertex X: and Vertex Y:, at the bottom of the Transform Properties pannel. Press Tab again to leave edit mode. Set the Extend mode to Constant (Curve->Extend mode->Constant). Press T->Linear reset to a linear curve, if the type of the curve changes when the extend mode changes.Repeat these steps for the shape "Smile", but we have to invert the Ipo curve (S-X) from (-1,1) to (1,-1), so that the movement of the bone corresponds with the movement of the mouth. In order to raise the corners of the mouth individually, the Shape key is connected with the x-coordinate of the Bone. If the Bone moves in positive x-direction the right corner is to be raised, if it moves in negative y-direction the left corner (Image 6).
If you now move the bones in pose mode, the shapes change accordingly. If you need more shapes, or want the handling more flexible, you have to define more drivers.
[edit] Custom Controls
"Custom controls" - thus essentially selfmade manual controllers - facilitate the handling of Driven Shape Keys. There is no such Blenderobject (as of now), so we use mesh objects to visualise the purpose and borders of driver objects. The movement of the drivers is constricted by setting the lock options in their Transform Properties panel and - if you like - by floor constraints. So the driver objects behave pretty much like real control buttons.
You can go for a different visualisation if you build a stylized "Face", and insert the drivers in their respective places (idea by: Zeyne 2.4 rig with facial controller).
After creating the controls we can move them to a global scene, so you don't edit them inadvertently. Add a new, empty scene (the double arrow besides the SCE: field, Add new->Empty). Name this new scene "Global". Mark all objects which belong to the control, but not the Armature, which we still have to change. Link the objects into the scene "Global" with CtrlL->To scene... ->Global.
Then we remove the connection between the objects: U->Object. Now delete the objects in the current scene. Change into the Scene Buttons (F10) and click on the small Button with the double arrow and the inconspicuous Tooltip Scene to link as a Set in the Output panel. Select "global". Now the controls are indicated, but you can't select or edit them.[edit] NLA
Now the individual "face" movements can be arranged to actions, and these again in the NLA editor to complex groups. An action would be a certain face expression, e.g. merrily, sadly, surprised, bad etc. If one has provided all necessary actions, one works only with these actions.
Of course your're not forced to work in the NLA editor, instead you could create one long action, into which you insert all Ipos.
[edit] Define Actions
As described in the section The Non Linear Animation Editor Window, the different actions for the face have to be created.
The example "face" is extended by two "eyes". Three actions were created: "Wink", "Joy" and "Anger" (Image 11). By positioning the bones of the armature in pose mode the expressions are created, all necessary bones selected and an Ipo inserted. Move ten frames foreward, and save exactly the same pose. The timing is made in the NLA Editor window.Now arrange the expressions in the NLA editor and define the timing. Especially useful is the blending of different expressions (Blendin/Blendout). If you use the option Hold for the strips, you should define an action "Basis", so that you can blend to the "Basis" shape.
[edit] Links
Ipo Drivers, Releasenotes of v2.40
Orange Blog: License to drive Driven Shape Keys, blend file provided.





















![[]](/skins/blender/open.png)
