some improvements for simple ik

Issue #1708 resolved
Alessandro Padovani created an issue

diffeomorphic 1.7.2.1767

Here's a couple of improvements for simple ik, example included simple-ik-r2.blend.

1. reverse foot. I added a simple reverse foot to simplify animation especially with heels. This setup is easy to do by just copying some bones of the daz rig, so it should also be easy to automate.

note. The user may have to tweak the heel position to perfectly match the shoes, since we can’t know that so the initial pivot is approximated with the metatarsal head.

# simple ik reverse foot
duplicate foot to foot.ik
duplicate toe to toe.ik
duplicate tarsal to tarsal.ik then switch direction then connect to toe.ik
duplicate tarsal to heel.ik then flat to ground
parent toe.ik to heel.ik
parent foot.ik to tarsal.ik to heel.ik to root
copy rotation from foot.ik to foot
copy rotation from toe.ik to toe

2. forearm twist. Then I improved the automatic twist of the forearm. Here the trick is to first copy rotation to align the axes, then use dumped track on y. The old way with copy rotation on y tended to flip on extreme values, while this new method is rock solid.

3. bone shapes. I believe there's no need to have lots of custom shapes for the simple rig. I just used some empties for all the shapes. A few bones need some scaling but most of them are default empties, please have a look how I used them. This has the advantage that the scene is not cluttered with shapes. I also changed the color sets to default colors which are more consistent with the blender selections.

