important fix for rigify (how to avoid pose for ik)

Issue #498 closed
Alessandro Padovani created an issue

This is related to #495. We know we have to use "optimize pose for ik" for rigify to work fine, otherwise we get bad bendings where the leg bends forward like an alien. But "optimize pose for ik" is incompatible both with daz poses and jcms, because it changes the rest pose, so we shouldn't really use it for daz figures.

I decided to give a look at rigify to see if it is possible to fix this issue, and luckily the solution seems easy. We have to enter the ik layer and set the rotation limits for the shin bones. This way ik will work fine.

One caveat though. At first I thought to copy the limits from the daz figure, that's bend = (-11,155) for G8 for example. But doing so strange things happen and the legs compress and stretch around like rubber by moving the ik controls. This seems due to the -11 min value like rigify doesn't like negative values. So I used fixed limits instead that should be fine for any figure, that's bend = (0,160) and this seems to work fine.

MCH-shin_ik.L = limit x(0,160)
MCH-shin_ik.R = limit x(0,160)

I hope it is possible for the plugin to do this, and if so provide an option in the rigify panel instead of "optimize pose for ik". We could name it “Set shin limits” with a tip “Shin limit fix for ik rotation.“. Then I don’t know if “optimize pose for ik” is better to be removed, though it is already strongly warned. I'm not sure if it can be useful in any way.

Then if it is not possible for the plugin to modify the rigify limits, a quick tutorial in the docs or in the blog may be enough.

Comments (17)

  1. Alessandro Padovani reporter

    Thomas as a side note if you may fix the colors for the custom bones in rigify, same as mhx #492. Because black is not good in shaded wire. May be we could use orange or yellow the same as the extra or special bone groups.

  2. Thomas Larsson repo owner

    Fixed in last commit. I added limits to the ik forearms too, even if it is probably unnecessary. Doesn’t seem to hurt,though.

    An new DAZ bonegroup is added, which orange bones.

  3. Alessandro Padovani reporter

    commit d813cc6

    Nope, unfortunately adding limits where not necessary does hurt. Essentially, the reason why we add limits is because the limb is not prebended. If we add limits in a prebended limb then they prevent the limb to go straight when we may stretch it for a pose, that’s not a good thing. The more the limb is prebended the more the angle is visible.

    Then we could set negative limits for a prebended limb. For example the G8F arm may go from -10 to 150, instead of 0 to 160, and I see that it works fine. While if we set -10 on the G8F leg that’s not prebended then we get the “rubber” effect. But there’s really no reason to set limits for a prebended limb since it works fine already.

    So in general we must set limits only for not prebended limbs and this depends on the figure. Luckily for us all the genesis figures seem to have prebended arms and not prebended legs, so we can set 0 to 160 for the legs. But still this depends on the figure. Suppose that genesis 9 will come out with prebended legs the limits will be not necessary and not to be set.

  4. Alessandro Padovani reporter

    As a side note we may remove the “pose for ik” option for easy import since it is no more necessary and it’s bad if used. Especially since easy import is targeted at newbies.

    Then let’s hope that daz animals all have prebended limbs. Otherwise setting limits by hand may be necessary, unless Thomas you may find an “automatic” way .. But then we don’t know if the animal bends forward or backward since this depends on the animal so I guess an automatic way is not possible in this case. I mean, if we do have rigify for animals too ? Never tested it.

  5. Alessandro Padovani reporter

    As for commit b1bc240 “pose for ik” is not removed from easy import. Please let me know if this is on purpose (and if so I’d just be curious why) so I’ll mark as resolved.

  6. Thomas Larsson repo owner

    The optimize option has been removed in last commit. The button remains, but it shouldn’t be an option for easy import if it is not meant to be used often.

    I also implemented the same trick for mhx and simple ik, and removed the hint constraints which should now be unnecessary from mhx. But it turned out that the ik limits were already set (slightly differently) for mhx, to be the same as the limit rotation constraints for the original rig.

  7. Alessandro Padovani reporter

    update. important. Sorry this is my fault since I only tested female figures.

    With #620 it is reported that the "ik fix" is not always enough so we may have to prebend with "optimize pose for ik" depending on the figure. For example if we don't prebend then G8M doesn't work and he also gets inverted poles that's a clue that rigify can't deal with the G8M default rest pose.

    Please note that "ik fix" doesn't harm anyway but it is not enough if the rest pose gets a negative bend as in the G8M case, where the knee gets a negative angle. One way to fix this is to go to edit mode and move slightly forward the knee joint. This way when we convert to rigify it works fine.

    Please note that the jcm will not produce the exact same deformation since we moved a little the joint center. But we didn't rotate the legs geometry as "optimize pose for ik" does, so this may be an alternative way to make ik work fine with rigify.

    ik fixes for rigify:

    1. Optimize pose for ik: this always works but it is incompatible with daz poses and jcms.
    2. Optimize joint limits for ik: that's the actual "ik fix", this is compatible with daz poses and jcms but it is not always enough depending on the figure.
    3. Optimize joint center for ik: that's as suggested above, should be better than "optimize pose for ik" because it doesn’t modify the figure geometry.

  8. Thomas Larsson repo owner

    You can also use the Connect IK Chains tool with Location = Parent Tail. Convert to Rigify also connects the ik chains, but at the child head, so running this tool first changes the location of the knee. But I don’t think it should be integrated with Rigify.

  9. Alessandro Padovani reporter

    The only thing that’s possible to do, if we want to, is to fix rigify on a per figure basis. That is, use “optimize joint limits“ first, then “optimize joint center“ if necessary. The reason why “optimize joint center“ is better is because it makes less changes than “optimize pose for ik“, so poses are more compatible. It is easy enough to fix the knee in edit mode if necessary, so a note in the docs or in the blog could also be enough without adding another tool.

    Below an example with “base pose sitting b” for G8M that’s a good test for legs poses. First daz then “optimize pose for ik“ then “optimize joint center“.

  10. Thomas Larsson repo owner

    Connect IK chains achieves a similar result. The bones are moved in edit mode, so the meshes are not affected, but instead of moving the shin head 1 cm forward it is moved to the thigh tail. But if you really want to move the shin head horizontally, it is easy enough to do so in edit mode, so I don’t think you need another option for that.

    Note that rigification will always connect the shin to the thigh; it is a rigify requirement.

  11. Log in to comment