Thursday, March 25, 2021

More on the Morped Fitting Option

Yesterday I wrote about how to import a morphed character into Blender without a dbz file.The conclusion was that sometimes it works and sometimes it doesn't, and if it doesn't we have to import the morphs manually afterwards. After having investigated the behaviour further I think I understand what is going on.
In DAZ Studio, import the Aiko 8 characters. We see that three sliders affect the character shape: Aiko 8, Aiko 8 Body, and Aiko 8 Head. They correspond to the CTRL, FBM and FHM files mentioned in the previous post. If we move the Aiko 8 slider, the body and head sliders follow suit.
But we can also dial the body and head sliders separately. So let us turn off Aiko 8 and turn on Aiko 8 Body and Head, as shown above. This distinction does not matter in DAZ Studio or if we export a dbz file, but it matters when we import the scene into Blender with Mesh Fitting set to Morphed.
Here is the result in Blender, with the control morph to the left, and the individual head and body morphs to the right. Note that the armature is morphed correctly in both cases, but the control morph does not affect the mesh.
In the latest commit to version 1.6.0, there is a new Morph Strength slider. It only appears when Mesh Fitting is set to Morphed, and the picture below illustrates what it does.
The usefulness of this option is limited, since it is still impossible to mix several characters in Blender; DAZ Studio must be used for that.

Wednesday, March 24, 2021

Importing a Morphed Character Without a DBZ File

The preferred workflow is to design a character in DAZ Studio, save it and export a dbz file, and then import the duf file with the DAZ Importer and Mesh Fitting set to DBZ. However, both DAZ Studio and Blender are evolving software that put increasingly strong demands on your hardware and software, and if you are on an old computer the latest versions may not work on it. 

One solution would be to uninstall the latest version and stick with an old version that works, but I am not sure if that is possible with DAZ Studio. Another solution is to import the scene directly into Blender, without opening DAZ Studio. This will work as long as the DAZ database is intact. However, it means that you must import the character without having access to a dbz file, since you must open DAZ Studio in order to export it.

It is now possible to import a morphed character directly into Blender, without the need of a dbz file. However, the process is somewhat complicated and involves several steps. It works in the latest version of version 1.6.0 of the add-on. Since this feature is something which may be most interesting on old computers that may not be able to run Blender versions later than 2.79, and Blender 2.79 support has been removed from version 1.6.0, the stable version 1.5.1 has also been updated. Stable version 1.5.1c can be downloaded from

The illustrations below were made with Blender 2.79 and DAZ Importer 1.5.1.

Here is a character in DAZ Studio. We save the scene as a duf file but don't export a dbz file. Perhaps it is an old scene and we can not open DAZ Studio to export a dbz file.

In Blender, import the DAZ scene and set Mesh Fitting to the new Morphed (Characters) setting.

The characters has morphs (FBMPearFigure) but the clothes have not.The armatures have also been morphed, although this may not be entirely obvious in this picture. Merge all rigs to the main character rig as usual. If we render the scene we see that the materials have been imported correctly.
The body mesh has a number of shapekeys that we need to transfer to the other meshes. With the mesh active and all other meshes selected, press Transfer Other Morphs (Transfer Shapekeys in version 1.6.0). Make sure to include all meshes, including hair and eyelashes.
In the options dialog, make sure that all shapekeys are selected. The other settings can be left at their default values.

The shapekeys are now transferred to the clothes and hair. With all meshes selected (the order does not matter in this case), press Apply All Shapekeys.

The shapekeys go away and we have successfully imported the morphed character into Blender. We can now continue with the other steps (merge materials, load morphs, merge geografts, ...) that makes the character ready for animation.

The process above assumes that we have saved the DAZ scene but not the corresponding dbz file. But we can also design new characters from scratch, even if DAZ Studio is not working, as long as the DAZ database is intact.

We want to import Aiko 8 into Blender directly from the character file. Press Import DAZ File (just Import DAZ in version 1.6.0) and navigate to the directory

{DAZ root}/People/Genesis 8 Female/Characters/

Select Aiko 8.duf or one of the corresponding png files, and import the DAZ file with Mesh Fitting set to Morphed.

