Export shape keys to Unity

Issue #873 resolved
Benjamim Alves created an issue

I'm trying to export my custom morphs imported from DAZ in blender, but I can't save these transformations in the resulting FBX to use in UNITY, could someone point me to a workflow?

Comments (5)

  1. Thomas Larsson repo owner

    I know nothing about Unity, but the problem might be that not all morphs are shapekeys; some are driven poses of the face rig. There are tools that convert such poses to shapekeys in the Advanced Setup > Morphs section, see https://diffeomorphic.blogspot.com/p/advanced-morph-section-version-16.html. The docs talk about Convert Standard Morphs to Shapekeys and Convert Custom Morphs to Shapekeys. IIRC there is only one button in version 1.6.1, which should just be called Convert Morphs to Shapekeys.

    Once the poses have been converted, you probably want to do Remove All Drivers before exporting to Unity.

  2. Benjamim Alves reporter

    Thank you very much for your answer, I didn't get it directly through diffeomorphic, but I got it using this workflow

    1. saved fbx of model directly from DAZ as well as scene
    2. I load the scene from the model in the addon and do the rig merge, load the morphs and merge Geografits
    3. Load the fbx file saved by DAZ in blender, select the model loaded in the diff and copy its shape keys to the fbx model in daz .

    After this process some morphs can be disproportionate, then I adjust with the "Blend from shape"
    I load in Unity the fbx file saved by DAZ and modified in blender

    I'm trying to load goldPalace morphs in unity

  3. Jake Vaughn

    Here is my workflow for importing morphs from Daz into Unity blendshapes (and diffeo):

    1. Have a base model in Daz that will serve as the default character shape in Unity, on which all morphs will be applied
    2. Import this model into Blender using diffeo
    3. Back in Daz, apply the morph you would like to create onto the character. For instance a morph to give the character a curvy body shape. Can be anything you want
    4. Save this morph as a typical .duf file and export the Diffeo .dbz file as well
    5. Back in Blender, go to DAZ Importer > Advanced Setup > Morphs. Select “Import DBZ morphs”. Locate the .duf file you just saved
    6. The shape key is now accessible in Blender, confirm it works by adjusting the slider in Object Data Properties tab on the mesh

    Now that the shape key is working in Blender, it’s time to bring it into Unity. Before you export you’ll want to take care of any other steps (merging geografts, etc). You’ll also want to take note of the fact that blendshapes WILL NOT WORK if you have modifiers on the character mesh when you export from Blender, such as Subdivision or Multiresolution (Skinbinding/Armature modifier is OK though, leave that one). If you would like your Unity character to have a higher polygon count than the base Daz resolution, you will need to apply the SubD or Multiresolution modifiers. But there’s a problem: Blender will tell you that you cannot apply modifiers to an object with shape keys. But fear not, there is a handy tool that will allow you to do just that: https://github.com/przemir/ApplyModifierForObjectWithShapeKeys

    After any optional modifiers are applied, export .fbx normally, and import into Unity. Now when you click on the character mesh, in the Skinned Mesh Renderer component you will see the blendshapes.

    You may have another problem occur here. When you apply the blendshape, weird things can happen to the mesh normals. In that case, you’ll want to select the character model in the assets panel and underneath “Model” check off the box “Legacy Blend Shape”. That should resolve any strange artifacts when using blendshapes.

    You now should have working blendshapes in Unity that don’t have any deformation. Here is an example of what I have achieved using this workflow:

    https://streamable.com/9nqy9o

    And here is another example, this time with clothing that also has the same blendshapes as the character:

    https://streamable.com/wgool5

    Let me know if you have any questions, and good luck.

  4. Log in to comment