ERC Armature ignores IK

Issue #1894 resolved
Maneki created an issue

In older versions, ERC Armature has affected legs and hands with IK activated but it seems to get completely ignored now.
I assume changes to simple IK caused it? This issue seems to apply only to ERC Armature, it seems to work in ERC Translation but I want to mention that IK controllers don’t shift together with the morph with ERC Translation, but they do with ERC Armature. Would this be fixable?

Edit: It works for the legs, but not for the hand

Comments (29)

  1. Alessandro Padovani

    As I understand it, ERCs are not designed to work together with IK, they are provided for the daz FK rig. Or I find it difficult to imagine that a IK chain could work fine while a ERC is modifying the rest pose or the bones position.

    Thomas let us know what you think.

    p.s. I understand it is basically the same reason why IK can’t work with body morphs.

  2. Thomas Larsson repo owner

    I don’t think it ever worked, neither for arms nor legs, at least not for G3 and G8. AFAIU, ERC translation cannot work for the following reason. The world translation for the shin bone is the sum of the local translations for thighBend, thighTwist, and shin. However, the ik chain only consists of two bones. The local translation for ik thigh is the same as thighBend, but if the local ik shin translation is the same as for shin, the world translation is missing the thighTwist part.

    However, making ERC armature work with ik should be possible, because here we deal with offsets in world space. I have implemented that for simple ik in last commit, although it is not accurate for pole targets and the reverse foot. The problem here is how to extend the offsets to control bones that aren’t aligned with the deform bones. Nevertheless, I think the result is decent with simple ik.

  3. Maneki reporter

    I’m 99,99% sure it worked for both, feet and hands in the past because I used it. Anyway, I’m gonna test and see if potentially fixable issues pop up, thanks for implementing Thomas.

  4. Maneki reporter

    It doesn’t seem to work, the hands still translate with the rest of the body?

    Edit: It works in pose mode, but when I keyframe the position of the IK controllers of the hands, the animation still makes the hands translate with the rest of the body outside of pose mode. Like I said, I’m very certain that this worked in the past.

  5. Thomas Larsson repo owner

    OK, I found where the ik bones' movement came from. The script that morphs armatures added an offset to the IK hands which is the same as the FK hands. That is now removed, and the offsets are stored in the IK bones instead.

    When you generate simple ik, there is a new option that determines if the ik hands and heels are affected by erc morphs. If not, the ik hands will stay fixed in space when you morph the armature, but there may be unwanted distortion because the ik hands are not at the same place as the fk hands in rest pose.

    Under the hood the offsets are stored as custom variables HdOffset and TlOffset for each bone that is morphed.

  6. Maneki reporter

    I tested the new commit. It semi works with ERC Translate but it doesn’t work with ERC Armature in case of the hands.

    EDIT: Nvm, I thought I have to activate the new option to make IK pin limbs, my fault, sorry. It seems to work now, thank you. I’m going to test it thoroughly

  7. Thomas Larsson repo owner

    Some improvements in last commits. Now all bones in the reverse foot are either affected by erc morphs or not. IK bones are always pinned for ERC translation, because the ik and fk hands and feet have different parents and thus local translations are different globally.

    I also noticed that ERC translation makes the hip stuck, because the location is driven by the erc morph. If you load the morphs with Import DAZ Favorites, it therefore makes bones posable by default. However, bones with locked location are ignored, because they are not meant to be translated anyway.

  8. Maneki reporter

    I noticed that ERC Translate has issues with the root offset. Is that a limitation or fixable?

  9. Thomas Larsson repo owner

    The erc morphs drive the bone locations, in particular for the hip. Thus the hip will not move unless you make all bones posable after the erc morphs have been loaded.

    That tool now has an option to ignore bones with location locks, so extra bones are only created for bones that can be translated, i.e. hip and face bones. Bones with rotation drivers are also made posable and appear in the hidden collection.

  10. Maneki reporter

    The issue with ERC and IK for ERC Armature still seems to prevail. The difference between the old daz importer versions and the newe dev one is significant. I did a test with one of the newest dev versions and one with the stable 1.6.2 release. Like I mentioned, I’m pretty sure it worked in older versions and the test confirms it. I made a video for each the old and the new daz importer versions: https://mega.nz/folder/YZ5SFSqZ#X5qLEWClvHJ7hP4ML-SMlA

  11. Thomas Larsson repo owner

    Did you try to uncheck the ERC Morphs Affect IK option when simple ik was generated? That makes the ik goals stay in place when you morph the armature. Unfortunately it also leads to weird deformation of the forearms because of how the ik chain is set up, but that is inevitable I think. If the shoulder is morphed and the hand is not, something inbetween must yield. It might be ok for limited morphs.

  12. Maneki reporter

    Yes I did. Isn’t it possible to restore the old IK+ERC behaviour? With the new simple IK rig it seems like the IK controller is a separate entity from the hand bone while in the 1.6.2 version it looks more like the IK controller forces the hand bone in place where the IK controller is.

  13. Maneki reporter

    In this test here I moved the hands a bit inward and up and transitioning from a base G9 shape to something bigger. The IK controllers are extremely disconnected from the hand bone and vice versa. It wasn’t like this in 1.6.2.

  14. Alessandro Padovani

    Again, as I understand it, ERCs can’t work with IK. Then Thomas is trying to fit it better but in the general case a IK chain can’t have animated bone positions, because the bone positions influence the chain stability. For example in the leg we need prebended knees to avoid flipping, animating the position will break that.

    Personally I’d state that ERCs can’t be used with IK and close this as invalid.

  15. Maneki reporter

    @Alessandro Padovani did you guys take a look at the clips I created of 1.6.2 and 1.7.3+? It worked kinda well in older versions. I’m confused about you guys saying that it’s somewhat impossible when it already worked.

  16. Thomas Larsson repo owner

    I think what changed is not how morphing armatures work, but the setup of the simple ik. In the last commit I changed the constraints for bend and twist bones. Before they had local copy rotation constraints in XZ and Y, respectively, but that didn’t work at all with morphing armatures. I had also noticed other problems with such a setup, at least in the mhx rig, which I believe are mathematically related to gimbal lock. Now the bend bone gets a damped track constraint and the twist a copy rotation in world space. This seems to improve ik for morphing armatures a lot.

  17. Alessandro Padovani

    Maneki, mine are personal considerations based on my understanding and experience, then Thomas knows much more about rigging. I don’t use ERCs or MHX myself I do my own rigs.

  18. Thomas Larsson repo owner

    That the twist bones had copy rotation constraints in world space didn’t work out, so I changed back to local space and only Y rotation. Now I think that it works ok. The arms bend at the elbows, because the fk and ik bones are not located at the same place anymore, but there is no bending in the middle of the bones. Here is the left arm, in edit and pose mode. The ik goal doesn’t move when we morph the armature, so the hand should stay put.

  19. Maneki reporter

    From the quick tests I did, the hands seem to be pretty much locked in place now but the feet still have the same issue. It’s especially noticeable when the character lays with the feet planted on the ground or probably just generally a pose which alters the location of the feet but still have them on the floor.

  20. Thomas Larsson repo owner

    I changed the constraints on the hands and feet to copy transform instead of copy rotation. That puts the deform bones at the same location as the ik goals. However, there is still some movement, because the deform bones are still affected by erc morphs, even if the ik goals are not.

  21. Maneki reporter

    The legs seem to be more fixated now but they face a similar if not the same issue like the forearms previously, where they curve out/in. The feet also rotate heavily instead of adjusting their position accordingly. Usually I would expect the shin bones and the thigh bones to reduce their angle to each other, when the character becomes bigger, to compensate for the bigger distance to the feet within the IK chain.

  22. Thomas Larsson repo owner

    In the last commit I changed the shin constraint from copy rotation to copy transform. That should translate the shin to lie on the line between the thigh and the foot.

  23. Maneki reporter

    The bending is gone now and the hands and feet seem to be mostly fixated. It still has some issues with reverse foot IK and the toes, because the toes are rotation locked and it results in deformation. I can manually adjust that one by deactivating toe IK manually if there’s no fix available. The one thing which still bothers me are the feet rotating heavily outwards. I can adjust that one manually but if it’s somehow fixable it’d be really appreciated.

  24. Alessandro Padovani

    Though personally I still believe that ERC is incompatible with IK, Thomas did his best to fit it. Marking as resolved.

  25. Log in to comment