In this case the morphs are not imported, and the imported mesh is a realistic Caucasian woman instead of a cartoonish Asian woman.However, we note that the morph has been imported to the armature, e.g. the brow and eye bones are distinctively below the matching location on the mesh. The difference compared to the previous case is that the FBMPearFigure morph is referenced directly from the duf file, whereas the duf file in this case refers to a control file (CTRLAiko8.dsf) which in turn refers to the two morph files FBMAiko8.dsf (full body morph) and FHMAiko8.dsf (full head morph). The Import DAZ tool does not handle such indirection, so instead we must load the individual morphs manually.

With the Aiko mesh selected, press Import Custom Morph and go to the directory that contains the Aiko morphs, i.e.

{DAZ root}/data/DAZ 3D/Genesis 8/Female/Morphs/DAZ 3D/Aiko 8/

This tool should start in the directory

{DAZ root}/data/DAZ 3D/Genesis 8/Female/Morphs/

by default, so the Aiko 8 directory is only two clicks away. (If several root directories have subdirectories with Genesis 8 Female morphs, the tool may pick something that is far away from the right directory. That is a nuisance.).

Do not pick the CTRLAiko8.duf file. As explained above, it contains pointers to the FBM and FHM files, and the morphs are not loaded, at least not in version 1.5.1.

Pick instead the FBM and FHM files in the same directory directly.

Now the two Aiko morphs are loaded, and we can turn them on in the Custom Morphs panel. Notice that the brows and eyes are now aligned with the armature. Also notice that the shapekeys are driven, i.e. the sliders are purple. This will be important below.

Just importing the nude character is not so interesting, we want to add clothes and hair too. So let us import them with the Import DAZ File button, with Mesh Fitting set to Unmorphed this time.

Clothes and hair are imported, but clearly they do not fit the character. So again we use the Transfer Other Shapekeys tool.
Select all meshes (clothes, hair and eyelashes) and make sure to transfer all morphs.
The transfer settings are not so important. What is important is that we turn off the morphs in the Custom Morphs panel before making the transfer. If some shapekeys are left at a non-zero value, the result of the shapekey transfer can be a disaster.


This problem did not appear for the previous character, because in that case the shapekeys were not driven. The Transfer Other Shapekeys tool automatically turns all shapekeys off before transfer and turn them on again once the transfer is complete. However, if the shapekey values are driven, this does not work, and we must turn them off manually instead.

Once the morphs have been transferred, we can turn the morphs back on a gain.
And finally we Apply All Shapekeys to get our final character. A fully dressed, rigged and morphed character has been created in Blender, without ever opening DAZ Studio.

Monday, March 22, 2021

Easy Import

After we have imported a DAZ character into Blender, we usually need to perform a number of operations on it before it is suitable for animation. The philosophy behind this is that the add-on can not foresee the need of every user, so the best thing is to import the scene as faithfully as possible, and then provide tools to turn the raw import into something useful. However, this flexibility can make it difficult to choose which tools to use and in which order. The new tool "Easy Import DAZ" is provided to facilitate import in the most common case, a single human character in rest pose.

We emphasize that flexibility is traded for simplicity, and there are limits to what can be done with the new tool.
  • Easy Import DAZ is mainly intended for importing a single human character in rest pose. There are no guarantees if the scene contains something else, e.g. multiple characters, characters not in rest pose, animals, environments, props. Things may work, or they may not.
  • The tool can import standard morphs (face morphs, body morphs, JCMs) but not custom morphs. Adding custom morphs to the character or its geografts must be done in a separate step afterwards.
  • The tool has options for merging geografts and eyelashes to the main character. However, if those have been merged, it is not possible to add further morphs because vertex numbers have changed. If you plan on adding custom morphs after import, you must the disable the Merge Geografts and Merge Lashes options.
  • Easy Import DAZ has an option to convert the native DAZ rig to the more animator-friendly MHX and Rigify rigs. However, again it is not possible to add more morphs after the rig has been converted.
  • Easy Import does not work with nested geografts. E.g., Roasty is a geograft for Futalicious, which in turn is a geograft for female characters. In this situation you must uncheck the Merge Geografts option, and instead merge the geografts in a two-stage process afterwards.

