true
    • Shop
    • NFT
    • Technology
    • Community
      • Gallery
      • Masterclass
      • In the Studio
      • Forums
      • Press
      • Blog
    • Help
    • Download Studio
  • Shop
  • NFT
  • Technology
  • Community
  • Help
  • Download Studio
  • Our Community
  • Gallery
  • Masterclass
  • In the Studio
  • Forums
  • Press
  • Blog
Loading...
    • Categories
    • Recent Discussions
Daz 3D Forums > 3rd Party Software > Unity Discussion

Unity JCM Controller Script

Roland1234Roland1234 Posts: 31
June 2022 edited June 2022 in Unity Discussion

I'm writing a script to drive JCMs in Unity but am having trouble undestanding the JCM .dsf files correctly. I think it's the formulas node that has what I need but sometimes it looks like this:

"formulas" : [
                {
                    "output" : "Genesis8Female:#pJCMThighFwd_115_L?value",
                    "operations" : [
                        { "op" : "push", "url" : "lThigh:/data/DAZ%203D/Genesis%208/Female/Genesis8Female.dsf#lThigh?rotation/x" },
                        { "op" : "push", "val" : [ -115, 1, 0, 0, 0 ] },
                        { "op" : "push", "val" : [ -57, 0, 0, 0, 0 ] },
                        { "op" : "push", "val" : 2 },
                        { "op" : "spline_tcb" }
                    ]
                }
            ]

other times something like this:

"formulas" : [
                {
                    "output" : "Genesis8Female:#pJCMThighSide_85_L?value",
                    "operations" : [
                        { "op" : "push", "url" : "lThigh:/data/DAZ%203D/Genesis%208/Female/Genesis8Female.dsf#lThigh?rotation/z" },
                        { "op" : "push", "val" : 0.01176471 },
                        { "op" : "mult" }
                    ]
                }
            ]

Is there some documentation somewhere on how to interpret these values?

Post edited by Roland1234 on June 2022

