Monday, September 27, 2010

Corrective shape keys

A common problem in rigging is that mesh deformation is ugly close to joints, especially in the shoulder, groin, elbow and knee areas. A popular solution is to use shape keys to correct the deformation. This idea was implemented in the MHX rig a long time ago, cf. http://sites.google.com/site/makehumandocs/blender-export-and-mhx/blender-export-and-mhx-249/body-shape-keys. However, I have been quite unhappy about the corrective shape keys for a long time, and recently came around to give them a complete overhaul.

To get good deformation is extra tricky for the MHX rig, because it needs to work not only for a single character, but for all characters that can be generated by MakeHuman. Eventually it should be possible to "bake" corrective shapes from pose engine data, but for the time being there is just one set of shapes, defined for the default character. To adapt the shapes to other characters, I now simply scale them with the size of the relevant limb. Here are some examples of bone deformation for different characters, without (red) and with (blue) corrective shape keys. We see that there are still some artefacts, especially for the toddler, but in my opinion deformation is better with than without the correction.







Blender has other means the deform a mesh. J P Bouza, of Blenrig fame, recommends using mesh deform rather than pure bone deformation. It does not seem practical to implement this for the MHX rig, since it requires a custom cage for each character. But if you are doing your own rigging, mesh deform is definitely something to look into.

Presently the corrective shape keys only work for the FK rig, due to a bug, or misfeature, in Blender 2.5. Namely, the rotational value of a bone is not updated when the bone moves due to constraints, so it can not drive the shape key. Thus, if we move an IK hand, the upper and lower arms move in the viewport, but their rotations are not updated and the corrective shape keys never kick in.

5 comments:

  1. Concerning Blenrig and meshdeform. Is it possible to use generated proxy as a cage? Or generate special proxies optimized for Blenrig?

    ReplyDelete
  2. The meshdeform cage must surround the mesh and have quite some distance to it, I think. The proxies cannot do that, because they fit snugly to the mesh like a skin. But it might be possible to construct some generalized proxy that keeps a distance to the mesh. One must make sure that no character can peek through his cage, though. This does not work yet, but it would be nice if it did, because it would also be useful for fitting clothes to the character.

    For the moment I have disabled the body shapekeys again and experiment with a pure bones setup. This does not work perfectly, but seems simpler to get to work with a wide range of characters.

    ReplyDelete
  3. Agreed. Shape keys are a last resort; they simply do not generalize. Could you update us on what become of the biomechanics that were part of MH .91? For example, the correct re-shaping of forearm muscles when the arm is flexed? That used to be *very* impressive.

    ReplyDelete
  4. The mh pose engine is under coding right now. But it's a different thing than the mhx exporter.

    ReplyDelete
  5. is there other way to solve this?

    ReplyDelete

© MHteam 2001-2010