08 Shape Keys Discussion

download 08 Shape Keys Discussion

If you can't read please download the document

description

Discussion about Key Shaping.

Transcript of 08 Shape Keys Discussion

Chapter 8: Shape Keys: ToolsBy Andy DolphinYou already know that in Blender you can animate the way that objects move around the 3D world. Blender also gives you the ability to have your mesh objects change their shape over time. These changes, called deformations, are saved in "shape keys". Examples of where you might use shape keys include morphing from one character or shape to another, or adding subtle variations to a shape to add interest to an animation, like having a creature's chest rise and fall to show breathing. One very popular use of shape keys (sometimes called "morph targets") is for character facial expressions and lip-syncing. Shape keys are not restricted to animation however. If you have a model you wish to use in a series of still images, shape keys can be a convenient way of saving shape variations that will be used more than once.Figure 8.2.1: Various facial expressions created only with shape keys.Shape keys store vertex positions relative to their original positions in the mesh. After the shape key is stored, the deformation can be controlled by influence sliders. Moving the sliders causes the vertices to change from their positions in the original mesh shape and move toward the positions saved in the selected shape key.Multiple shape keys can also be combined to vary the final shape of the mesh. The original shape of the mesh is saved as a basis shape key. It is always available and can be returned to at any stage, no matter how many shape keys have been made from it. As shape keys are non-destructive, you can try out various ideas on changing or improving a model, and if you find you don't like them, you can delete or ignore them, returning to the basis shape. Keep in mind that shape keys do not allow you to change the structure of the mesh, only the positions of the vertices which make up the mesh. You cannot add or delete vertices when using shape keys.Making Shape KeysSIDEBAR: Before you begin.Before working on your shape keys, be sure that you are happy that your basic model is finished.One important point to remember when working with shape keys is that since they store relative vertex positions, the mesh should be in a finished state before applying them. While some editing is possible after shape keys have been saved, it can lead to unpredictable results and may make some of the shape keys useless, in which case you'll need to recreate those shape keys from scratch. It is common practice to build organic models, like humans and animals, using a mirror modifier so only one half has to be modeled while Blender automatically creates the other half. If you've used a mirror modifier while modeling, make sure to "Apply" it (join the two halves) before proceeding with shape keys, as applying mirror modifiers later will result in the loss of all shape keys.End SidebarShape key controls are found in the Shapes tab of the Editing Buttons (F9). Shape keys are added to a mesh in Object mode. Then, the shapes are made and edited in Edit mode.Figure 8.2.2: The Shapes tab before any shape keys are saved.If no shape keys have previously been stored for a selected mesh object, the Shapes panel will show a single button with the label "Add Shape Key." When this button is pressed, the panel changes to show a button labeled "Relative," which is active by default, and a drop-down menu with the word "Basis" showing in the text field. This shows you that Blender has stored the current state of the mesh as the Basis shape key. The Basis shape key is essentially the original un-deformed mesh, and all future shape keys for this mesh will be stored relative to this shape key.Figure 8.2.3: The Shapes tab with basis shape key saved.Pressing the "Add Shape Key" Button again results in a new shape key labeled "Key 1" being added to the drop-down menu. The key name can, and usually should, be changed to something that will indicate what this shape key represents. For example, when making mouth shapes for lip-sync, the shape keys should be given names that indicate the sound or letter each key represents. If you fail to do this, a lot of time will be wasted when you go to actually use the shapes in an animation. You can edit the name of each shape key by selecting it from the shapes panel menu, then typing a new name into the text field.Figure 8.2.4: The Shapes tab after the first shape key is saved.When the first new shape key is added, you will see a key value slider, a "Min" and "Max" adjuster and a text box labeled "VGroup:" in the Shapes panel. These give you additional control over the shape key, which will be explained in a bit. A list of shape keys with sliders also appears in the Action Editor window (Action window), if one is open. When animating with shape keys, it is usually better to do so in the Action Editor as multiple shape keys can be easily accessed without scrolling through a menu, and markers are placed to indicate key frames for each shape key.Figure 8.2.5: The Action Editor window showing a list of shape keys.Once a shape key has been created, a unique target shape can be made by tabbing into Edit mode. Selected vertices, edges or faces can be moved, scaled or rotated to create a new shape. Remember that vertices, edges and faces should not be added or deleted when making shape keys. After the mesh has been modified into the desired shape, it can be stored by exiting Edit mode. Each time the "Add Shape Key" button is pressed, a new shape key is created, ready to store a new shape. Shape keys can be selected from the drop down menu next to the shape key names or by scrolling through all keys using the "Previous Shape Key" and "Next Shape Key" buttons.Using One Shape Key as the Basis For a New OneNew shape keys are based on the currently selected shape key at the time the "Add Shape Key" button is pressed. So, if the Basis key is selected, the new shape key will be a copy of the Basis key, ready for editing. Sometimes it is useful to have two or more keys that are similar to each other. In this case, an existing shape key should be selected before pressing "Add Shape Key". Then, when entering Edit mode, the mesh will already be deformed to the same state as the previous shape key. From here, minor or major adjustments can be made to the mesh to create the new shape key. This can save quite a lot of time when creating similar shape keys in complex models, as the majority of the adjustments would only need to be done once. Subsequent shapes could be based on the first adjustment. Editing Shape KeysAs shape keys store positions of vertices relative to the base mesh, it is quite simple to change them, even after they have been used in an animation. In fact, it can sometimes be useful to begin animating and using the shape keys to determine if they need to be tweaked for best results. To edit a shape key, select it from the shape key drop down menu, then tab into Edit mode. Adjust the mesh as desired and save it by tabbing back into Object mode. One problem that may arise after saving shape keys is coming to the realization that your original shape isn't quite the way you'd like it to be. You may, for example, decide that your character's ears are too small. Simply making them bigger won't deliver the desired result as the smaller ears have already been saved in all existing shape keys and the changes you make will only affect the currently selected shape key.A very useful feature of Blender shape keys is the ability to change the mesh in one shape key and have that change affect all existing shape keys. Such changes would usually best be done with the base mesh (the Basis key), as this is the un-deformed mesh and any changes will probably be more predictable. So, if you decide the basic shape needs some adjustment, select Basis from the shape key menu and fix the mesh in Edit mode. Then, with all edited vertices still selected, press W-key and choose "Propagate To All Shapes". Return to object mode and examine the remaining shapes to make sure that everything happened as you expected. Remember that you cannot add or delete vertices, edges or faces when you do this. You can only move, rotate or scale existing ones.Figure 8.2.11: A mesh in Edit mode, showing "Propagate to all shapes."It is also possible to adjust selected vertices of one shape key by applying vertex offsets from another shape key. Select a shape key from the menu and enter Edit mode. Select some or all vertices and press W-key. Choose "Blend From Shape". A menu pops up with a list of other shape keys to copy from. Select one, then move the mouse slowly in order to see and control the adjustment. Pressing MMB will apply the adjustment at 100%. This feature would prove useful if you wanted your character to have larger ears in some of your existing shape keys, but not all of them. It is certainly quicker and easier than editing the ears in each shape key individually.Figure 8.2.12: A mesh in Edit mode, showing "Blend to Shape" selected.If you've already commenced animating, it is important to note that the effect of editing the shape keys or the base mesh will apply immediately to any animation you have already keyed. Be sure to tweak carefully and check the animated results regularly. You may find you'll need to adjust some sliders or edit some key frames to achieve a better result after you've made changes to your shape keys. Deleting Shape KeysYou can select a shape key from the drop down menu and press the "X" button to delete it. When a shape key is deleted, its influence in an animation is completely removed. Using Shape KeysWhen a shape key is created, the key value slider associated with it will show a default value of 0.0. This means that new shape keys have no influence on a mesh, leaving the mesh un-deformed. If the key value slider is moved forward and released, the mesh will deform. The amount of deformation is relative to the slider value (0.0=0%; 1.0=100%). Note that the slider is not interactive, and the mesh is not updated in the 3D view until the slider is released. Also note that the vertices move in a linear fashion. That is, they move in a straight line from the basis position toward the position stored in the shape key. This linear displacement is important to recognize and understand, as it is one of the main differences between shape key animation and animation using armatures. If you need your mesh to move in a curved motion, such as an eyelid sliding over the surface of a rounded eyeball, shape keys may not be the best option.The "Min" and "Max" settings next to the key value slider allow you to push vertices past the values saved in the shape key or to move them in the opposite direction, relative to the basis mesh. Pushing a shape to extremes by setting the Max value greater than 1.0 and pushing the influence slider up can sometimes be useful, but it can also deliver unexpected results.The "Min" setting can be made negative, giving the reverse of the shape key. If a group of vertices was moved to the left in the stored shape key, setting "Min" to a negative value and pushing the influence slider below 0.0 would cause those vertices to move to the right. While this can be an apparently easy way of turning a smile into a frown, for example, it must be approached with caution and is usually best for subtle effects. Values can be negative or positive but the Max value must always be greater than the Min value.Figure 8.2.6: A single Shape key applied to a sphere with its slider set to 1.0 and -1.0The Pin icon in the Shapes panel can be used to view the effects of a single shape key on a mesh, or an entire set of shape keys at the same time on multiple instances of a mesh. Linked duplicates of the mesh, created by pressing Alt-D on selected objects in Object mode, can be placed side-by-side with each one displaying a different shape key at full key value. A gallery of shape keys can be created using this method. This can be a useful way of comparing different experimental shapes and to choose a preferred shape. To use shape Pinning, simply find the shape you want to display from the shapes drop down and click the pin icon. Until the pin icon is turned off, the object will display with that shape, regardless of other keys that might have been set.Figure 8.2.7: Linked duplicates of the same mesh, each showing a different pinned Shape key.A More Advanced TrickThe influence of a shape key can also be limited to a selected vertex group using the VGroup option, and the result can be further controlled through vertex weight painting. Using this feature, it is possible to create one shape key which contains complex deformations all over a mesh, and then use the shape key in conjunction with different vertex groups to create a whole series of new shape keys, each affecting only a small portion of the mesh. For example, it may be simpler to create an angry face shape key all at once, but you may want access to different components of that shape individually: knotted brow, squinting eyes and snarling lips. It often gives better results to model adjustments all at once, and then to create separate shape keys using vertex groups than it is create several separate shape keys from scratch.Note: For more information about vertex groups, refer to Chapter 4.To do this, create an overall shape key, then create and assign several vertex groups to the mesh, one for each section that would benefit from having a separate shape key. In the VGroup text box of the shape key, enter the name of one of the vertex groups. The shape key is now restricted to only affecting those vertices contained in the group. Press the Add Shape Key button. Normally, this would create a whole new copy of the entire current shape key. In this case, though, it just creates a copy of the shape keys from the vertex group. You can now go back to the original shape key, change the name to that of another vertex groups, and create additional keys.Animating Shape KeysAnimation occurs when different shape key values are stored at various points along the animation timeline. These values are stored in key frames. Blender displays the current frame number in the header bar of the Buttons window and with a green vertical line in the Action Editor. Frames can be changed using the arrow keys. More information about the animation timeline and changing frames can be found in Chapter 3.When the key value slider is moved, a key frame is automatically inserted in the animation timeline on the current frame, so the mesh shape at that frame is recorded. Changing frames and moving the slider to various values will result in an animated shape when the frames are played back. If a shape key slider's value is set to 1.0, then the stored values for each vertex affected by that shape key will be applied at 100% on the current frame. This influence will remain unless the slider is moved to a different value on a later frame. Blender creates smooth transitions from one key frame to the next by interpolating values for all shapes between key frames. These values can be seen by setting the frame counter to the desired frame number and reading the value shown in the key value slider in the Shapes panel with the desired shape key selected.It is often useful to have a mesh change shape over a period of time and remain unchanged for a while, sometimes for just a few frames, before changing shape again. To force a shape to stay at one value for a number of frames before changing shape, it is necessary to set the value slider at the start and end of the fixed-shape period. Shape Keys in the Action EditorIf your mesh has more than one shape key saved, it is more efficient to animate with the sliders in the Action Editor than to keep switching from shape to shape in the Shapes panel of the Edit buttons. The Action Editor window displays a list of all shape keys associated with the selected mesh. Each shape key has a key value slider that follows the same rules as the influence slider in the Shapes panel. Again, simply moving a slider forward or backward inserts a key frame for that shape on the current frame. You can also see in the Action Window that Blender places a key frame marker in the selected shape's channel. These markers not only serve as a reference for existing key frames but also give the animator access to even greater control over the animation as they can be moved, duplicated or deleted with the standard Blender controls (G-key, Shift-D, X-key). Figure 8.2.8: The Action Editor window showing key frame markers.You can also use the Action Window to edit the name of shape keys or change the Min and Max values. Simply LMB on the shape key name in the list, and a dialog panel will open up, giving access to the shape key values.Figure 8.2.9: The Action Editor window showing the Shape key pop-up panel.When animating, you may notice some unexpected results when several shape keys are applied at once. If two shape keys affect the same vertex, the final position of that vertex will be determined by the influence of both shape keys added together. For example, if you apply two shape keys to one frame and both keys push the same vertex one unit to the right, the end result will be to push the vertex two units to the right. Conversely, if the second shape key moves the vertex one unit in the opposite direction, the combined result will be for the vertex not to move at all. A practical example of the combined effect of shape keys is given in the tutorial for this chapter.When Blender saves key frames for shape keys, it can display the values as a set of curves along the animation timeline. These are called Ipo curves and can be viewed by opening an Ipo Curve Editor window and choosing "Shape" from the Ipo type menu in the window's header. Each shape key has its own curve, identified by the color key in the upper right of the window. Ipo curves can be edited in a variety of ways for advanced animation control. This is often the final step in tweaking an animation. You can refer to the Ipo window section in Chapter 3 for more information on handling Ipo curves.Figure 8.2.10: An Ipo window, showing curves for Shape Keys.Crazy SpaceWhen a model is deformed by an armature, it can be difficult to edit the mesh, as the vertices, edges and faces are no longer in their original locations and don't respond to editing as you might expect. Under some circumstances, they might even move away from their intended direction. For this reason, working on a mesh while it is being deformed by an armature is called working in "crazy space". To avoid this problem, select the armature and put it in its un-deformed position using the "Rest Position" button in the Armature tab of the (F9) Editing buttons. This returns the mesh to its default position, and things will behave as expected when editing.Advanced Uses for Shape KeysOnce you've mastered shape key basics and are comfortable with animating and editing them, you may wish to use automated shape keys in combination with an armature for subtle effects during animation. This automated process is referred to as "driven shape keys". Shape keys can be "driven" such that when a bone is moved or rotated, the shape key will respond automatically. This feature can be put to great use to prevent meshes from pinching at joints like elbows and knees, or to simulate muscle contraction and expansion as limbs move. Some animators use a combination of bones and driven shape keys for facial animation. Although driven keys are outside the scope of this book, it is good to know that such things can be accomplished.ConclusionShape keys give Blender artists a powerful way to animate and deform their mesh models. They are the primary tool for facial expressions and lip syncing as well as for creating morphing effects. Combined with armatures, they give artists nearly complete control over the shape of their meshes.BLENDER OPEN CONTENT LICENSE Terms and Conditions for Copying, Distributing, and Modifying Items other than copying, distributing, and modifying the Content with which this license was distributed (such as using, etc.) are outside the scope of this license. 1. You may copy and distribute exact replicas of the OpenContent (OC) as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the OC a copy of this License along with the OC. You may at your option charge a fee for the media and/or handling involved in creating a unique copy of the OC for use offline, you may at your option offer instructional support for the OC in exchange for a fee, or you may at your option offer warranty in exchange for a fee. You may not charge a fee for the OC itself. You may not charge a fee for the sole service of providing access to and/or use of the OC via a network (e.g. the Internet), whether it be via the world wide web, FTP, or any other method. 2. You may modify your copy or copies of the OpenContent or any portion of it, thus forming works based on the Content, and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified content to carry prominent notices stating that you changed it, the exact nature and content of the changes, and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the OC or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License, unless otherwise permitted under applicable Fair Use law. c) The name of the Copyright Holder or contributors to the OC may not be used to endorse or promote products derived from this software without specific prior written permission. These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the OC, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the OC, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Exceptions are made to this requirement to release modified works free of charge under this license only in compliance with Fair Use law where applicable. 3. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to copy, distribute or modify the OC. These actions are prohibited by law if you do not accept this License. Therefore, by distributing or translating the OC, or by deriving works herefrom, you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or translating the OC. NO WARRANTY 4. BECAUSE THE OPENCONTENT (OC) IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE OC, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE OC "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK OF USE OF THE OC IS WITH YOU. SHOULD THE OC PROVE FAULTY, INACCURATE, OR OTHERWISE UNACCEPTABLE YOU ASSUME THE COST OF ALL NECESSARY REPAIR OR CORRECTION. 5. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MIRROR AND/OR REDISTRIBUTE THE OC AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE OC, EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.