Saturday, April 22, 2023

Finger IK and Tongue IK

The MHX rig can generate IK controls for the fingers and the tongue, but those controls were very difficult to work with and next to useless. Moreover, they caused dependency loops if the character has morphs that affect the fingers and tongue. Recently Alessandro suggested a better way to implement IK for the tongue, using stretch-to constraints, and then I implemented the same mechanism for the fingers. This is not strictly speaking IK since no IK constraints are involved, but it allows the user to place the joints precisely, and we will still refer to it as finger IK and tongue IK.

To generate the IK joints, we enable the Finger IK and Tongue IK options when the MHX rig is generated.

The IK influence is governed by the Tongue IK and (left and right) Finger IK sliders in the Properties panel.

As with IK for the arms and legs, finger IK is primarily useful when the character interacts with some other object, and we need to place the finger joints precisely relative to that object. E.g., assume that we want to grab a ball. We could proceed as follows:

  1. Place the IK hand in position.
  2. Pose the long finger bones so they grab the ball.
  3. Snap the IK finger joints to the location of the finger bones.
  4. Tweak the joints so the fingers grab the ball perfectly.
  5. Optionally snap the FK finger bones, e.g. if we want to export a pose preset back to DAZ Studio.
First step: Move the hand into position.
Rotate the long finger bones so the fingers touch the ball.
Snap the left finger joints to the location of the finger bones.
The long finger bones are hidden and the finger joints are shown instead.
We now tweak the joints so the fingers touch the ball perfectly. Depending on your ambition, this may involve a lot of manual work.
We can now snap the finger bones to the location of the joints. This is not necessary if you only want to render the scene in Blender, but can be useful anyway.
Typically, the finger bones are not only rotated but also scaled.
Tongue IK works in a very similar fashion. Here we have posed Aiko's tongue using morphs.
Snap the tongue joints.
We can now pose the tongue with the joints. Note that the morphs are no longer necessary and can be cleared.
The snap fingers buttons are still present even if the MHX rig doesn't have finger IK, because they can also be used to move a pose from the long finger bones to the individual links. In the picture to the left above, we have posed the fingers with the long fingers. After snapping, the long fingers are cleared but the hand pose remains the same, because now the finger bones are rotated instead.
There are also buttons for snapping the spine and neck/head. Above they were posed with the back and neckhead bones, but after snapping the individual bones have rotations instead.