Saturday, June 2, 2018

Material progress

With release 1.3 the Daz importer feels almost complete. I have started to use it for my own personal projects, and there is little that I want to change. However, there is one area that is still problematic: materials. This is not so surprising, because my understanding of Blender materials is poor and of Daz materials is almost non-existent.

Fortunately, recently Daz master Alessandro Padovani has stepped in with a number of bug reports that clarified a number of issues:
  • Daz textures are automatically multiplied with the color. In Blender, this multiplication has to be carried out explicitly.
  • Daz colors are sRGB whereas Blender uses a linear color space. This does not affect textures, which are automatically converted, but it changes pure colors.
  • Depending on the shader, specular maps are put in different channels: glossy color, glossy layered weight, specular color, etc.
However, the most important improvement is in the treatment of bump maps. The following picture illustrates the difference between stable 1.3 and the current development version for a Genesis 8 character, provided that the principled shader is used.



In Blender, the bump node depends on two parameters: strength and distance. In Iray, there is no distance parameter, so in 1.3 I assumed that it was 1 Daz unit, i.e. 1 cm. However, Alessandro figured out that the correct bump distance in Iray is 0.5 mm. In other Daz shaders such as 3Delight, the bump distance (or more exactly, bump max and min values) is explicitly available, and is typically 1 or 2 mm. To eliminate the worst artefacts, version 1.3 had two import options with which one could change the bump strength and subsurface distance, which also affects the bumpiness. Since bump maps are now imported correctly, these options have been removed.

In plain Cycles, without the principled shader, the situation was not so bad, as show in the picture below. However, this was really due to cheating. To avoid the extreme bumpiness, in version 1.3 the bump map only affected the diffuse channel, but not SSS or translucency. In the development version, the bump map affects all three channels, but the skin still looks ok due to the reduced bump distance. This trick was not possible with the principled shader, because it only has one Normal input which affects both base color and SSS.



Another difference is that the transparency option has disappeared in the development version. This was originally introduced for debug purposes, because I did not understand how to handle refraction correctly. In the current version, the refraction channel in Daz is mapped to a Refraction node in Cycles, and to the Transmission input in the principled node if that is enabled. There remains an option to mix the result with a Transparency node, because sometimes the pure result tends to be not so good.

Here is an eye rendered in plain Cycles with the Mix Transparancy Factor set to 0.0, 0.5 and 1.0, respectively.

And here is the same eye, but loaded with Principled Shader enabled.