Unity JCM Controller Script
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" }
]
}
]
{
"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" }
]
}
]
{
"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

Comments
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...
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?
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.
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)
This type of ERC is the most common, and implements the formula f(v) = v + (c * m) + a where:
vis the current value of the property this ERC link resides on.cis the current value of the control property that drives this ERC linkmis the scalar of this ERC linkais the addend of this ERC linkThis type of ERC implements the formula f(v) = (c / v) + a where:
vis the current value of the property this ERC link resides on.cis the current value of the control property that drives this ERC linkais the addend of this ERC linkThis type of ERC implements the formula f(v) = (v / c) + a where:
vis the current value of the property this ERC link resides on.cis the current value of the control property that drives this ERC linkais the addend of this ERC linkThis type of implements the formula f(v) = (c * v) + a where:
vis the current value of the property this ERC link resides on.cis the current value of the control property that drives this ERC linkais the addend of this ERC linkThis type of ERC implements the formula f(v) = v - c + a where:
vis the current value of the property this ERC link resides on.cis the current value of the control property that drives this ERC linkais the addend of this ERC linkThis type of ERC implements the formula f(v) = v + c + a where:
vis the current value of the property this ERC link resides on.cis the current value of the control property that drives this ERC linkais the addend of this ERC linkThis type of ERC is used to define value by a parametric function f(v) = v + P(c) where:
vis the current value of the property this ERC link resides on.cis the current value of the control property that drives this ERC linkYay! Thanks @danielbui78. I don't know that I could have found that in the docs.
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!
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:
Now I created a monster :D why?
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?
This should have been fixed in the Bridge by now with good performance, morphs or Unity run time scripts should definitiely not be needed it's a bone rigging issue Daz can fix.
You've got this Daz!
Hello, this doesn't work currently. The first error received is related to Daz3dbridge.cs stating something about a function called record, and it puts the project into safe mode, until you delete the folder.
I asked the AI how to fix since I am not knowledgeable with C# and am not sure how to fix the script and it even suggested asking the original creator how to fix it and not it. I'm using Unity 2021.3 (2022 gives dx12 chainswap errors and crashes windows) - any help?
Or does anyone have a solution to use JCM in Unity? Like I said I know nothing so I was hoping this solution would be an easy thing as you said to just put it on a character and I was hoping it would just make the JCM's function as blendshapes but it breaks the project entirely not letting you continue due to this aforementioned error. I don't think this is a Unity version issue since it references the Daz3dBridge.cs script file.
I would love some help since my character looks terrible at extreme angles and this JCM script sounded like the perfect solution.
There is much easier with the charcters from Unity store,
so I rarely transfer characters from Daz Studio.
If you ever find the solution, please post here the results.
There is also some fix for Genesis 9 in the thread:
https://www.daz3d.com/forums/discussion/689471/genesis-9-missaligned-fingers-fix#latest
There is also JcmFix on Unity store for Genesis 8 and 3.
... but opinions on this subject vary.
Thank you, today I worked with the AI to make a script to handle JCM's
It auto populates all bone names, fills in the name of the joint, and it moves the blendshape JCM appropriately.
After about 2 to 3 hours I have a perfect copy you just drop it into the game, put the skinned renderer mesh (Genesis) into the field, and click Auto Populate JCMs, and any JCMs on the morph go into the fields, with the appropriate names. My mind was blown it actually has worked, this has been a problem I've had for years wanting to make a Unity game with Daz characters.
I don't know if people want it but if they do I can post it but maybe there are other solutions I don't know of? I spent weeks looking for one so writing one and seeing it work and all the JCM's fire off is making me really excited.
I am not sure how to make it better, it seems to do everything I needed. I'm trying all the JCMs I can find in Daz to export since it just is using the auto add ones so far. If people have an interest I'll post it
Edit: I also have a clothing script that can put your clothes on the bones of the daz character, so you can switch out dozens of outfits easily and I just learned you can add ExecuteInEditMode and it will just let me have my daz char clothed in scene view as I move her around...this is tons of progress.
Additionally, one that lets blendshapes follow across multiple meshes... 3 problems solved using Daz characters in Unity.
Just noticed my clothes had lots of pop in, so I put on the 'JCM manager" script I made, and all the JCM on my person are on the clothes, but they did not move, I have the script used for eyelashes to move with the rest of the face, so I put it on the shirt, the pop in is gone and the shirt moves with the JCMs. DAZ characters are looking great now!
Wow, that is great, @kaincypher84.
If you could post the scripts, that will be interested to test them.
The other problem for me is to transfer environments with instances from Daz Studio to Unity.
Daz to Unity bridge does not transfer instances for me.
I have also used AI to help with the scripts for Unity, but with mixed results, so far.
I'd be interested in the JCM script as well.
Thanks guys, I'll post a video and some screenshots here shortly and the script then since there is interest. I also have the poses from .duf files working almost 100% so you can just load a .duf into Unity but they are still not perfect and do not feel happy with the results, you still have to manually move a few limbs that the rotation didn't get correct and I don't want that to be the case (I'll show a screenshot shortly) but I got rid of the weird 'twist bones' that were happening with the .duf files in Unity.
Maybe I should make a new thread for all of this in that case, but will update it here as well.
The goal is to be able to use any Daz content directly in Unity since they abandoned the project it seems and I have been spending weeks looking for information about how to do these things, and just struggled left and right and feel am finally making some progress and it makes me happy to see people want to see some results. I'll load the project up later and take some pictures and post the scripts after I test a few more things (I had to populate a few that got missed with weird names like flexions and stuff, I want t he auto JCM to get all of those names).
Surely is a way to get clothes / hair to work across all characters with .duf files as well since other games do it, so hopefully will have a solution for that too and hoping to make a "Quick Material" for daz textures, so can just drag all of them and it wouldn't need to be a daz to unity each time. It seems
I dunno, too many ideas not enough skill but feels amazing to see these things actually work!
IN REGARDS TO INSTANCES, in the past when I exported .FBX it would give me the instance data, and it would be blank game object, and then you just copy the data from an existing game object and you can take like 50 bushes that were instances and fix it in a few minutes by copying the components to get the mesh filter / mesh renderer and could probably write a script to do this as well but if you mean it is actually not copying the location data for those then try to export it as an fbx to see if that helps (or it could just be blank in which case it will show up once you give it a mesh filter and renderer)
Thanks a lot, @kaincypher84
Will wait for your scripts and the video.
Also great advice on instances - thanks again.
Interested in the JCM script too