## poseDeformer

    poseDeformer - Pose Space Deformer Maya Plugin by Michael B. Comet
    Copyright ©2004,2005 Michael B. Comet

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

        For information on poseDeformer contact:
            Michael B. Comet - comet@comet-cartoons.com
            or visit http://www.comet-cartooons.com/toons/

DESCRIPTION:

This plug-in provides a new deformer that lets you do pose space deformation in Maya. It works in conjunction with the poseReader plug-in also provided. This is similar but not quite the same as using blendshapes.

The main differences between this and regular blendShapes:

- Poses are stored as offsets rather than actual geometry
- Poses are stored in transform/joint space instead of object space
- The deformer comes AFTER the skinCluster in the input list
- Poses can be sculpted "in the pose shape"
- Multiple poseDeformer nodes can be used one after another, and it will work properly, instead of moving points back to other location like a blendShape would.

Since the deformer must store data in a pose space, the basic MEL script setup requires Maya Skin to be applied to the geometry first, so it can read what joints are used on the geometry. Also because data is stored as offsets, and because it is in pose space, calculation for generating a target is slower than a blendshape, and when it is done the target is deleted. However you can alwawys go back to a pose, and then edit the shape easily with the UI again at a later time to make tweaks. Finally, the poseReader node is used to drive the weight of each pose target automatically as the joint(s) moves into the pose.

REQUIREMENTS:

This recompiled plugin requires a Windows version of Maya 6.0. Source code is also provided for other platforms.

INSTALL:

1. Quit Maya if it is running.

2. Unzip the contents of the ZIP file.

3. Copy the poseDeformer.mll and poseReader.mll to the Maya binary plugin path where you installed Maya. This is typically:
   C:\Program Files\Alias\Maya6.0\bin\plug-ins\

4. Copy ALL MEL Scripts, such as the poseDeformerUI.mel, poseReaderUI.mel, libSkin.mel libString.mel and libMirror.mel file into your Maya scripts folder.

5. Restart Maya.

6. Open to the menu for Window | Setting/Preferences | Plug-in Manager...

7. Look for the "poseDeformer.mll" and "poseReader.mll" entry in the window. Choose "loaded" to load the plugin. You can also check the "auto load" box so that the plugin is loaded automatically every time you start Maya. Or you can just run the UI mel script and it will load the plugins for you.

8. Close the dialog.

9. Choose File | Save Preferences to make sure your prefs are saved.

10. The plugin is now loaded and installed, you can now use the new MEL command called "poseDeformerUI" to launch the UI to set up poseDeformer nodes.

USAGE:

1. Set up regular maya skinCluster smooth skinning on the geometry.

2. Run the poseDeformerUI MEL Script.

3. Follow the steps in the UI.

ADVANCED TIPS:

- You can use more than one poseDeformer node on an object. This can be useful to say setup one deformer for each area of the geometry. For example using one to do the left shoulder, one for the stomach, one for the left leg, and so on. To do this, simply right-click in the text field for the poseDeformer and choose "Create New".

  In addition this can also be useful if you want to use different poseDeformers for various levels of detail on your object. For example if it is a poly object, you can skin it and set up some poseDeformer targets. Then you could apply a polySmooth node to make it higher res. Then you could add a second new poseDeformer on top of that, and then sculpt and create even newer higher res pose targets with that deformer for things like wrinkles and so on.

- Left-click and hold down on the button next to the new Pose Name text field. This will tell the UI whether or not you will modify one of the existing poses, or whether you wish to create a new pose target and new poseReaders.

- You can select the actual poseDeformer node in the channel box to set some additional parameters on the deformer.

- blendMode lets you select between "RBF-LUFactorization", "Additive" or "Normalize". Additive is more like a regular blendShape. If you move a point for pose A two units, and then do the same for pose B, and then if pose A and pose B overlap, the point will be moved twice as much. Usually this is NOT desired.

  With normalize, any poseReader weights that overlap and are greater than one are normalized back to one. For example if you have 3 poses overlapped and the output weights then become 0.5, 0.8, 0.4 (which total 1.7 ) then if set to normalize mode, the deformer will work as if the actual weights were instead set to 0.29, 0.47, 0.23 (which totals 1).

  Because it will simply look at ALL input pose weights, this method would require you to use separte poseDeformer nodes for each section of the body. For example if you did not, then if a pose for the leg was at 1.0 and a pose for the arm was also at 1.0, the deformer would simply normalize both to 0.5 and you would not end up getting a full pose for either even though technically they aren't overalapping.

  The Preferred mode is "RBF-LUFactorize". This is similar to normalize, but internally uses matrix math to properly drive up the closest pose and only blends in poses within a certain range of the current one. This makes the normalization much much more accurate and effective. The "avgPoseSepRBF" controls how close other poses have to be to blend in together. A small value means the poses will pop from one to another, larger values will be smoother, but too large means if you are on an exact pose, there is still a chance other ones will also be normalized in.

  The best technique is to set up your poses, you can even set the cone angles to full 180 degrees max if desired. Then set the RBF width just high enough to the point where you get smooth interpolation. Another trick with this is as a first first step, create a "pose" that is in the default shape with no point changes, and no joint motion. This way when you are back at the rest state, there is something there that the deformer can blend to that is actually the default pose.

  Note that once again since the RBF method is similar to the normalize mode, you will still need separate deformers for each part of the body.

- smoothMode lets you choose how the 0-1 weight from the poseReaders is used internally. A value of "Linear" means the actual weight of the pose is exactly as it is shown on the poseReader. A value of "SmoothStep" will cause the 0-1 to actually be a little smoother with more of an ease-in/ease-out type feel. This is the preferred value and works well when multiple poses have some overlap. The "Gaussian" version is another smooth mode but has very long ease-in/ease-out values, this the pose will appear to more quickly jump from an off to an on state since the transition time is less.

- The "isolate" attribute can be used for testing or seeing and editing specifically one exact pose. A value of 0 disables the feature. Setting it to any other value causes it internally set the weight of the pose at that index to 1.0 (on) and all other poses to 0.0, thus ignoring any poseReader weights. This way you can turn a specific pose on 100% to see it, modify it or just test it. Under normal circumstances this should be 0.

- You can use Edit Membership to limit the deformer calculation to only geometry needed. As of version 1.07, pose creation will ONLY look at points that are in membership. This can greatly speed up pose generation calcultion time.

- In addition to Edit Membership, you can also use the regular Component Editor to set the main deformer weights for the poseDeformer. You can also use the Attribute Paint Tool to actually paint in what points are supposed to be deformed by the poseDeformer.

If you are looking for more help, you can also check out a very nice page Matt Estela put together at:
http://www.tokeru.com/twiki/bin/view/Main/MayaRigging

Comet Cartoons - http://www.comet-cartoons.com/ - Michael B. Comet