Import custom expressions

Issue #51 resolved
Noname created an issue

In morph pane there is “Import Expressions” option but that only list few expressions.

My question is how to import custom expressions ?

Tried using “Import Custom Morphs” but I go error:

Not a morph asset

Is it a bug / unsupported feature or I do something wrong ? File that I try to import are located in:

Library\People\Genesis 3\Expressions so I do assume these are correct expression files?

Comments (18)

  1. Thomas Larsson repo owner

    This happens depending on what is (or is not) in the file. The Import Expressions button will load all files starting with “eCTRL”. If the file starts with “alias” it contains an alias asset which is not a morph.

    IIRC a basic installation of Daz Studio comes with six expressions. Additional expressions are not free.

  2. Noname reporter

    Thank You for reply, but it actually make me more confusing :)

    Here are my thoughts / findings (nothinf “revolutionary” but maybe it will save some time others).

    I did some testing and:

    • daz - load model + set expression
    • daz - save + save json data file

    Then in blender:

    • blender - import with JSON fittings (this imports expression “baked” into mesh so there is no easy way to i.e. make shapekey etc)
    • blender - import unfitted (this import base mesh without expression)

    So I checked JSON fitting data file and it seams like it contains bones transformations with in this case (afer expression load) are now different than base G3F test model with is why expression is imported..

    Expression duf files are binary so I decoded it with plugin option and investigated resulted *.txt. So there is multiple values for animation node like:

    "url" : "name://@selection#eCTRLvW:?value/value",
    "keys" : [ [ 0, 0 ] ]
    

    So I do assume, as I didn’t looked into spec of file format / Daz SDK that those are command that Daz will do, namely select controller and set value to specified one.

    So I assume problem with this importer is that at this point (when importing custom expression) imported doesn’t know what eCTRLvW is right (correct me if I’m wrong but this one seams like it’s visemes one) ? The file contains other controllers as well i.e. PHMBrowCompressionHD, eCTRLBrowInnerUp-Down, eCTRLCheekEyeFlex etc.

    So I think that all these infos are in look up tabel in Daz database with info / map like controller name → file name etc. ? Wouldn’t it be possible to read those informations from there ?

  3. Noname reporter

    PS. I checked expression package and there are only expression files, nothing more, so those expression use only “build in Daz” controllers so my thinking is that after importing expressions and visemes all controllers should be on the rig / armature right and changing values for these would suffice ?

  4. Noname reporter

    So I looked at this a little bit more and:

    • blender - importing units (Setup → Morphs → Import Units) seams to correctly import all base units

    After decoding expression file I did examined it and compared to imported Units in blender and those controllers are found in blender, i.e.

    in blender using datapath for imported units I got i.e.

    ["DzULipsPart"]
    ["DzULipsPartCenter"]
    

    In decoded expression file portion of JSON looks like this:

    {
        "url" : "name://@selection#eCTRLLipsPart:?value/value",
        "keys" : [ [ 0, 0.12 ] ]
    },
    {
        "url" : "name://@selection#eCTRLLipsPartCenter:?value/value",
        "keys" : [ [ 0, 0 ] ]
    },
    

    So I think it could be possible to load custom expression after importing units, assuming those don’t use custom controllers.

    Only missing / unknown to me data in expression file are those:

    {
        "url" : "name://@selection#PHMBrowCompressionHD:?value/value",
        "keys" : [ [ 0, 0.08443757 ] ]
    },
    

    So I’m not sure what these do and if these can be skipped.

    Just my 2 cents, comment / feedback more then welcome :).

  5. Noname reporter

    Thomas

    So what’s Your take on this ? Any plans to add support for custom expression or this feature ?

  6. Thomas Larsson repo owner

    A morph asset contains the definition of a morph. It contains formulas like this, which define how much the face bones should move depending on the value of the morph.

            "formulas" : [
                {
                    "output" : "lNasolabialMouthCorner:/data/DAZ%203D/Genesis%208/Female/Genesis8Female.dsf#lNasolabialMouthCorner?translation/x",
                    "operations" : [
                        { "op" : "push", "url" : "Genesis8Female:#eCTRLvW?value" },
                        { "op" : "push", "val" : -0.05988701 },
                        { "op" : "mult" }
                    ]
                },
    

    The file you are trying to load is an animation, and you load it with Load Pose in the Poses panel. It specifies the value of the morph at different frames (only frame 0 in this file).

    So you load the pose with Load Pose. Note that you must first import the visemes (and probably face units and perhaps expressions), because otherwise there is no morph value to animate.

  7. Noname reporter

    Thank You for explanation and sorry for wasting Your time.

    I will go and reread, hopefully with understanding this time, Your blog.

    Best regards

  8. Noname reporter

    Sorry to bother You again, but I did tested it a little and:

    • I can load face expression using Import Pose
    • using Import Pose Library also works fine, but when I apply different pose nothing happens - is this bug or known limitation ?

    Files that I load are above ones so animation apparently.

    PS. Actual poses work and apply fine, only those facial expressions cause issue (don’t apply / change bones)

  9. Noname reporter

    Some more testing for expressions, using Lilith G3F character, first loading Units + Correctiveness + Visemes, and:

    1. I do get warnings like:
    File "\MyDaz3DLibrary\People\Genesis 3 Female\Expressions\nk.png" loaded in 0.118 seconds
    Missing morphs:
      ['CTRLCheeksDimpleCreaseHD', 'PHMBrowCompressionHD', 'PHMCheeksDimpleCreaseHDL', 'PHMCheeksDimpleCreaseHDR', 'PHMNoseCompressionHD']
    

    So why these are missing ?

    I checked and i.e. CTRLCheeksDimpleCreaseHD is located in MyDaz3DLibrary\data\DAZ 3D\Genesis 3\Female\Morphs\DAZ 3D\Head and AFAIKT it’s part of standard ? Daz assets (Genesis 3 Female Starter Essentials) ?

    Visually it works fine because HD version is not supported so maybe that makes sense to not load those morphs.

    2. Pose Library Issue:

    Posing → Import Pose Library

    What I do:

    1. select armature
    2. hit Import Pose Library
    3. poses with pose name are correctly displayed in blender → Object Data Properties → Pose Library
    4. pressing button Apply Pose Library Pose does nothing

    Could it be that becasue these are i.e. partial head morphs this doesn’t work and importing body morphs works fine ? Strangely partial poses for i.e. hands works fine also.

  10. Noname reporter

    All my above testing were with model G3F Lilith

    Moving to G8F and:

    1. I can see HD morphs when using Import Units Import Expressions
    2. Loading above same face expression files results in different missing morphs:
    File "\MyDaz3DLibrary\People\Genesis 3 Female\Expressions\nk.png" loaded in 0.141 seconds
    Missing morphs:
      ['eCTRLCheekFlex', 'eCTRLCheeksBalloon', 'eCTRLEyesSquint', 'eCTRLMouthCornerBack', 'eCTRLMouthCornerBackL', 'eCTRLMouthCornerBackR', 'eCTRLMouthNarrow', 'eCTRLMouthOpenWide', 'eCTRLNostrilsFlare', 'eCTRLSmile', 'eCTRLTongue%20Curl']
    

    But deformation seams to be ok.

    3. Import Pose to Library works and poses are listed in Pose Library, but as with G3F pressing Apply Pose Library Pose doesn’t work.

  11. Noname reporter

    In all cases (G3 / G8) of Import Pose Library last selected pose is displayed correctly and is properly selected in blender Pose Library.

    Switching just doesn’t work.

  12. Noname reporter

    More testing G8F.

    Using partial Left Leg poses.

    Same as with Facial expression.

    Using Import Pose for individual files works correctly, leg do deform.

    Using Import Pose Library displays lastly selected pose, adds all selected poses to library, using Apply poses doesn’t change (in this case) leg pose.

    So maybe indeed issue is related to partial poses ?

  13. Thomas Larsson repo owner

    Yes, it appears that Import Poselib ignores expressions, and I don’t think that can be fixed. The button imports a pose, for both bones and expressions, and then invokes the mether bpy.ops.poselib.pose_add(). That is the same things as pushing the + button in the Pose Library section in the armature context. That button ignores object properties, which is what expressions are. So I don’t see how that can be changed.

  14. Thomas Larsson repo owner

    On some morphs displaying correctly despite being reported as missing. Some duf file describe a facial expression in two ways: as the settings of some sliders, but also as the actual pose of the face bones. So even if the sliders are missing, the face bones may be posed correctly.

    But this is not true for all files. Some only list the slider settings, some only have the bone poses, and some have both.

  15. Noname reporter

    Ok, I did more testing and it appears that root of issue are drivers.

    As mentioned above I do import firstly correctives + vieseme etc. so all morphs are there with drivers, no option to import units / expressions etc. without drivers. And this cause PoseLibrary to not work.

    For testing I created manually Pose LIbrary in Blender and imported expression + modified 1 additional bone without driver (shoulder in this case) created Pose and imported another expression + moved bone without driver (same as above) and hit blender option Apply Pose Library Pose and facial bones with drivers didn’t reacted but bone without driver did correctly changed it’s position.

    So issue is with drivers now the question is where ?

    Another experiment.

    1. import facial expression
    2. still in pose mode select all bones
    3. open drivers editor
    4. select all channels
    5. hit Mute Channels
    6. create new Pose Library (if not already exists)
    7. add new pose to blender library
    8. import using Import Pose another facial expression
    9. because drivers are muted nothing will happen, so unmute all channels, immediately new facial expression should display
    10. mute all selected channels again
    11. add new pose to pose library
    12. mute all selected channels

    At this point switching between poses works fine now.

    Un-mutting channels for facial expression will apply last driver state.

    So it seams like drivers are ignore when adding to Pose Library and are causing all this issues.

    Issue with G8F and Leg morphs works now fine so I think this was different issue.

    Let me know / comment / about Your pov etc.

  16. engetudouiti

    Blender pose library may only save pure bone posing.not save about mix shape (use sape key) + posing,

    and not save pose. when bones not moved by bone-driver.

    when you import pose and shapes and set driver for daz importer, now bones move by custom props. not by driver bones, which you pose.

    eg for face units,

    1. custom prop dirve drv-face bones.
    2. drv-face bones will move their child bones.

    so you can not save it as pose library. it may work,, if you make individual bone driver, then save the bone-driver pose

    (About this case, driver-bone not driven by custom prop)

    but it is not way which daz and this importer try. This plug in mimic daz parameter system, which link with morph, and posing. so we can not expect,all pose will be saved as blender pose library.

    (And there are many things, blender may better to manage cutom prop, and driver things well for Animation.. eg you know rigfy-rig only use dirver bones to controll other bones, not offer any csutom prop system, which related with rig so user may try to enhance it as they like. )

  17. Log in to comment