Comments

  • Roland1234Roland1234 Posts: 31
    June 2022

    Ah, I found the documentation:

    http://docs.daz3d.com/doku.php/public/dson_spec/object_definitions/formula/start

    The real issue now is how to implement this "spline_tcb" operation...

  • danielbui78danielbui78 Posts: 329
    June 2022 edited June 2022

    FYI, I've added JCM Controller support to the latest Daz Bridge Library:

    https://github.com/daz3d/DazBridgeUtils/commit/ab4835549030388f7626fffb2eae3d3e862a1ae2

    This info is exported in the DTU file.  It's the JSON object structure used by Blender's Auto JCM implementation.

    Post edited by danielbui78 on June 2022
  • Roland1234Roland1234 Posts: 31
    June 2022

    danielbui78 said:

    FYI, I've added JCM Controller support to the latest Daz Bridge Library:

    https://github.com/daz3d/DazBridgeUtils/commit/ab4835549030388f7626fffb2eae3d3e862a1ae2

    This info is exported in the DTU file.  It's the JSON object structure used by Blender's Auto JCM implementation.

    Cool - looks like that's just exporting the JCM info to the DTU file, or are you also adding a component to implement the JCM in Unity?

  • Roland1234Roland1234 Posts: 31
    June 2022

    I manged to hack together a Unity script to drive JCM morphs. It was much more complicated than I had hoped but I got the basic idea working.

    One of the main issues I ran into was the need to access the morph formulas: I had to access the registry to get the Daz library path and parse the actual morph DSF files. So my next question I guess goes to @danielbui78: Will we be able to, or are there any plans, of incuding the morph formulas in the DTU file? So far I only see the morph names and labels being exported.

  • danielbui78danielbui78 Posts: 329
    June 2022

    Roland1234 said:

    I manged to hack together a Unity script to drive JCM morphs. It was much more complicated than I had hoped but I got the basic idea working.

    One of the main issues I ran into was the need to access the morph formulas: I had to access the registry to get the Daz library path and parse the actual morph DSF files. So my next question I guess goes to @danielbui78: Will we be able to, or are there any plans, of incuding the morph formulas in the DTU file? So far I only see the morph names and labels being exported.

     

    Congratulations!  Great work.  JCM information is already exported in the DTU, but you have to build with the correct version of the Daz Bridge Library: https://github.com/daz3d/DazBridgeUtils

    I will try to update DazToUnity to use the latest version of the Bridge Library for the next release.  You can use the Bridge Library to build a Scriptable Bridge Plugin and use that to output DTU/FBX files.  Or you can just use the DazToBlender/C4D/Maya bridges and have them output FBX/DTU and copy those to Unity -- they should be compatible with Unity, and will have the extra JCM info.

  • Roland1234Roland1234 Posts: 31
    June 2022

    Awesome, that's exactly what I was looking for: you got the joint orientations and limits and everything. Just a minor comment: It looks like the DTU has redundant Morph and MorphNames nodes?

    Are morph formula operations defined by the MorphLinks[].Links[].Type property? I see values of 0, 3, and 6. I can sort of guess 6 is spline_tcb but it seems both 0 and 3 are multiply?

  • danielbui78danielbui78 Posts: 329
    June 2022 edited June 2022

    Roland1234 said:

    Awesome, that's exactly what I was looking for: you got the joint orientations and limits and everything. Just a minor comment: It looks like the DTU has redundant Morph and MorphNames nodes?

    Are morph formula operations defined by the MorphLinks[].Links[].Type property? I see values of 0, 3, and 6. I can sort of guess 6 is spline_tcb but it seems both 0 and 3 are multiply?

     

    Yes, there is a LOT of redundancy to maintain compatibility with 5 different bridges that use DTU files.  As we work towards unifying more bridge code, we'll slowly streamline the DTU file.  For now, it is a "Rosetta Stone" of Daz Iray Uber information for the different bridges.

     

    This is from the DtB code that uses the morphlinks entries: https://github.com/daz3d/DazToBlender/blob/da8a97d665784c286562bc82eb88db1f7eba31c3/Blender/appdata_common/Blender Foundation/Blender/BLENDER_VERSION/scripts/addons/DTB/DtbShapeKeys.py#L156-L187

     

     From Daz SDK Documentation:

    The types of ERC that can be represented by this class.

    Enumerator: (aka Type Values 0 - 6)

    ERCDeltaAdd 

    This type of ERC is the most common, and implements the formula f(v) = v + (c * m) + a where:

    • v is the current value of the property this ERC link resides on.
    • c is the current value of the control property that drives this ERC link
    • m is the scalar of this ERC link
    • a is the addend of this ERC link
    ERCDivideInto 

    This type of ERC implements the formula f(v) = (c / v) + a where:

    • v is the current value of the property this ERC link resides on.
    • c is the current value of the control property that drives this ERC link
    • a is the addend of this ERC link
    ERCDivideBy 

    This type of ERC implements the formula f(v) = (v / c) + a where:

    • v is the current value of the property this ERC link resides on.
    • c is the current value of the control property that drives this ERC link
    • a is the addend of this ERC link
    ERCMultiply 

    This type of implements the formula f(v) = (c * v) + a where:

    • v is the current value of the property this ERC link resides on.
    • c is the current value of the control property that drives this ERC link
    • a is the addend of this ERC link
    ERCSubtract 

    This type of ERC implements the formula f(v) = v - c + a where:

    • v is the current value of the property this ERC link resides on.
    • c is the current value of the control property that drives this ERC link
    • a is the addend of this ERC link
    ERCAdd 

    This type of ERC implements the formula f(v) = v + c + a where:

    • v is the current value of the property this ERC link resides on.
    • c is the current value of the control property that drives this ERC link
    • a is the addend of this ERC link
    ERCKeyed 

    This type of ERC is used to define value by a parametric function f(v) = v + P(c) where:

    • v is the current value of the property this ERC link resides on.
    • c is the current value of the control property that drives this ERC link
    • P is a parametric curve defined by the KeyValues array.
    Post edited by danielbui78 on June 2022
  • Roland1234Roland1234 Posts: 31
    June 2022

    Yay! Thanks @danielbui78. I don't know that I could have found that in the docs.

  • Roland1234Roland1234 Posts: 31
    June 2022

    I felt like sharing my results. Simply extract the contents into your Unity project, go to your figure's root object, add the "Daz Jcm Controller" component and click the "Load JCMs" button in the inspector to initialize everything. There's bound to be mistakes and misses so it'd be nice if people would point them out here.

    You will need the latest Daz Bridge Library DTU file so I'll echo danielbui78's advice to use the latest Daz->Blender bridge plugin to generate it (it ends up under C:\Users\{name}\Documents\DAZ 3D\Bridges\Daz To Blender\Exports). But he totally promised to update the Daz->Unity plugin really, really soon. Like, tomorrow, probably.

    zip
    zip
    DazUnityJcms.zip
    22K
  • danielbui78danielbui78 Posts: 329
    June 2022

    Roland1234 said:

    I felt like sharing my results. Simply extract the contents into your Unity project, go to your figure's root object, add the "Daz Jcm Controller" component and click the "Load JCMs" button in the inspector to initialize everything. There's bound to be mistakes and misses so it'd be nice if people would point them out here.

    You will need the latest Daz Bridge Library DTU file so I'll echo danielbui78's advice to use the latest Daz->Blender bridge plugin to generate it (it ends up under C:\Users\{name}\Documents\DAZ 3D\Bridges\Daz To Blender\Exports). But he totally promised to update the Daz->Unity plugin really, really soon. Like, tomorrow, probably.

     

    Great work!  I will try to test it out over the weekend.  I'm hoping to get a new version of the DazToUnity bridge with JCM output in the DTU posted to Github by late tomorrow.  It will probably not be updated to Daz Central / DIM until next week.

  • danielbui78danielbui78 Posts: 329
    June 2022 edited June 2022

    danielbui78 said:

    Roland1234 said:

    I felt like sharing my results. Simply extract the contents into your Unity project, go to your figure's root object, add the "Daz Jcm Controller" component and click the "Load JCMs" button in the inspector to initialize everything. There's bound to be mistakes and misses so it'd be nice if people would point them out here.

    You will need the latest Daz Bridge Library DTU file so I'll echo danielbui78's advice to use the latest Daz->Blender bridge plugin to generate it (it ends up under C:\Users\{name}\Documents\DAZ 3D\Bridges\Daz To Blender\Exports). But he totally promised to update the Daz->Unity plugin really, really soon. Like, tomorrow, probably.

     

    Great work!  I will try to test it out over the weekend.  I'm hoping to get a new version of the DazToUnity bridge with JCM output in the DTU posted to Github by late tomorrow.  It will probably not be updated to Daz Central / DIM until next week.

     

    This is only a developmental version -- needs more internal and external QA testing before it can be pushed to Daz Central:

    https://github.com/daz3d/DazToUnity/releases/tag/2022.1.pre.1

     

    Edit: I tested the build from the link above with the Daz Jcm Controller -- AWESOME!  I have only been able to test out for a couple of minutes to confirm that it works, but saw that the morph sliders on the Skinned Mesh Renderer control were correctly locked out and updating as I posed the skeleton!  Congratulations again, @Roland1234!  Please make a video to share when you have time.  Thanks!

    Post edited by danielbui78 on June 2022
  • iacoposk8iacoposk8 Posts: 74
    October 2022 edited October 2022

    Hi everyone! i can't solve this problem. I used daz to unity bridge and, the shirt JCMs are exported but there doesn't seem to be a "driver" that activates them when moving the arms.

    (a few days ago I wrote a post with more info and photos)

    I downloaded DazUnityJcms.zip unzipped and used as a patch for the Assets in unity folder so:

    1. I add the "Daz Jcm Controller" component
    2. in "Daz 3d Istance" I drag & drop the fbx model in "Source FBX"
    3. and click the "Load JCMs" button

    Now I created a monster :D why?

     

    monster.jpg
    489 x 351 - 22K
    Post edited by iacoposk8 on October 2022
  • losonczis_17462e0275losonczis_17462e0275 Posts: 1
    October 2022

    Hi there! I can confirm that it's working, but it's looks terrible at high angle rotations but pretty good at low angles. I think it's because daz jcms are made for dual quaternion skinning and unity not support that. Am I right or missing something?

    lowangle.jpg
    1586 x 789 - 176K
    highangle.jpg
    1597 x 759 - 177K
Sign In or Register to comment.
Adding to Cart…

Daz 3D is part of Tafi

Connect

DAZ Productions, Inc.
224 S 200 W, Suite #250
Salt Lake City, UT 84101

HELP

Contact Us

Tutorials

Help Center

Sell Your 3D Content

Affiliate Program

Documentation Center

Open Source

JOIN DAZ

Blog

About Us

Press

Careers

Bridges

Enterprise Licenses

Community

In the Studio

Gallery

Forum

DAZ STORE

Shop

Daz+

Freebies

Published Artists

Licensing Agreement | Terms of Service | Privacy Policy | EULA

© 2023 Daz Productions Inc. All Rights Reserved.