Yet another way to avoid "optimize pose for IK", so that the figure is compatible with daz poses.

Issue #1459 resolved
Alessandro Padovani created an issue

daz studio 4.21.0.5, blender 3.4.1, diffeomorphic 1.7.0.1480

This is related to #498.

Until now we have a issue with some daz rest poses. That is, if the limbs are not bent enough then the IK may flip or bend in the wrong direction. So we use "optimize pose for IK" to avoid the issue, but this way the figure is no more compatible with daz poses and jcms because the rest pose is changed.

The key to this solution is to understand that the IK solver stores as "zero-IK" the pose of the armature when the IK constraint is enabled. This usually is the same as the rest pose, but doesn't need to.

note. This doesn’t seem documented, also because the documentation of the ik solver is actually incomplete. But I remember it from old blender docs.

https://docs.blender.org/manual/en/latest/animation/constraints/tracking/ik_solver.html

steps:

  1. Disable the IK constraints.
  2. In pose mode bend the IK bones (without keyframing), please note that FK bones don't need to be changed.
  3. Enable the IK constraints.

This works fine with Simple-IK and MHX. That is, using this method they don't need "optimize pose for IK", also the "hint" with limit rotation is no more necessary since we "zero-IK" the bone instead.

Actually I am not sure if we can apply this method to rigify. To pose the metarig doesn't seem to work as intended, and disabling the rigify IK constraints seems not possible they are locked somehow.

We could make "optimize pose for ik" an option for rigify only, since with the method above it is no more necessary for other rigs. Then we may remove the "ik fix" option for rigify since it doesn't work fine anyway, I mean it doesn't fix the inverted poles if the figure is not prebended.

Personally I believe rigify is strongly dependent on the metarig pose that essentially must be a prebended T-pose or close, it doesn't support the A-pose. The tutorial below is particularly well done and explains that the mesh must be in T-pose for rigify to work fine, that is a step skipped by most other tutorials.

https://www.youtube.com/watch?v=WpgDjKIxYOA&t=9s

