Wednesday, November 18, 2020

Strand-Based Hair, For Real This Time.

In a previous post I announced that the Daz Importer could import strand-based hair (SBH for short) into Blender. Alas, that turned out to be incorrect. What the importer could import was mesh hair with polylines. Such meshes can be converted into particle hair in Blender, where each polyline corresponds to a hair strand. Proper SBH can not be handled by the Daz Importer, because SBH data is stored in an undocumented binary format in the duf file. For the same reason, the plugin can not import aniblocks, which are also stored in some binary format.

This may not be such a big limitation, because all hairs that I have come across have been of the polyline variety. However, normal users can apparently not convert SBH to polyline hair, so if you create an SBH in Daz Studio the Daz importer can not import it. Until now, but you have to do a special trick.


Create some strand-based hair in Blender.

In the Parameters tab, go to the Line Tesselation section and turn on Preview PR Hairs. Also set Render Line Tesselation Sites = 2. Settings this parameter to 3 will also work, but it increases the size and save time of the dbz file without gaining anything.

Finally Export To Blender to get a dbz file. Since the SBH information in the duf file can not be understood, the necessary information is stored in the dbz file instead. Only up-to-date versions of the export script saves this information.

Import the duf file into Blender, with Mesh Fitting set to DBZ. Particle hair is created.

Here is a render in Blender,

And here is the corresponding DAZ Studio render.

When we turn on Preview PR Hairs, DAZ Studio creates meshes for the strands. When tesselation = 2 the mesh is a long narrow strip, and when tesselation = 3 it is a narrow tube with triangular cross-sections.

The Daz Importer then "untesselates" these meshes, creating one-dimensional polylines instead. But as we mentioned in the beginning, the plugin knows how to convert such polyline meshes into particle hair. So that is how SBH is imported as particle hair in Blender.

Let us finally mention two new global settings in the Hair section: Viewport Children and Render Children control the number of child particles in the generated hair. By default both settings are zero, which gives a good correspondence between DAZ Studio and Blender. Here is a render with Render children set to 0 and 100, respectively.