first support for genesis 8.1 skin - bsdf
daz studio 4.15, blender 2.91, commit 3dbccc9
This is not intended to be a complete solution for the pbrskin shader yet. The goal is to get the plugin up and running with the basic features, with a decent approximation to resemble iray. Then we have time to improve.
Here we deal with the bsdf option. The principled option will follow as I get some time.
1. TRANSLUCENCY
We are lucky because translucency it's the same as uber so the plugin already imports it fine. The only issue is that for some reason the plugin also generates a volume node, that needs to be deleted.
# bsdfskin translucency
if iray translucency weight > 0
use daz translucent group
color = translucency color
fac = translucency weight
Below a backlight test, first iray then cycles with the fix.
Comments (35)
-
reporter -
reporter 3. LINEAR AND SRGB COLORS
Please note that in daz studio we can get both linear and srgb colors. For example the sss color is linear for uber, while it is srgb for the pbrskin shader. In the duf file we get the srgb color scaled to 1.0. So for example 63 for the srgb sss color becomes about 63/255 = 0.247 in the duf file.
Please note that we can distinguish linear colors from srgb colors by the "type" field in the duf file. That's "float_color" for linear, and "color" for srgb.
"channel" : { "id" : "Transmitted Color", "type" : "float_color", "current_value" : [ 0.4811565, 0, 0 ] } "channel" : { "id" : "SSS Color", "type" : "color", "current_value" : [ 0.2470588, 0, 0 ] }
Now blender uses the correct linear function, while daz studio uses the 2.2 gamma approximation. See
#19. This means that we have to use the gamma approximation or the linear function depending on the color type.https://entropymine.com/imageworsener/srgbformula/
# this is to convert the "float_color" type in the duf file # this way we get the same linear value as daz studio in blender linear = float_color ** 2.2 # this is to convert the "color" type in the duf file # this way we get the same srgb value as daz studio in blender, that's the hex value if 0 <= color <= 0.04045 linear = color / 12.92 else linear = ((color + 0.055)/1.055) ** 2.4
-
reporter 4. TOP COAT
Again the top coat is similar to uber, apart the srgb values. Then the bsdf top coat implementation is very rude, see
#29. We get some more quality introducing the reflectivity value, and lowering the base mix factor. We can also introduce the bump value since it's there both for uber and pbrskin.
# very basic top coat implementation for bsdf nodes # not much but should do as the principled version anyway if there's a top coat use a glossy bsdf color = top coat color roughness = top coat roughness # here we introduce reflectivity and lower the mix factor, this is useful both for uber and pbrskin # we also introduce the bump factor mix shader fac = top coat weight * 0.05 * reflectivity normal = normal * bump weight if pbr specular glossiness is used roughness = 1 - top coat glossiness
Below an example with the G8F eyes. First iray, then cycles, then cycles with the fix. Not perfect but much better.
-
reporter 5. DUAL LOBE
Well it turns out the uber dual lobe and the skin dual lobe are significantly different. Please see
#25#130for reference.The first difference is in the fresnel effect. If we compare roughness = 1 and reflectivity = 0, then we see that the uber lobe gets reflections, while the skin lobe doesn't. This essentially means that, for the skin lobe, we have to use the daz fresnel group instead of the bsdf fresnel node. The difference is that the daz fresnel group takes into account the surface roughness as real fresnel does. So the pbrskin dual lobe is more realistic.
The second difference is that in the pbrskin both the lobes don't get bumps. Below an example with the G8F lips, the first lobe, then the second lobe in iray. They’re the same and without bumps. This means that we don't have to connect the normal inputs.
There's also some difference in the equations, since lobe 2 seems to be a factor of lobe 1, and the ratio is inverted. Then below the setup. That's the same as uber but with daz fresnel groups, and without normals.
Man I do hate the dual output, that makes everything look so complicated.
# pbrskin equations for the daz dual lobe group # inside the daz dual lobe group we have to use the daz fresnel group weight = dual lobe specular weight ior = dual lobe specular reflectivity * 0.7 + 1.1 roughness 1 = dual lobe specular roughness mult * specular lobe 1 roughness roughness 2 = dual lobe specular roughness mult * specular lobe 1 roughness * specular lobe 2 roughness mult fac = 1 - dual lobe specular ratio
Below an example with the G8F lips, first iray then cycles.
-
reporter 6. FINAL RESULT
At last below it’s a rendering test with Victoria 8.1, where I fixed the face material. First iray, then cycles without the fix, then cycles with the fix. As a first result it seems good enough.
-
repo owner Hopefully most of these things are implemented now, but I don’t have assets with exactly the same settings as you show, so I have surely misunderstood some things. In particular, I am unsure what happens if you enable only one of SSS and translucency.
I disagree about the bump slot in the top coat node, because bump and normal are already mixed. If both are present, the normal map is plugged into the bump node, which in turn is plugged into all other normal inputs.
-
reporter Thank you Thomas for the super fast fix that’s so cool. I’ll check it tomorrow since now it’s bed time.
-
reporter As for commit bdc23cf below is what I found. As for sss, the actual simplification of using a black color for the missing channel seems good to me, if I understand your question.
3. LINEAR AND SRGB COLORS
It seems the linear function is not used for srgb colors. Below an example with the top coat color. It is 240.128.16 in daz, that should be F08010 in blender.
4. TOP COAT
This doesn't seem to be implemented. We need fac = top coat weight * 0.05 * reflectivity. Plus a bump factor. I agree a vector map is needed, if this is why you disagree, to use a scalar was my mistake.
5. DUAL LOBE
The normal is not removed from the first lobe.
-
repo owner The top coat and dual lobe problems should be fixed. I though you were speaking of the ordinary bump channel, not top coat bump. It makes sense to add a slot for top coat bump. I was also using glossy reflectivity rather than top coat reflectivity.
I am confused about the color types. In both Vic8.1, G8F and G8.1F, all colors are of type = float_color, including the diffuse channel. The only channels which have type = color are some preview and outline colors. It can certainly not be right to use linear colors for diffuse. In Genesis 1 the colors have type = color, but that is another shader.
-
reporter Thomas, as shown above in points 2 and 3, the sss color for the pbrskin shader is srgb in daz studio and it’s a “color” type in the duf. This includes v8.1. But you can also apply pbrskin to a cube for tests. This happens for all the colors that are displayed as 0-255 in daz studio, that are srgb colors.
going to test the new commit ..
-
repo owner Sorry, I should have been clearer. In old G8F, all colors are float_colors, except for some preview and outline colors. In Vic8.1 SSS and Top coat colors have type = color. But diffuse is still a float_color.
The plugin is currently specifying if it should use srgb or linear colors for each channel. If this information is already present in the duf file, it should be easier to use that, and also safer if different shader use different color spaces for the same channel. But if it means that diffuse colors in iray become linear something is wrong.
-
reporter As for commit 912e474 the dual lobe is fixed. The top coat bump is fixed. The top coat fac and srgb colors are not. Below an example with top coat.
fac = top coat weight * 0.05 * top coat reflectivity = 0.25 * 0.05 * 0.5 = 0.00625
The top coat should also work the same with the uber shader. As for the bump it's texture * bump factor.
fac = top coat weight * 0.05 * reflectivity bump = top coat bump
Below the full equation for reference that's also reported in point 4.
# very basic top coat implementation for bsdf nodes # not much but should do as the principled version anyway if there's a top coat use a glossy bsdf color = top coat color roughness = top coat roughness # here we introduce reflectivity and lower the mix factor, this is useful both for uber and pbrskin # we also introduce the bump factor mix shader fac = top coat weight * 0.05 * reflectivity normal = normal * bump weight if pbr specular glossiness is used roughness = 1 - top coat glossiness
-
reporter Thomas, it seems the edit button for bitbucket doesn’t work anymore, so I can’t edit my posts. Tried both explorer and firefox. Don’t know if/how we can report this to bitbucket.
-
repo owner OK, think I understand now. In both cases you convert srgb to linear, just using two different formulas. Using the correct formula the color is indeed F08010 in Blender too.
-
repo owner The top coat weight should be ok too now.
-
reporter As for the uber top coat it doesn’t seem to work as well. Below an example. The default normal is zero, while it should get the bump map. Then the fac should be fac = weight * 0.05 * reflectivity = 0.25 * 0.05 * 0.5 = 0.00625, while it is 0.025.
-
reporter Thomas, the post above on the uber top coat is before the new commit 7f90b86. I’m going to check the new commit ..
-
reporter As for commit 7f90b86 I can confirm the uber top coat issue above, though fac is 0.0125 instead of 0.025, but it should be 0.00625 as explained above.
The bprskin top coat works fine. Also the srgb colors work fine.
-
repo owner Are you sure you updated? I get something which is close to 0.00625.
-
reporter Thomas, I now tested commit 4e0374f. I included two test scenes that you can use, uber-top.duf and skin-top.duf. The pbrskin top coat works fine and it is probably what's in your picture. Then the uber top coat gets the issues reported above.
Also please note that the uber top coat gets a bump map with the bump factor, while the pbrskin top coat only gets a bump factor then the bump map is shared with the diffuse channel. May be this is why the plugin gets confused.
As a side note it is probably better to use the scale operator inside the top coat group to multiply a scalar with a vector.
Below it is how the uber-top.duf test scene is imported with commit 4e0374f.
And below it is how it should be in my opinion. I will probably get a better bsdf top coat in the time coming. But I want to first close this one and do the principled pbrskin. So I need to sort things.
-
reporter - attached uber-top.duf
- attached skin-top.duf
-
reporter - attached bump.jpg
This is the bump map used in the test scenes. Please note that the bump height in the uber shader depends on the texture size. While we use a fix 0.0002 distance that's good for 2K textures and works fine with daz figures. I may have some ideas about the relation between the texture size and the bump map, but I'd like to close the pbrskin first.
-
repo owner I hope everything is fixed now. I also tried to insert textures everywhere where it is possible, and it seems to work too.
-
reporter As for commit de3d591, the pbrskin top coat is fine, but the uber top coat counts the bump factor twice. We need to either multiply the texture, or use the bump factor. Also I’d insist for using scale inside the top coat group as shown above, since this is what the scale operator is for. I’m not sure that multiply does the same.
-
repo owner Should work now.
-
reporter Thomas, I’m afraid commit a42c471 doesn’t work either. I tried with bump 0.7 for diffuse and 0.5 for top coat, this way 0.7 is plugged into 0.5 that’s not good. Test scene included uber-top-2.duf. If adding a bump factor to the top coat group is too difficult for the code to handle, then an external factor is ok as well, if it makes the code clean.
If you go for the top coat factor, then again please use scale to multiply a scalar, since this is what scale is for.
-
reporter - attached uber-top-2.duf
-
repo owner OK, the normal input of the top coat bump node is left unused. I was unsure what the right thing to do was.
-
reporter Nope, now commit 096d210 plugs the bump map into the top coat, even if the top coat has no bump map. In the example below I only used the bump for diffuse. May it be it’s better to give up the group factor ?
-
reporter Nope, now commit 6ce279b doesn’t connect the pbrskin bump. Please note that pbrskin shares the bump with diffuse, while uber doesn’t. The test above is with uber, the test below is with pbrskin, the test scene is skin-top.duf.
We have to test uber with and without bump for top coat and diffuse. Then test pbrskin with and without the shared bump. Or give up the top coat bump factor and use an external factor instead. Also, for the top coat group, scale is better than multiply for scalars.
-
repo owner Sigh. This was more difficult than I thought. Now I have tested with four cases:
- Uber, top coat bump. A separate bump node is created and linked to the top coat.
- Uber, no top coat bump. Nothing linked to normal, and bump value = 0.
- Pbrskin, bump strength = 1. The main bump node is linked to top coat.
- Pbrskin, bump strength < 1: A separate bump node with same texture but strength = 1 is created and linked into top coat. Perhaps one should instead link the main bump and correct the bump factor of the top coat node instead.
In all cases, if there is a normal map it is linked to the top coat bump node.
-
reporter Thomas you got it, commit bf46499 works fine as for the bump factor. I don’t like the vector multiply for a scalar but it works anyway so it’s fine. Then scale instead of multiply would be better.
-
reporter 5. DUAL LOBE MISTAKE
Sorry I did a mistake because I was testing the pbrskin shader with a bump factor but without a bump map. The two lobes both get bumps. So we have to connect the normal inputs in the pbrskin dual lobe. Below we see lobe 1 and lobe 2 with a bump factor and a map.
-
repo owner OK, implemented in last commit. Just to be clear, the second lobe has no normal input in the uber case?
-
reporter - changed status to resolved
Yep, uber gets the second lobe without bumps, just tested again to be sure but anyone can check it using the dual lobe specular ratio.
As for commit 18ccf54 it works fine. Eventually I'll report further improvements or bugs with pbrskin in separate issues. Thank you Thomas for the nice implementation and for your patience.
- Log in to comment
2. VOLUME
The volume seems the same as uber too. Please note that the daz volume group uses the black color when there's no transmission or no scatter. This works fine and simplifies things, instead of removing the extra nodes. See
#117for the uber version.The pbrskin seems to have more scattering so I changed the factor.
Below a rendering test, first iray then cycles.