About 62d8453 (set bone local axis way)

Issue #171 closed
engetudouiti created an issue

I assume why Thomas try to offer 3 options, mismatch between daz rig and blender rig way to decide Eular rotation.

I check many things, then I can confirm daz G3 rig local axis order is not correct, about finger bone and arm, sholder bones.

Or I can say daz do not keep their rule to set rotation order for their base figure.

When I pose as T pose,, you know, first main axis rotation (main pose) of arm, sholder, should be bend to forward. can not bend up and down. up and down main bone is not arm but collar bone.

But unfortunately daz set arm and sholder rotation order = XYZ that means Z is main pose axis for DAZ figure arm and sholder. or I can say, daz set same main pose axis for Collar, sholder, forarm. (set main pose as up and down)

At same time, DAZ use same rotation order for most of fingers = XYZ then it main pose axis is up and down.

Only about sam ,DAZ use XZY, so main pose axis = Y , then bend to inside (horizontial move)

So if we follow daz way and try to convert blender axis order, arm and main figner, and sum may set different main axis direction as visuall.

It effect, when we convert to rigify.

To avoid this problem, after all we need to make rig-template, which adjust bone roll (local axis direction) to fit Blender way. because we rig in blender.. we did not need to keep daz local rule for blender posing. (and convert for blender default rigs)

Most of human rig (add on) may keep same rule.

main pose axis will set as X, then Z arrow face to bend direction (plus)

Then after all,, about axis direction ,, Thomas current default setting is best ,then it fit to blender rig well. we may need not use another option about axis direciton, at least when convert rigi-fy default rig setting, it cause issue. or we need to change way to rig set-up,, with rigi fy options.

(though I still see, bone roll is not represent same direciton as daz set direciton so when we use Eular for posing, it may show different weight map effect, for mesh, but it not matter how set up Eular rotation order.. it is actually how set roll with angle for mesh topology)