When we invoke the Easy Import DAZ tool, a file selector with many options appear. This lets us decide how the character is treated during and after it is imported into Blender.

  • Mesh Fitting: This option is the same as for the Import DAZ button, see this.
  • Viewport Color: This option is the same as for the Import DAZ button, see this.
  • Rig Type:
    •   DAZ: Leave the native DAZ rig unchanged.
    •   Custom Shapes: Add custom shapes to the native DAZ rig.
    •   MHX: Convert the rig to MHX.
    •   Rigify: Convert the rig to Rigify.
  • Mannequin:
    •   None: Don't add a mannequin.
    •   Nude: Add a mannequin for the body mesh only.
    •   All: Add a mannequin for all meshes.
  • Merge Materials: Merge identical materials into a single material.
  • Merge Rigs: Merge clothes rigs with the main character rig. 
  • Merge Toes: Merge the individual toe bones into a single toe bones which moves all bones.
  • Merge Geografts: Merge geografts to the main character. Body shapekeys (JCMs and flexions) are transferred to the geografts first.
  • Merge Lashes: Merge eyelashes to the main character. Face shapekeys are transferred to the eyelashes first.
  • Extra Face Bones: Add an extra layer of face bones, which remain posable after face morphs have been loaded. This is done before morphs are loaded.
  • Make All Bones Poseable: Add an extra layer of poseable bones for bones that are driven. This is done after morphs have been loaded.
  • Convert Hair: Convert strand-based hair (SBH) into particle hair in Blender.
  • Face Units: Import face unit morphs.
  • Expressions: Import expression morphs.
  • Visemes: Import viseme morphs.
  • FACS: Import FACS units morphs.
  • FACS Expressions: Import FACS expression morphs.
  • Body: Import body morphs.
  • JCMs: Import JCMS (joint corrective morphs).
  • Flexions: Import flexion morphs.
  • Transfer Shapekeys (only visible if JCMs or Flexions is selected): Transfer JCMs and flexions to all clothes. Shapekeys are always transferred to geografts and eyelashes before merging irrespective of this setting.

After a little wait, a fully rigged character appears which can be posed with a few clicks. This character was imported in 212 seconds, complete with face units, expressions, visemes and JCMs, and converted to the MHX rig.

Tip: It can take quite a while to import a scene with the Easy Import DAZ tool. You can follow the progress in the system console. This is normally not visible unless you start Blender from a command prompt, but it can be made visible from the Window > Toggle System Console menu.

Wednesday, March 3, 2021

New Morph System

Loading morphs and their associated drivers was done with one of the thorniest pieces of code in version 1.5 of the DAZ Importer. The code had grown organically over the years, with patches layered on patches. A major goal of version 1.6 is a complete rewrite of the morph system, something that is now almost done. There are still some known issues, but most things seem to work, in some aspects considerably better than before.

The new morph system is based on two suggestions.

engetudouiti suggested to use intermediate properties, to mimic how formulas are evaluated in DAZ Studio. I was initially skeptical about this idea because I was worried about update problems, but so far I have not encountered any. The old morph system attempted to flatten this hierarchy by computing the intermediate properties at load time. This worked reasonably well for most morphs, but for the recently introduced FACS morphs the size of the drivers blew out of propertions. 

Xin pointed out that the drivers can be rewritten solely in terms of simple expressions, using even more intermediate properties that are eventually added with a sum driver. Unlike scripted expressions which are limited to strings with less than 512 characters (used to be 256), sum drivers do not have a limit on the number of variables. The limitation of scripted expressions was the reason why the custom drivers were introduced in the first place. Using simple expressions rather than custom drivers has several advantages:

  1. Performance is apparently much better, since simple drivers are evaluated in C++.
  2. The drivers can be easily inspected in the driver window.
  3. Animations will work even if the DAZ Importer is disabled, which means that you can send your files to a render farm without including the stripped runtime system.

You can choose whether to use the new simple drivers or the old custom drivers with the global setting Use Python Drivers (the name will change to Use Custom Drivers). However, the custom drivers are deprecated and will probably be removed eventually, even if the custom driver functions will be kept to not break old files.

There are still a number glitches with the new morph system, the most obvious is probably that you can only import morphs of a given type (face units, expressions, visemes, ...) once. For custom morphs, you can only import morphs to a given category once. If you need to import more morphs, reimport the old ones too.

One improvement can be seen already. Most expressions are a combination of a pose of the face rig and a shapekey, but in the previous system the shapekeys were ignored, leading to rather dull expressions. The picture above shows Genesis 8 Female with the Triumph expression, loaded with the old system (pose only) and the new system (pose + shapekey). The expression would be even more interesting if combined with the normal or displacement maps generated by Xin's addon. This is something I hope to implement eventually.