Coat IOR and Weight values off the roof by standard

Issue #1909 resolved
Maneki created an issue

I checked the Daz shaders and I don’t know where the 1.5+ values for IOR and weight come from (Refraction Index is 1.38 within Daz for the eye moisture). It looks very unrealistic and should be changed. I usually adjust it for the eyes because there it’s the most obvious but this issue applies to other materials too, like the tears. Eyes usually have a physical accurate IOR of 1.38 but I personally set it a bit lower for Daz eyes (around 1.28). Here’s a comparison with a adjusted version vs original made with G9:

Comments (18)

  1. Thomas Larsson repo owner

    I found the following comment in the code:

     If thin walled is on then there's no volume and we use the clearcoat channel for reflections
     principled ior = 1
     principled roughness = 0
     principled clearcoat = (iray refraction index - 1) * 10 * iray glossy layered weight
     principled clearcoat roughness = 0
    

    With ior = 1.38 and glossy layered weight = 0.4016393, coat weight = 1.526.

    Alessandro can explain better why we did thus, and if this approximation is still valid for Blender 4.

  2. Thomas Larsson repo owner

    Aha. Coat has a separate ior value in Blender 4, which should probably be set to 1 as well. Done in last commit.

  3. Thomas Larsson repo owner

    Yes, using clearcoat to simulate ior for thin walled materials means that ior = 1. We have to wait for Alessandro to chime in, because he is really the brain behind the material conversion.

  4. Thomas Larsson repo owner

    OK, I think I sort of understand what’s going on. In the BSDF method, the eye moisture has a thin wall group with ior = 1.38. However, this is the ior for reflection. If you look inside the group refraction is done by a transparent shader, so refraction ior = 1. Now, the old principled node only had a single ior which was used for both reflection and refraction. Since a thin walled object don’t change the direction of transmitted light rays - it is thin after all - we must set ior = 1 and try to mimic reflection with the clearcoat channel.

    The new principled node has separate ior values for transmission and coat, so we should be able to set ior = 1 and coat ior = 1.38 and get something sensible.

  5. Thomas Larsson repo owner

    I did some tests with our test scene. The blue ball has a thin walled material. To the left the main ior = 1, and coat ior = 1.0 and 1.38, respectively. To the right the same scene in Blender 3.6 and DS. The result is more faithful for the old principled shader, which is perhaps not so surprising since the code was designed for that.

  6. Alessandro Padovani

    Ok I had a look. Thomas what you explain is correct and as intended, the principled clearcoat is used to approximate a thin walled refraction. With principled v2 we can improve the approximation with the equations below. However, as usual, please note that principled has limits compared to iray and bsdf is needed for a good conversion.

    # iray thin walled refraction for principled v2
    # if thin walled is on then there's no volume and we use the clearcoat channel for reflections
    if iray refraction weight == 1 and iray thin walled == 1
        coat weight = iray glossy layered weight
        coat roughness = iray glossy roughness
        coat ior = iray refraction index
        coat tint = iray glossy color
    

  7. Thomas Larsson repo owner

    The new equations are now implemented. To recap, here is the full logic:

    principled ior = 1
    principled roughness = 0
    if BLENDER 3:
      principled clearcoat = (iray refraction index - 1) * 10 * iray glossy layered weight
      principled clearcoat roughness = 0
    if BLENDER 4:
      coat weight = iray glossy layered weight
      coat roughness = iray glossy roughness
      coat ior = iray refraction index
      coat tint = iray glossy color
    

    The blue ball now looks at least a good as in Blender 3.6, but the red ball is still too pale. Any ideas?

  8. Alessandro Padovani

    The issue here was rised for thin walled refraction and the red sphere is not. The principled v2 handles the specular color differently from iray hence the desaturation, again principled is a rough approximation of iray and some difference is expected. But I’ll look at the test scenes in #1368 and let you know what I find.

  9. Alessandro Padovani

    Ok, I had a look. Basically yes, the principled v2 handles the specular color differently from principled and is desaturated, there’s little we can do apart using the specular tint to compensate a little. Below the equations that should be the same we already use, apart we add the specular tint. Please note that in principled v2 the specular tint is responsible for the specular intensity so we also consider the iray glossy layered weight there.

    Of course let me know if something is not clear.

    # iray refraction for principled v2
    # here we consider a volumetric refraction with thin walled off
    if iray refraction weight == 1 and iray thin walled == 0
        if iray share glossy inputs == on
            base color = iray glossy color
            roughness = iray glossy roughness
        else
            base color = iray refraction color
            roughness = iray refraction roughness
        ior = iray refraction index
        specular ior level = 0.5
        specular tint = iray glossy color * iray glossy layered weight
        specular anisotropic = iray glossy anisotropy
        specular anisotropic rotation = 0.75 - iray glossy anisotropy rotations
        transmission weight = iray refraction weight
    

  10. Log in to comment