translucency bug (aka bsdf top coat)

Issue #29 resolved
Alessandro Padovani created an issue

As explained in #321 in the old tracker, when translucency is involved we can't use the principled shader. Because the specularity pass always goes last in iray and this is not possible if we use the principled shader together with translucency. So we have to use bsdf nodes instead.

https://bitbucket.org/Diffeomorphic/import-daz-archive/issues/321

Now it seems that when there's a top coat in iray then the principled shader is always used by the auto material option. Even if there's translucency. Even if the user selected bsdf for opaque materials. Also if we switch off the auto material and set bsdf for opaque, then the plugin doesn't import the top coat and just ignore it.

The actual top coat implementation seems rather limited and it only imports the clearcoat and clearcoat roughness in the principled shader. So I guess we can use a simple glossy bsdf for the bsdf option. This should work fine enough or even better since this way we also get the top coat color that's not possible with the principled shader.

# 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
    mix shader fac = 0.1

EDIT. Please note that I didn’t use a fresnel node to drive the top coat. This is on purpose since the reflectivity option on the top coat layer in iray doesn’t seem sensible to the roughness. Also on a quick test a 0.1 fac seems to match better with iray so the equations are updated. Again this is a quick implementation just to avoid the translucency bug, and should do fine at least as the principled shader. It doesn’t deal with the whole set of top coat parameters in iray.

Below an example first iray then cycles, it’s the reflectivity option. Scene included.

Comments (16)

  1. Alessandro Padovani reporter

    UPDATE

    In the implementation above I didn’t take into account the iray weight factor that’s important because it drives the intensity of the effect and it is used in the G8F skin too. So below the updated equations set.

    # 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
        mix shader fac = top coat weight * 0.1
    

    Then below the bsdf top coat with the G8F skin, first iray then cycles. Please Thomas feel free to change anything if you come out with a better implementation. This is quick to solve the translucency bug and it seems to work fine enough for now.

  2. Alessandro Padovani reporter

    Commit 350cb20 works almost fine. Now the auto material uses bsdf nodes with translucency and the new bsdf top coat is used. But there’s an issue when iray uses a texture in the top coat weight channel, as it happens in the G8F. In this case the texture is ignored by the plugin, instead it should be used to drive the top coat factor.

    Below an example, first iray then the actual plugin setup then the fix.

    p.s. Also the top coat doesn’t seem to get the bump normal.

  3. Alessandro Padovani reporter

    Unfortunately commit edfc24f doesn’t seem to work fine. In the G8F example with the torso material it multiplies by 0.45 instead of 0.045. That is, it misses the 0.1 factor. I gave a look at the commit code and I can see the 0.1 factor is there, but for some reason it doesn’t work.

    Just exported a standard G8F but scene attached just in case.

  4. Alessandro Padovani reporter

    There are some cases where pbr specular glossiness is used for toap coat. Below an example with the headlight geograft for the G8F. As for commit 4bfcf3e the plugin doesn’t recognize the top coat glossiness and translates it with a zero roughness that’s wrong. Below the revised equations where I only added the glossiness case the rest is the same.

    edit. Please note that reflectivity is not taken into account yet, as well as the other top coat modes, so this remains a basic implementation.

    # 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
        mix shader fac = top coat weight * 0.1
    
        if pbr specular glossiness is used
            roughness = 1 - top coat glossiness
    

  5. Alessandro Padovani reporter

    This is related to #78 where the NGV7 geograft gets an odd material. The reason is that NGV7 uses a LIE to drive the top coat weight. Now in this case the 0.1 factor is lost. That is, if a LIE is used instead of a normal texture to drive the top coat weight then the multiply node to get the 0.1 factor is not generated by the plugin.

  6. Log in to comment