Comments (19)

  1. Thomas Larsson repo owner

    New commit just made. The three options are:

    • Legacy: The old way, still default.
    • DAZ Unflipped: The same orientation and rotation modes as in DS. Only for debugging, since bones don’t point along Y.
    • DAZ Studio: Daz orientation with flipped axes. Rotation mode = YZX for all bones.

    The last option works mostly ok, but I could not get both forearms and thumbs to bend correctly, so the thumbs are twisted 180. As you say, one may need to add a table to correct other bones, e.g. so IK works.

    Here is another problem with foot orientation. The body foot (red) is standing on the ground, but the shoe foot (green) stands on its toes. This problem is absent in legacy mode, because the end_points are the same, but the orientations are not.

  2. engetudouiti reporter

    Though I still not understand why the foot problem may happen,, I assume it may happen only when you import figure with foot pose right?

    I suppose when we merge rigs, without the foot shoe have special bone,, the problem will disappear..

  3. engetudouiti reporter

    And yes I may expect, the last option will be offered with “rig-table” to set axis direction as blender manner.

    So can I expect pectoral bone show axis correctly? (I did not know why only pectoral show diagonal with your options,

    (I actually made table for G3, but it is for my custom script, (it not represent blender way,,about forarms ,sholders only) to add rolls for specific bones. then import it after adjust rig,, but it is tedious work,, I do not think, I can guide someone how to use it,,I only know how it work , and how set table manually ^^;)

    so we may need to make table along to your last option, to add roll (2pi or pi/2 if it need etc) for some bones only,, then it may need to include in your source code,, (so they will be auto applied when generate)

  4. engetudouiti reporter

    And yes if roll (angle) set correctly follow mesh, daz pose driver may work better, (but to work it,, each bone axis need to be adjusted to fit current axis setting ^^;)

    It is one merit why I recommend to use daz orientation, as same as Eular posing . (anyway I report or ask again, after test your new option thanks,, it need many test I suppose,, )

  5. engetudouiti reporter

    Yes!!! You finally done,, about roll (use daz orientaion them show same roll )

    And I know

    1. we need rig table only about some bone (which daz set unique way)
    2. we need to find solution about some special product which make rig without “memorize rig” for zero pose. those item may desigend for non zero pose,, then I suppose sometimes it cause issue.

    (it may work when fit to in daz studio,, but blender do not know, so this thing may happen, I suppose)

  6. engetudouiti reporter

    And why I may recommend the final option, it should show more reasonable bone arrangement for scene rig props, mechanical, or items for most of case.. (when vendor designed clean)

  7. engetudouiti reporter

    I see, current problem is your script do not apply bone pose (transform) which posed in daz studio.

    When I use my script , (import zbn,) then adjust bones, it correctly apply pose for actor and foot wear.

    So I suppose you seems forget to include bone pose to generate rig.

  8. engetudouiti reporter

    Then in daz studio, when item fit to Actor, the actor posed value for bone may not be shown.

    (eg rotate 30 X etc) but it may be recorded in json as real transform),

    So fit to not matter. export dbz already include bone rotation as "ws_rot" (I change it as blender prop "DazWsrot")

    then re-arrange for blender world axis, and apply it untill adjust edit bones.

    dq = (pr[3], -pr[0], pr[2], -pr[1])
    dquat = Quaternion(dq)
    bp_mat = dquat.to_matrix()
    mat_pr = bp_mat.to_4x4()
    

    mat_pr is matrix to add posed rotation value ,then apply it after orientate bone for edit_bones.

    mat_o = ebn.matrix
    mat_ra = Matrix.Rotation(rx, 4, 'X')
    mat_rb = Matrix.Rotation(ry, 4, 'Z')
    mat_rc = Matrix.Rotation(rz, 4, 'Y')
    
    mat_r = mat_pr @ mat_rc @ mat_rb @ mat_ra
    ebn.matrix = mat_r @ mat_o
    

    (edit mode only use matrix to transform ,or I only know to use matrix to locate edit bone)

    after that I apply translate (when it was posed) for edit bones. (Your default bone already set center point correctly, even though it was moved. so I just used it,, I remember,, ^^; then I could concentrate rotation, orientation only, then those value are already include morphed (ERC changed) value too. (at least my knowledge,,)

  9. engetudouiti reporter

    Then when I use the 3rd option to generate rig which already foot posed,, the actor rig bone not posed. So I do not know your first pic show Actor rig posed but foot-wear not posed, (as rest pose)

    For me, both (Actor and foot wear) show same problem (not apply pose value as rest pose, but mesh defromed already)

  10. engetudouiti reporter

    Then I am G3 main user,, so I hope to offer rig-templateof G3 first. (as basic zero pose)

    (so Thomas can easy apply it in your add on , I hope so ^^;)

    lCollar -pi
    lShldrBend +pi/2 * 3
    lShldrTwist +pi/2 * 3
    lHand +pi/2 * 3
    lEar +pi/2 * 3

    each rolls value may need to be added from Thomas importer option3 rig as base, to get same direction of meta-rig (armature human)

    then for pare mirror bones need to set opositte roll.

    eg ( rCollar +pi) and (rHand -pi/2 * 3)

    of course -pi = pi, but why I set so,, try to set final roll value near zero values. (I do not like to see -270 but 90 etc, or I may prefer -60 than 300 for roll value)

  11. Thomas Larsson repo owner

    Some progress in the latest commit:

    The roll is now corrected as in the table at the top of bone.py. You did not include the thumb bones, but they were already patched and I moved the patch to the table. The roll angles in legacy mode differ for the hands and ear, but probably your values are better, at least for the hand.

    The Merge Rigs tool now has two new options: Apply Rest Pose and Copy Bones, which should work correctly if the character was imported without and with dbz fitting. The code for these options already existed in the corresponding buttons, but it hadn’t been necessary to use them after version 1.1

  12. Thomas Larsson repo owner

    It seems that I can get away with a single table for all versions of Genesis. The original Genesis seems to be a bit of an outlier, but G2 - G8 seem to need the same roll corrections. And who uses the original Genesis today anyway?

  13. Thomas Larsson repo owner

    Another thing: When you think that the new bone system works correctly, I would like to remove the add-on system completely before the release of version 1.5. It was interesting to learn how to implement an add-on system, but I think it is more useful to script the add-on from the peer level. And an add-on system adds an extra level of complexity that I would rather not support.

  14. engetudouiti reporter

    Yes if one table may work for most of generation figure, it seems easy. (though I may try to test and offer with check at least for all g1, g2, g3, and g8 (maybe ^^;)

    Then yes, about some bones, eg (hand or ear) I do not know if my table is good for all…

    about hand, I just set as same as official meta-rig,

    but as logical,, I do not think hand main axis is side to side, but the rig made so.. I assume if it need for IK chain of the rig-type,, but I did not remember clear.

    (about your default rig may set up and down for hand main pose , I remember,,)

    And as you said,, you already include kind of roll table (I call so) for the mismatch rpoblem,, in your scirpts, but I tried to add roll, from your new option3 which generated by your current add-on, so if you version up, I think my table may change.. so I may test with your recent version, then if there is problem I may report again.

    Anyway, my roll table show value which apply from add on generated rig with (new option)

    Then hope to see, if foot pose problem is resolved..

    and I think there was a few case,, it may show different rig arrangement about daz product.

    I found one rig,, which vendor do not set memorize rig, for zero pose,, which parented and adjusted orientation manually for parented rig zero pose,, (the vendor move orientation manually then not memorize in daz studio,,,, )

    the case is difficult to report (and many of user may need not,,, )

    so my currrent attention is,, rig table test, and foot or some clothing which may posed already,, how work with your new version ..

    anyway really thank you finally add best option at least to represent daz rig roll. I know quite a few add on which import daz rigs, for each file format..

    and I sometimes try to tell how daz rotation work, etc,, for the add on vendor.

    But actually only you and this add on finally show what I hoped (= show same rig roll) ^^b

  15. engetudouiti reporter

    Ah yes,, actually I do not hope to include may add on as sample in your add on management system..

    My wish is already solved with your new options. and I made it for my purpose.. I know you offerd add on system, only for my requests about bone roll,,

    But I do not think you include it in your add on sysutem. (and actually I can not keep up-date as official add on, though I still use it for many things,,) then free remove my add on, I have no complain about it, (I often planed to request more directly,, but I can not find good word about it,, because you did it for me,,I felt)

  16. engetudouiti reporter
    1. About bone axis direction way seems solved (though I only test with G3)

    I hope it sitill show same pose controller effect.

    when I adjust bones with my script, collar and pectoral bone driver not show same effect. (so I felt it depend on your default rig roll at that time.)

    But now I see same roll as daz studio about pectoral. so I afraid it show same issue about the driver. I may test again..

    (and if there is problem I afraid,, import pose controller may show same issue (bone drive bone with X Y Z rotation value)

    2. About foot pose (or any pose may show same issue, I suppose), still remain. (I suppose you may up-date after finish rig-table etc)

    as for me the reason is, posed bone rotation not applied correctly when import rig.

    As you said, If I use default legacy option, (rotation mode), I have never seen this issue.

    At same time I clear see, bone center point (blender bone head) are correctly applied even though I pose figure in daz studio.

    So I think you only need to apply “pose rotation value”, after orientate bone with your current rig-table then generate bone as zero pose. (so it fit to current posed deform mesh)

    I memorize current rig, in blender, then if I adjust with script, (the difference is I add posed rotation after orientate edit-bone )

    it now fit mesh . (of course we never use such pose as zero pose, it is just for test,, same thing should happen about all foot pose, or rest pose which we set in daz studio,, plug in may keep non zero pose bone orientation when import ,,, with the new option)

    I think it may be caused daz script function WStrans etc,, (It is not so well document,, so I think if it can not include posed rotation,, though I do not know )

  17. Log in to comment