Comments (20)

  1. Alessandro Padovani reporter

    4. option for snap (aka portable rig). If possible, it would be useful to have an option for snap. I mean snap is good and all, but it requires the runtime. If we get rid of snap then it is possible to create a rig that doesn’t require the runtime, thus portable and redistributable everywhere with blender alone, that’s not a minor feature. Personally I don’t use snap I only work with ik.

    note. A “ik only” rig will not work to import daz poses, for that we need snap, so this is the price for a portable rig. But we can export a daz pose to the asset browser, same as below for expressions, that will work with the ik rig.

    steps:

    1. Load the daz pose with the snap rig.
    2. Switch to ik, select the ik bones, and save as pose asset. The saved asset will work with the ik rig.

    5. export category to pose library (always for portable rig). The runtime is still needed for face expressions, but we can easily save them as poses in the asset browser. That also has the benefit that we can mix visemes and expressions, for example to get the figure talking while in the rage expression, that’s not possible with morphs.

    The addon already has “import pose library“ allowing to convert a daz pose set into a blender pose library. It would be handy to have a similar tool “export category to pose library“ to save a pose library out of a morph category, for example expressions and visemes. We can easily save pose assets out of morphs by hand so I guess this can be automated.

    Once we export the category we can delete it and use the pose library instead.

    steps:

    1. Go to pose mode.
    2. Set the morph we want to save as pose asset.
    3. Select the bones affected by the morph that we want to export, I’ll select only mouth bones for the visemes for example.
    4. Make sure the asset browser is in “current file” and do “asset > create pose asset”. The active camera will be used as preview.

  2. Alessandro Padovani reporter

    Commit 16916f3.

    This doesn’t work as expected it’s a different setup than what I proposed above. If that’s on purpose then it doesn’t work too well as reverse foot in my opinion.

    1. heel. The foot doesn’t pivot around the heel, that’s the whole purpose of the heel.ik bone, it needs to be flipped.
    2. toe. Both toe.ik and the tarsal.ik are reversed, this way they both serve the same purpose of reversing the foot, and we lose control on the toe. In my setup only the tarsal is reversed and the toe we use as usual.
    3. foot layers. The fk toes are left in the foot layer, and of course they do nothing and can’t move. They should be removed if we use the reverse foot since we use toe.ik instead.
    4. quaternions and locks. I see all bones in the reverse foot are quaternions and not locked. We could use a free quaternion for the heel since it’s the main controller, but others should be euler with rotation x. Then if we use quaternion for the heel it makes sense to use quaternion for the hands too, that would be good in my opinion.
    5. octahedral. The armature is in octahedral mode, not good if we use poles unless we remove the link bones.

    Let me know what you think of the other improvements I proposed above. The snap option is needed, while all the other points can be done by hand, though some automation would be good to have.

  3. Alessandro Padovani reporter

    Commit ba6966e is fine for the reverse foot, thank you for the fix.

    Let me know what you think for the other points. At least point 2 “forearm twist” is to be fixed otherwise the twist is not stable, let me know if something is not clear.

  4. Thomas Larsson repo owner

    Implemented the forearm twist constraints in the last commit. I also changed the constraints for shldr and thigh twist to a full copy rotation constraint in pose space, instead of just copying the Y axis. The X and Z copies should be redundant, but leaving out some axes in a copy rotation constraint is tricky and can lead to strange behaviour. The bend bones does local copy rotation of X and Z only. I haven’t seen any problems yet but I’m not sure if this is safe. Mhx uses damped track constraints towards the elbow and knee instead.

  5. Thomas Larsson repo owner

    I am not sure that your reverse foot setup is optimal. Mhx uses a setup with reverse bones for both foot and toe. This allows the foot to bend around all three pivots, heel, sole and toe. Your setup leads to problems when animating a ballerina dancing on her toes, since the toe tip is not a pivot point. AFAIU, you have to both rotate the heel, and to translate it to make sure that the toes touch the floor at all frames.

    But anyway, I’m using mhx myself so it isn’t a problem for me.

  6. Alessandro Padovani reporter

    Commit 235b2ba is fine for the forearm twist, thank you for the fix.

    As for the reverse foot I agree it’s not optimal for a “ballerina” setup, but I like this because it’s simple to make and easy to use, plus most of us don’t dance/walk on toe tips, so having a forward control on toes is most effective for the common case.

    bug. XYZ on twist bones. As for copying XYZ on twist bones, well, by definition twist bones can’t use XZ, othewise they’re not twist bones. What you say about copying only Y is true in general, but in this case copying only Y is safe because we have the IK bone in the same direction, it’s the same that G9 does with parented twist bones, it’s the same I do in #1709 to decouple bend and twist from G2 to G8. This works fine, please set it back.

    bug. quaternion drivers. Please see #1709 we need to fix the bug in the quaternion drivers, otherwise deformations and jcms don’t work fine. This affects any rig, daz rigify mhx and simple ik.

  7. Alessandro Padovani reporter

    Commit 899d72a.

    The twist bones and quaternion drivers are fine, thank you for the fix.

    bug. G9 error. I get an error if I try to make simple ik for G9 with reverse foot.

    steps:

    1. import G9
    2. convert to simple ik with reverse foot

    note. heel pivot. This is a minor but important detail. The heel shape should have the pivot at the bottom, because it will be the pivot point for heels. Again, as noted in point 3 it is not necessary to use so many custom shapes for the simple rig, we could just use a couple of empties, not scaled to bone length, and eventually adjusted a bit for relevant bones, as in the provided example scene simple-ik-r2.blend.

    Note that I used empties already sized to 0.05 radius, so I don’t need to scale them in most cases, and they also “look better“ in the scene if we unhide them. Just three empties do everything.

    note. Y on twist bones (aka rotation order). This is not a bug, since when we copy a single axis the rotation order is not relevant, but with euler it is a good habit to specify it, especially if we copy from quaternions. In the original setup it was specified before the new commit.

    p.s. Default means the rotation order of the owner, so when the owner and the target have the same order then default is good, otherwise we may get different rotations depending on the order and the used axes.

    https://docs.blender.org/manual/en/latest/animation/constraints/transform/copy_rotation.html

  8. Alessandro Padovani reporter

    note. world space vs pose space.

    Again not a bug but important as concept. In general there’s no use for world space in a rig. When we copy transforms among bones we can use either local or pose space, depending if we want a relative or absolute pose. We use world space if we want a absolute pose relative to another armature or object in the scene. Then world space works fine instead of pose space, but pose space is more precise for example if the armature is far away from the scene origin.

    We should use pose space unless world space is necessary. For example below there’s G9 using world space to copy the ik rotation, that should be pose space.

    • world space. relative to scene origin (refers to other armatures or objects in the scene)
    • pose space. relative to armature object (refers to other bones in the armature)

  9. Alessandro Padovani reporter

    reverse foot for G9

    Since G9 gets driven metatarsals, I left them alone and copied bones from foot. Apart this the setup is the same. Example scene included g9-revfoot.blend. Again note that I used a single empty “cs cube“ for all the custom shapes. Also the heel shape gets the pivot at the bottom.

    steps:

    1. duplicate foot to foot.ik
    2. duplicate toe to toe.ik
    3. duplicate foot to tarsal.ik then switch direction then connect to toe.ik
    4. duplicate foot to heel.ik then flat to ground
    5. parent toe.ik to heel.ik
    6. parent foot.ik to tarsal.ik to heel.ik to root
    7. copy rotation from foot.ik to foot
    8. copy rotation from toe.ik to toe

  10. Alessandro Padovani reporter

    note. rev-foot-ik. I see in the reverse foot setup you use rev-foot-ik copied to foot-ik. This is an unnecessary complication, you can delete rev-foot-ik and use foot-ik directly. See my example setup.

  11. Thomas Larsson repo owner

    Most of the issues have been fixed. I didn’t have a look at the custom shapes yet.

  12. Alessandro Padovani reporter

    Commit 6ef1f15.

    G9 works fine, thank you for the fix.

    bug. G8. But now I get an error for G8.

    steps:

    1. import G8F
    2. convert to simple ik

    note. shapes. The heel doesn’t get the pivot at bottom, but since you didn’t look at shapes I understand this is to be done yet. If we can use empties it will be a nice cleanup, you may consider empties for mhx too at least for most shapes. Also we can share shapes among rigs, I mean we don’t need to add one shape collection per armature, we can share the same collection among different armatures.

  13. Alessandro Padovani reporter

    Commit f23e9d4.

    Both G8 and G9 work fine now thank you for the fix.

    The important points are fixed, other points we can do by hand. Will leave this open for a while since I want to check G1 G2 G3 too, then I’ll close as resolved if everything is fine.

  14. Alessandro Padovani reporter

    update.

    G1 G2 G3 work fine.

    note. G3 toes. For G3 there’s some “shifting“ on the toes when we use the reverse foot, but this is due to how G3 is rigged with drivers on the toes, so not a bug.

    request. lock Y for fingers and toes in ik rigs. In daz studio fingers are not locked for Y so the importer correctly imports as unlocked. But when we animate in blender it makes sense to lock Y so fingers can’t roll, that is, real fingers don’t roll. The daz rig can stay unlocked so to be the same as daz, while ik rigs should lock.

    p.s. Also collars and pectorals should be locked on Y, same reason real collars don’t roll, pectorals neither.

    request. tarsals and pectorals. Since we finally hid tarsals carpals teeth in rigify, would be consistent to get the same in simple ik. Then again I’d suggest pectorals in the spine layer because in genesis pectorals is a spine standard, not special bones. Then special will be reserved to geografts.

    request. empties for shapes. Would be nice to use just a few empties for custom shapes, so to don’t clutter the scene with a unnecessary large amount of extra objects.

    Let me know. If you don’t agree I can close as resolved since the main features work fine.

  15. Alessandro Padovani reporter

    Commit b47fb02 works fine. Not all the requested features are implemented but the main features are there and we can do the rest by hand quite easily. Thank you for your work on this.

  16. Log in to comment