Comments (21)

  1. Thomas Larsson repo owner

    Prebending is implemented in latest commit. The option is called “Improve IK”, perhaps it should be something with prebending in it. This basically makes the optimize pose for ik superfluous, so that button is deprecated and moved to the advanced rigging panel instead.

    As you said, prebending works very well for simple ik and mhx, less so for rigify. Therefore I added an optimize pose option for rigify, with the warning that poses will not be imported correctly.

    Rigify now has three ik options: Optimize pose, IK Fix (adds IK limits), and Improve IK (prebending). This seems a tad too much. Perhaps we should always add limits, or always do it with prebending. Or perhaps we should always add ik limits and prebend; I don’t see any obvious drawbacks with that.

  2. Thomas Larsson repo owner

    IK Fix and Improve IK are now combined into a single option. The question is if it should even be optional.

  3. Alessandro Padovani reporter

    May be I wasn’t clear. IK Fix (adds IK limits) doesn’t work you can remove it. Because it doesn’t fix the pole targets. So rigify always needs a metarig in prebended T-pose to work fine, at least in its full features with poles.

    Unless I miss something. Let me know. And thank you for the nice improvements, going to test it ..

  4. Alessandro Padovani reporter

    As for commit fe5d8d2.

    The “zero-IK“ trick works fine, I tested G8M that is notoriously problematic with the legs and he works great. A couple notes.

    1. remove ik limits. I see you use ik limits too that should be removed for two reasons. First they are not necessary for ik to work fine if we use the “zero-ik“ prebended pose. Second if the limb is already prebended as the G8M arms for example, then you can’t straight the arms if you have limits, this is also explained in #498.

    2. use X for IK arms and legs. Also the IK shin and forearm must always bend only for the X axis for IK to be reliable. The ZY lock has to be used for the FK bones too if there are FK bones to snap, so that FK and IK have the same limits for snapping.

    Below it’s the simple-ik example but the same applies to MHX that I didn’t test. Again unless I miss something. Let me know.

  5. Alessandro Padovani reporter

    update. rigify.

    Same for rigify, limit X is not needed with “zero-IK“ and has to be removed. Also, even with the “zero-IK“ prebend, the G8M poles are inverted because they depend on the metarig pose. So I fear rigify must always use “optimize pose for IK“ to get the poles working, at least for some figures as G8M.

    If we use rigify without poles though, that is entirely possible, then the rig works fine enough. So we could leave it as an option with a warning.

    • tool: Optimize Pose for IK
    • tooltip: “This may be necessary for some figures if the rest pose is not prebended correctly for rigify to work, but it is incompatible with daz poses.”

  6. Thomas Larsson repo owner

    Now Y and Z are locked and IK locked, and IK limits are removed. I also removed the option.

  7. Alessandro Padovani reporter

    update. important. rigify.

    I forgot we now have “subtract rest pose“ with #1445, so I guess prebending with “optimize pose for ik“ should be OK if we subtract the rest pose. But for some reason it doesn’t seem to work fine. Below an example with kneeling-b where the legs get “crossed“.

    steps:

    1. import G8F, with or without “daz orientation“ in global settings it doesn’t matter the result is the same
    2. convert to rigify with “optimize pose for ik“
    3. load kneeling-b with “subtract rest pose“

  8. Thomas Larsson repo owner

    The rotation in rest pose is given by a custom property, which I forgot to update when the optimized rest pose is applied. It is a bit messy because the rest rotation is given in the DS axes, so I will address this later.

  9. Alessandro Padovani reporter

    As for commit 08d93cc. Apart the issue with “subtract rest pose“, seems all fine but a note for rigify.

    minor bug. rigify. I see the option for “improve ik“ is removed and makes sense to always use it. But for rigify, if we “optimize pose for ik“, then it is not needed to also “improve ik“ because the bones are already prebended. This shouldn’t harm the ik bones are just prebended twice, but it is not necessary.

    note. may be keep “improve ik” option ? On second though “improve ik“ may be useful as an option. That is, if we import prebended figures as #1445, then there’s no need for “improve ik“. Again it shouldn’t harm the ik bones are just prebended twice. Unless prebending +25 exceeds 90 degrees. To better deal with prebended figures may be we could use a minor angle as 15 instead of 25, or let the user decide the angle, with 15 as default.

    • Improve IK (with angle default 15): stabilize ik by assigning a prebending angle to ik bones, this is not necessary for prebended figures.
    • Optimize Pose for IK (rigify only): stabilize ik by prebending the figure as for rigify requirements.

  10. CookItOff

    What I do so as to never need to use Optimize Pose for Rigify is adjust the limbs inside Daz so the model will import into Blender with the proper stance.

    In Daz I have actually saved single a custom pose to apply to all my characters before exporting. The pose turns feet and knees forward (by rotating the upper leg), closes the distance in leg spread to make the legs match a T-Pose (rotate upper leg), and then it moves the feet slightly in front of the hips CoG (rotate upper leg), while correcting the shin angle too (rotate lower leg).

    If you don’t want to save a pose preset and perform this manually for each character make sure you use Symmetry with Recursive checked to save time.

    Just want to add that I hope nothing gets added to auto adjust rigs for rigify without the user selecting that option. I think it should be a choice.

    Tim

  11. CookItOff

    I want to note that the new version moves the knees and elbows (it pre-bends) of my character after converting to Rigify even when Optimize Pose is unchecked.

    Please don’t make Pre-Bending a requirement. I want my character to stay in the exact position that I import it in from Daz, as I make all necessary adjustments in Daz before exporting, as I listed in my post above.

    Thanks

  12. Alessandro Padovani reporter

    What you do in daz studio to prebend the figure is what “optimize pose for ik“ does there’s no substantial difference. If you don’t “optimize for ik“ the new version doesn’t prebend anything but you will see some effect because the ik angle is 25 degrees so it affects the posture a bit. A smaller 15 angle as I suggested will be less visible. Anyway this is not prebending but just the ik working, if you pull the leg it can straight well.

    I appreciate you want to help but please try to keep this report clean. Unless there’s some bug to report or some clever ideas. Thank you.

    p.s. If you can please remove the nude picture it is not necessary to describe your point. This tracker is not age restricted there may be children around.

  13. CookItOff

    I’m responding because the new version causes the knees and elbows to move from their original place on top of my original import. This doesn't match with the imported mesh.

    I want to adjust the character's posture how I see fit in Daz and I don’t want to use a generic posture applied later in Blender. That’s why I never used “optimize pose for IK”. I want to decide what is correct for my characters.

    If you want a generic base pose before converting to rigify that’s fine. I’m adding to this thread to say it should be an option.

  14. KD

    I agree, kindly make this optional. I have developed a whole workflow for:

    1. Adjusting pose in DAZ before exporting, to make rigify work well.
    2. Also developed a couple of tweak poses in Blender to apply on top of DAZ poses to make DAZ poses work with the pre-bended character in rigify.

    The new commit, which forces modification of the skeleton in blender when invoking rigify, completely undermines all the previous workflow. Again, please make this optional so that those who know how to pre-bend in DAZ can just rigify in blender without seeing the character shape and pose modified by the process.

    There are implications for dynamic clothing which is pre-draped and set up before converting to rigify, and various other problems which arise. Please make the pose modification optional.

    Thanks for all the hard work.

  15. Thomas Larsson repo owner

    Prebending doesn’t change the rest pose; it rotates the ik bones in pose mode, but it shouldn’t be visible because the pose is overridden by the ik constraint. Optimize for IK does change the rest pose, but that has always been optional. It is now turned off by default, also because I didn’t manage to fix the pose import problem noticed above.

    That said, making prebending optional is straightforward, so the Improve IK option is back.

  16. Alessandro Padovani reporter

    Commit 53b5ca1.

    rigify stretching. As reported in #1464, the “improve ik“ option causes some limb stretching with rigify. As I understand it this depends on how rigify is designed with stretching limbs. I tried to turn off the stretching features in the control panel but doesn’t seem to fix it.

    One way to minimize this effect is to use a small angle for the rigify ik prebend, as 5 degrees for example, that is small but enough to “tip“ the ik in the right direction. Anyway as noted above “improve ik“ is not so good for rigify because it doesn’t fix the poles. The rigify rig requires “optimize pose for ik“ for the full features to work fine.

    I also agree to have “improve ik“ optional so that we can turn it off for prebended figures.

    note. about prebending in daz studio. As noted by @KD, prebending a rigify compatible rest pose in daz studio is another way to work with rigify, this will require to use “subtract rest pose“ when loading a daz pose. But the jcms will not work fine in this case because the figure is prebended, so anyway there’s some side effect.

  17. Thomas Larsson repo owner

    JCMs don’t work perfectly with neither Rigify nor MHX anyway, because the bend and twist bones are forced to be aligned. The difference should be small, provided that Reuse Bend and Twist Bones is enabled. Btw, the tooltip for that option is wrong, only the vertex groups are reused, the bone locations are changed.

  18. Alessandro Padovani reporter

    Yes, but when we prebend in daz studio we add the rig “small difference“ to the other “small difference” that the daz deformations are baked, so we get twice the “small difference“.

  19. Log in to comment