Wednesday, August 2, 2023

Blood, Sweat and Tears

 And geografts. Not a trivial combination.

Here we have a messy character in DS. She has the Headlights and Golden Palace geografts with the corresponding shells, and also blood, sweat and tears shells. The geografts have turned white, so something is wrong with them. The problem is that the body shells (blood, sweat and tears) are designed for the body materials but not for the grafts.
Fixing the tears shell is easy. Select the tears shell, and in the Parameters tab go to Shell > Visibility > Surfaces. We see that the shell is enabled on the geograft materials. Turn them off.
We also turn off the Headlights shell on Golden Palace, and vice versa.
Blood and sweat are trickier, because we want them to cover the geograft materials as well. If we leave them on, the geografts turn white. If we turn them off, the grafts become visible but the blood and sweat stop suddenly at the geograft boundary, which doesn't look good either. I am not sure if you can fix this in DAZ Studio, but there is a simple fix in Blender.

Now import the character into Blender. The geografts have turned white.

In the Nipples materials we find three node groups just before the output node, corresponding to the Sweat, Headlights, and Blood shells, respectively.The problem is that the Blood and Sweat groups have the wrong node trees. The nodes generate plain white, because the shell is not designed for the geografts, only for the body materials.
We can fix this by replacing the Sweat_Nipples-2 node group with the corresponding node group for the torso, i.e. Sweat_Torso-6.
Do the same thing for the Blood node group. The geograft shells should of course not be changed, because they were designed to work with the geografts.
Finally, repeat this procedure for all geograft materials. There are not that many because several were merged when the charcter was loaded, but it is still a rather tedious procedure.
Finally we have achieved our goal, and have blood and sweat on both the body and the geografts.

The procedure shown above is straightforward, but in the latest commit it has been automated for convenience. In the Materials section there is the new Fix Shells button, which does precisely the steps above.

Select all geografts that we want to fix, and make the body mesh the active mesh. Moreover, pick the active material from which we will take the node groups.
 
Finally press the Fix Shells button in the Materials section. 
We now have the choice of either fixing the materials of the active mesh, or fix the other selected meshes. Since the geografts have not yet been merged with the body, we leave this option disabled. The geograft materials are fixed automatically.
 
We can also fix the shells after we have merged the geografts. In this case we enable Fix Active Mesh. A list of materials appear, where we select the materials that we want to fix, i.e. the geograft materials.
 
If we have several geografts that cover different parts of the body (and different materials), we can repeat the procedure with different geograft selections and different active materials.