Skip to content

Optional IK control for limbs.super_finger #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: mad_master
Choose a base branch
from

Conversation

angavrilov
Copy link

I wanted to learn rigify code base better, so I decided to try adding a somewhat involved but not very big feature. Since BlenRig has IK support for fingers, I thought implementing this may be a good exercise. I also did some tweaks in the finger code.

Since finger IK would be useful only for certain situations, and there are 10 fingers, I tried to implement this using as few new bones as possible; specifically, unlike with limbs, IK is applied as a correction to the FK shape. Thus there is only one new control, and two internal bones for switchable follow parent.

Bone relation diagram with IK: https://www.dropbox.com/s/4ca5bbskscysuuh/rigify-new-finger4.svg?dl=0

These bones are used to attach sub-rigs, so they should also
be moved in sensible way. Although it is very unlikely that
fingers would have children, it's no reason to just break it.
@eigen-value
Copy link
Owner

Hi @angavrilov !
Thank you for the PR... I'm very happy you want to contribute!

We've been checking the code here @MadEntertainment and we have some comments:

  • The ik control on the fingertip should not have a sphere wdgt because it can be confused with tweaks
  • The 'IK parent bone:' ui textbox should work as a prop_search
  • A rotational pole ctrl is advisable to rotate the IK (same as the arrow ctrl on the limbs ik). Using master to rotate both the fk and the ik is confusing
  • Isolating the tweak layers code with the layout_layer_selection_ui function is a wonderful idea (rigify has an huge legacy code problem), but it's better not to change the code to all the limbs at once, since this PR branch pertains to super_finger. Besides, if you check the new_rig_base_classes branch I tried to implement a similar behaviour with a separate helper class (ControlLayersGenerator)
  • The IK/FK driver is inverted (it should be 0.0=IK 1.0=FK)
  • The IK is missing a stretch
  • I really like the Bone relation diagram!!! How did you do it?

@angavrilov
Copy link
Author

The ik control on the fingertip should not have a sphere wdgt because it can be confused with tweaks

In limbs.super_finger (i.e. the more complicated style finger with a scaling master control) the individual bone controls use the circle widget, and it doesn't have any other kind of 'tweaks'. Sphere widget is also what BlenRig uses.

A rotational pole ctrl is advisable to rotate the IK (same as the arrow ctrl on the limbs ik). Using master to rotate both the fk and the ik is confusing
The IK is missing a stretch

Remember that this is fingers what we are talking about. In my understanding IK is mainly useful for holding something, or onto something with some play between the object and the hand, where you otherwise would have to adjust all of the fingers manually to avoid unnatural slipping.

Thus, for one, fingers have 3 bones so just a pole is not enough. You probably want to be able to define the base grip exactly and only have the IK adjust it. Building IK on top of FK allows using all of the FK controls to specify the base shape.

The second concern is that since finger IK is a special case use, building a complicated IK rig that would be duplicated 10 times is not really justified in my opinion. In BlenRig, which I used as an inspiration, the IK constraint is simply slapped onto the user-accessible FK control bones.

Besides, if you check the new_rig_base_classes branch I tried to implement a similar behaviour with a separate helper class (ControlLayersGenerator)

Well, I based it on the master branch because I have no idea when that branch would be merged, and whether it is even stable to be used at all ;)

I really like the Bone relation diagram!!! How did you do it?

This awfully ugly script I hacked together ages ago in order to be able to view how rigs are put together: https://github.com/angavrilov/blender-scripts/blob/master/armature_map.py

The fact that blender doesn't have any easy way to follow links between bones in constraints, parents and so on as if they were hyperlinks makes it really hard to understand what's going on without a map...

I.e. make ORG bones follow the user-specified rotation fully,
so that IK constraint sees it as-is too.
@angavrilov
Copy link
Author

Used prop_search, inverted IK_FK, split applying layout_layer_selection_ui to non-fingers into a different commit so it can be handled separately.

BlenRig has this feature, so Rigify was behind in this aspect.

Since this is a feature for specific situations, which applies
to 10 fingers if enabled, it is implemented in a lightweight
way using the minimal number of new bones; specifically, IK
is applied to the result of regular FK transformation, so
existing FK bones can be used to tweak the shape.

Another effect of that is that when IK is off, FK->IK snap
simply normalizes the finger by absorbing as much of rotation
as possible into the master control. This makes the operation
useful even if IK is not used or even generated.

For IK follow parent, it makes zero sense to follow the palm
bones, so the rig has an option for explicitly specifying the
parent bone. Natural choices are the hand, or a separate utility
bone for something held in the hand, if the metarig has it.
Using names like 'f_ring.01_master.L' is somewhat silly,
and 'f_ring.01.L.001' for the tip control is outright bad.
This changes those to 'f_ring.master.L' etc.
@angavrilov
Copy link
Author

About IK stretch, I can't find a way to implement a good stretch without adding more bones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants