The morphs that you can import with DAZ Importer are only half the story. Many morphs also have high-definition (HD) information, which is stored in a dhdm (DAZ High Definition Morph, perhaps) file. The information in a dhdm file is encoded in an undocumented binary format and can not be read by the DAZ Importer. However, Xin has developed an add-on for importing dhdm files, which is colloquially know as Xin's Add-on. This post describes how I use Xin's add-on to generate normal map or displacement map textures, and then assign them to a character.
Installing Xin's Add-on
The source is available in the following repository: https://gitlab.com/x190/daz-hd-morphs . There you can also find compilation details for the .dll under MinGW on windows x64, and documentation.
If you find this addon useful, consider supporting its development and maintenance here: https://xin888.gumroad.com/l/daz_hd_morphs.
The latest version (the main branch) includes documentation in the form of a .pdf in “./blender_addon/documentation/daz_hd_morphs_documentation.pdf”. It includes several step by step examples.
For up-to-date information see further https://bitbucket.org/Diffeomorphic/import_daz/issues/1399/blender-addon-to-generate-rigged-hd-meshes.
Once the HD morphs add-on has been enabled, a tab called HD Morphs appears. It consists of a number of panels. We must also import the mesh that we want to generate normal or displacement maps for.
First we enter the Main Settings.
- Working directory: All textures will be saved in a subdirectory under this.
- Unit scale: The scale factor connecting the DAZ scale to the Blender scale. Since DAZ uses centimeters internally, the default value 0.01 corresponds to meters.
- Base mesh: A drop-down list where we choose the mesh.
If we want to generate normal maps, we enter the Normals/Displacements panel and choose Normals (multires) as the type. There are also other settings that let us specify the generated texture in detail.
In the From morph files panel, press the plus sign to add DAZ HD morph files.
We want to generate normal map files for the standard DAZ expressions, so we navigate to the directory where they are located. We are only interested in the files where the actual shapekeys (at base resolution) are stored, which are .dsf files that being with "eJCM". So we type "ejcm" in the search field and select all files.
After a while the textures have been generated in a subdirectory of the working directory.
Note that separate normal map textures have been generated for seven tiles, 1001 - 1007. In this case this is unnecessary, since only the first tile, which contains the face, is of interest. We can limit the number of generated files if we enable Select UV tiles and only select those tiles that we are interested in.
Import the textures into Blender
Once all textures have been generated, we want ot import them into the Blender materials. However, first need to we import the morphs at base resolution.
With the mesh or rig selected, import the expressions as usual.
Next we open the Advanced Setup > HDMesh panel. It contains three buttons for importing textures generated by Xin's add-on: Load Normal Maps, Load Scalar Disp Maps, and Load Vector Disp Maps.
Navigate to the directory where the normal map textures are located and select those that we want to import. The options are:
- Use Drivers: Drive the strength of the normal maps with the morph strength.
- Smart Tiles: Only add the textures to materials if other textures have the same tile suffix. E.g., the Torso material typically has other textures ending with "_1002", and therefore only normal maps endin in "_1002" will be added to the Torso material.
- Compact Layout: Close the nodes used to connect the normal map textures, thus making the layout more readable.
- Prune Node Tree: Remove unused nodes once the new textures have been added.
- Add Maps To Materials: The affected materials.
In this case we know that the expression textures only affect the face, which is located on tile 1001. Hence we turn off Smart Tiles and set Tile = 1001. Moreover, we deselect all materials except the Face and Lips materials.
The textures are now imported. To the left of the Face-1 node tree we have new normal map textures that are stringed together with overlay nodes.
Note that the factors in the overlay nodes that connect the normal map textures are driven by the morph properties.
Here is the open face smile, without and with the normal map textures.
Xin's add-on can alternatively generate scalar and vector displacement maps. These are imported into Blender in a completely analogous fashion. Here is the options when we import scalar displacement maps.
Displacement maps are stringed together with add nodes (vector math nodes), and the result is directly connected to the material output displacement strength.