possible workaround for daz orientation

Issue #1547 wontfix
Alessandro Padovani created an issue

This is related to #1445.

To handle prebended figures we introduced the daz orientation which allows to subtract the rest pose. Unfortunately this doesn't seem to work with rigify or quaternions, apart also causing issues with some poses.

Now, while it is true that the standard orientation can't subtract the rest pose, we can copy the absolute pose instead.

steps (doesn't work):

  1. in the global settings disable the daz orientation
  2. import a posed G8F as dbz
  3. import another pose with subtract rest pose

steps (works fine):

  1. in the global settings disable the daz orientation
  2. import a posed G8F as dbz
  3. import another G8F in rest pose, we can delete the mesh and keep only the armature
  4. import another pose on the rested armature
  5. copy absolute pose from rested to posed armatures

Since the plugin can access the default G8F rest pose, it should be possible to implement subtract rest pose for the standard orientation with the method explained above. Thus avoiding the daz orientation.

Thomas let us know what you think.

Comments (14)

  1. Thomas Larsson repo owner

    Copy absolute pose is a much more expensive operation, because it makes a scene update after each bone. Essentially it does

    • Set bone world matrix.
    • Update to make Blender calculate the bone’s local matrix.
    • Go on child bones. The children need the parent’s local matrix.

    This is very convenient to code, but the updates cost a lot, even if all meshes are excluded from the scene. This may be acceptable for a single frame, but if you have a long animation this becomes tedious (some of the mhx animation tools use this idea which is why they are very slow). The import pose tools calculate the matrices themselves. The parent matrix must still be known before we can go on to the child bones, but since no update is necessary it is much faster.

  2. Alessandro Padovani reporter

    I suck at math so can’t help you there. But I know I can do it with constraints as explained in #1445, that should also work for animation. Then we can apply or bake the contraints as a last step. Let me know if this helps.

  3. Thomas Larsson repo owner

    It turns out that I was mistaken about one thing: the rest pose is always subtracted with standard orientation. The subtract rest pose option is now global, and used both for daz and standard orientation.

    One cannot impose locks in general with prebended figures. If we use daz orientation the bend bones get a small Y rotation, because prebending changes the roll angle. You can see that if you import the same pose to a prebent and normal figure, and change the display mode to octahedral.

    Standard orientation still does not work. Since problems first appear for the upperarm and thigh twist bones, I think one must take into account the prebending of the parent bone too.

  4. Alessandro Padovani reporter

    Commit c797af0.

    As for the roll angle with daz orientation that doesn’t matter. The purpose here is to don’t use daz orientation but standard orientation instead. There’s no roll issues with standard orientation and copy absolute pose. Below the example with kneeling-b the rolls are the same. Steps as above.

    As for “subtract rest pose“ in global settings, it doesn’t make sense to have separate options since “subtract rest pose“ only works with daz orientation, and it's what daz orientation is for. So we can have a single option for daz orientation that also subtracts the rest pose, otherwise it is used the standard orientation without subtract.

    Then if we use the standard orientation we need “copy absolute pose” that’s what this discussion is for.

  5. Alessandro Padovani reporter

    note. copy absolute pose with constraints. If you implement copy absolute pose with constraints as explained in #1445, then it can also work with animations, not only with poses, and the workflow becomes similar to “keep daz rig“ with rigify and mhx. That is, a daz rig in rest pose is used to import daz poses and animations, then the prebended figure follows with constraints, then we can apply or bake the constraints.

    I mean if it is difficult to streamline the code without constraints as I understand you’re explaining above.

  6. Alessandro Padovani reporter

    update.

    Tested commit cea4f5c and it doesn’t work with standard orientation, tried with and without subtract, steps as above. I don’t see any improvement over the previous commits, so please explain if there’s any as I may miss something.

    Again, if you want to implement with constraints then things seem to work fine here.

  7. Thomas Larsson repo owner

    No, I attempted to fix it, but it didn’t work out. There are two different ways to transfer a pose from one bone to another:

    1. Copy the bone pose in world space, i.e. what a copy transforms constraint does. This is what the copy pose does.
    2. Switch from blender local coordinates to daz coordinates, rotate, and then switch back. This is what import pose does.

    The second method doesn’t know anything about the bone parent, so if some ancestor has some baked rotation, the pose is wrong. The first method works perfectly for identical rigs, but the implementation in the copy pose tool is slow because it must do a scene update after each bone is posed. So I started to make an implementation that doesn’t rely on updates. Unfortunately, it doesn’t work fine if the rest poses differ. In particular, the genesis hip points down but the rigify torso points backwards, which really messed things up.

    So the code has changed and is clearer now, but the end result hasn’t changed much.

  8. Alessandro Padovani reporter

    Ok, may you want to use constraints then ? That’s point 1 with actual constraints as explained in #1445. It works fine with constraints, it’s not slower than what we already do with “keep daz rig“, plus also works for animation as explained above. Or let me know if something is not clear or if there’s any reason to don’t.

    steps:

    1. implement “copy absolute pose/action“ with constraints, that will work both for poses and animations
    2. for copy pose the constraints can be applied as a last step, for copy action we need baking
    3. use “copy absolute pose/action“ to load poses/animations with the standard orientation, no need to subtract since absolute already takes care of that

    Again, subtract does not make sense with the standard orientation, it only works with the daz orientation.

  9. Thomas Larsson repo owner

    I would rather not spend any more time on this and leave the issue open. If you have a prebended figure you can just use daz orientation.

  10. Alessandro Padovani reporter

    The problem is daz orientation doesn’t always work fine as well as standard orientation. This was a fix for that. But I completely understand if prebended figures are not of use to you. So if you’re not interested I’ll close as won’t fix.

  11. Alessandro Padovani reporter

    request. copy absolute action.

    Could you implement “copy absolute action“ with constraints ? Since that would pretty much do it and would also complete “copy absolute pose“. Then we only have to copy the pose/action by hand from the daz rig in rest pose to the prebended figure. Let me know.

    Steps as already explained in #1445.

    # match the pose/action in world space
    for all bones
        copy rotation in world space
    for the hip bone
        copy location in world space
    apply or bake the constraints
    

  12. Log in to comment