Material issues ?

Issue #154 resolved
Alessandro Padovani created an issue

Thomas, if you can explain what you're trying to do with materials may be I can help. Actually I see some confusion there specifically in the new DAZ Translucent and DAZ Volume nodes. I didn’t dare to test further yet.

There are two ways to do volumetrics:

  1. using translucency + volume that's good for cycles since it exactly mimics what iray does.
  2. using sss alone that's good for eevee since it doesn't support volumes. Here sss replaces translucency + volume.
  3. If volume is not used in iray then translucency alone is the way to go and it's supported both by eevee and cycles for bsdf nodes. Then the principled shader doesn't support translucency so a sss approximation may be used for the principled option.

So the new DAZ Translucent node is unnecessary it just complicate things.
With the principled option eevee can use the principled sss, while cycles will use translucency + volume.
With the bsdf option eevee can use the bsdf sss, while cycles will again use translucency + volume.

edit. Also mixing the principled node with translucency is a bug because this way translucency comes as last pass. While in iray the last pass is specularity. This means for example that a high translucent material will lose specularity in blender while it will not in iray.

Comments (35)

  1. Alessandro Padovani reporter

    As a little final optimization if the output is the same we could use the “All” output as before.

  2. Alessandro Padovani reporter

    Then honestly I don't see joining cycles and eevee materials as a good option. Because cycles materials aren’t generally supported by eevee, especially where volume and refraction are used extensively. Then people using eevee may prefer a clean principled setup with no cycles nodes around. To get the idea below is what I personally do with the old material options as for commit 9f28bf0.

    To work in cycles I prefer a full bsdf setup to best mimic all the iray properties. This generates complex setups.

    automaterial on
    bsdf solid
    bsdf refraction
    volumetric volumes
    

    To work in eevee I prefer a clean principled approximation that can then be easily fixed if necessary. This generates easy setups.

    automaterial off
    prncipled solid
    principled refraction
    sss volumes
    

  3. Thomas Larsson repo owner

    I think you overestimate the average user of this plugin. There may be a few people who know the target render engine on load time, but most people, myself included, would expect renders to remain reasonably okey if they change engine. If you load a character with volumetrics or translucency in Cycles, she will look horrible if you switch to Eevee.

    Putting the nodes into node groups also hides the mix nodes that litter the node tree, making the node tree much more readable. Yes, there are now two mix nodes instead of one, but they are not visible on the top level.

    Specifically about translucency/sss node. One could use the sss slot in the principled shader for eevee, but wouldn’t that change the cycles render as well? If you set volumetrics = SSS and opaque = Principled, no translucency node is generated and the SSS slot in the principled shader is used.

  4. Thomas Larsson repo owner

    Two more things. I think that the Cycles node tree generates identical results as before, unless some bugs have crept into the code. That is at least the intention.

    Also, I don’t think that the extra nodes generate any overhead when rendering. The node tree should be evaluated backwards, starting from the output node, so nodes that are on a different path don’t contribute.

  5. Alessandro Padovani reporter

    The example above is what happens with principled + principled + volumetric with automaterial. It's the G8F torso surface. In this case the DAZ Translucent node is generated and it "overwrites" the principled specularity.

    Then if I try bsdf + bsdf + volumetric with automaterial I get an error. This is always importing a plain G8F.

  6. Thomas Larsson repo owner

    The bug with the refraction node has been fixed. As for the translucency issue, I am not so sure. The plugin now generates extra nodes for translucency, diffuse overlay, and dual lobe after the principled node. This is how it has been for a long time.

    You can get rid of the translucency group by setting volumetrics = SSS, but if you do ask for translucency, I think you should get it, at least in Cycles. I have thought of skipping that node for Eevee altogether. As I said above, you cannot use the subsurface slot in the principled node for Eevee without changing it for Cycles as well.

    Diffuse overlay is necessary also with the principled node, because otherwise Victoria 8 eyebrows will be missing. Dual lobe can perhaps be skipped with principled.

    The plugin also generates a separate transparency group for cutout opacity if there are nodes after the principled one. This was necessary e.g. for eyelashes with dual lobe.

  7. Alessandro Padovani reporter

    As for commit f8b66e6 I can confirm that the error above is fixed. Then below is what I mean about the DAZ Translucent node. I maxed out the G8F translucency and specularity to show it better and imported in cycles with prin + prin + vol. The specularity is lost. Below you can see iray vs cycles. Test scene included.

    The two options I use most seem to work fine though, that are prin + prin + sss and bsdf + bsdf + vol.

  8. Alessandro Padovani reporter

    As for commit f8b66e6 it also seems that if I use bsdf + bsdf + vol with eevee then I get principled instead. Now I don’t know if this is a bug or the intended behavior. But since the new setup is engine independent I don’t get why the material options should be affected by the active engine anymore. The example below is always the G8F torso material.

  9. Thomas Larsson repo owner

    There was a lot of old code left. Now the selected framework is always used, with two exceptions:

    1. Thin walled + translucency uses BSDF (do we really need to check for thin walled?)
    2. Metallicity uses Principled.

    If the active render engine is Eevee, or if we used the principled framework, always use SSS and no volume.

    The plugin currently generates volume nodes even for principled, even though no translucency is present. Does this make sense?

    What about dual lobe? Is it ok to generate a dual lobe group in the principled framework?

    Here are test renders with four different settings, all with volumetrics on. The three cases which generate SSS are similar and far to light.

  10. Alessandro Padovani reporter

    Thomas, to be clear, I still believe that joining cycles and eevee is not a good option for the reasons explained above. Then since you seem you want to go that way I'll try to help.

    1. Yes we need to check for thin walled because this tells us if volume is used or not. Then using bsdf for translucency is better than principled, but this is not mandatory. I mean, for principled we could use the sss approximation instead for the sake of setup simplicity. And this could make definitely sense if the user selected the principled option with no automaterial for example.

    2. Yes this is required for easy metals. I mean, we could make metals with bsdf nodes too, but this requires a complex setup so using principled is the easy way to go.

    3. I do not agree on checking eevee as the active engine. This doesn't make sense since the new setup is device independent, that is, it always have both the eevee and cycles outputs. As for always using sss with principled this makes sense to me, but in this case the material options should be "redesigned".

    I mean for materials simplification we could provide just two options, "global bsdf" and "global principled". Where "global bsdf" is the equivalent of "bsdf + bsdf + vol + automaterial on" and "global principled" is the equivalent of "prin + prin + sss + automaterial off". This makes sense since global bsdf is good for cycles and exactly matches iray as far as we can go, while global principled is good for eevee though it is an approximation of iray.

    4. No, it doesn't make sense to generate volume nodes if the translucency node is not generated. The volume nodes only work with translucency.

    5. Well yes and no. The dual lobe can be mixed with principled and it should work fine enough since specularity is a final pass in iray. But it is also true that principled is meant to be used alone, it has its own clearcoat channel though this fits more to the iray top coat.

    I mean if we choose to go for the "global principled" option, where it is intended to work fine with eevee though being a iray approximation, then it may make sense to drop dual lobe for "global principled", and keep it for the "global bsdf" option intended for cycles.

  11. Alessandro Padovani reporter

    As for point 5 above it is also true that if the daz figure only uses dual lobe then we lose the whole specularity if we drop it. So may be it is a better option to keep it for principled too.

  12. Alessandro Padovani reporter

    6. As a side note the “translucency only” option for volumes only works fine in a hdri environment with no strong backlights. Because it is a thin walled approximation and has no real volume. So since the new sss option works fine enough we may decide to drop the “translucency only” option. Also we can drop it if we go for the “global bsdf” and “global principled” options above.

  13. Alessandro Padovani reporter

    As for commit 26701a6 there's no need to use principled to get the top coat. This was fixed in #29 with a bsdf implementation for top coat needed to avoid the translucency bug. Indeed if I turn off automaterial the bsdf top coat is generated and the eyes render fine.

    If I don’t miss something I guess automaterial is used only for metals at his stage. So it only makes sense for the global bsdf option, while the global principled option is not affected by automaterial. Thomas this is to be verified in the code please, and if this is true then automaterial can be dropped. It is always on for bsdf and not used for principled.

  14. Thomas Larsson repo owner

    Auto Materials currently affect three things:

    1. Thin walled + translucency: BSDF, to get translucency in cycles.
    2. Thin walled + refractive: Principled, to get the clearcoat approximation for eye materials. One could perhaps use the top coat group instead.
    3. Metals: Principled.

  15. Alessandro Padovani reporter

    Then it is confirmed that automaterial is only used for bsdf.

    point 1. The principled option uses the sss approximation for translucency. edit. I have to investigate better the thin walled case. We may not have defined a principled solution for it, may be it’s enough to set the radius to 1,1,1. Or mix a translucent node. More on this later.

    point 2. Yes the top coat group is the way to go for bsdf this is what we did it for. Actually I’m investigating bsdf thin glass though that seems to have issues, apart the top coat I mean. More on this later. I have to compare with the glass equations and commit 9f28bf0 that’s the last available with the old material setup.

    point 3. Metals is always principled, this affects only the bsdf option.

  16. Alessandro Padovani reporter

    As for point 1 I can confirm that commit 91a6f91 doesn't handle the thin walled case for principled translucency. Even if I set on automaterial the translucency is not generated. I used as example a G8F with thin walled on for the skin material.

    I believe the best option for principled translucency is to use a sss approximation in the principled shader, so we preserve the principled specularity. If we mix a translucency node instead then we lose the specularity so this must not be done.

    The following equation adds the thin walled case to #129 to approximate translucency. It works in line with the actual sss quality. More improvements are to come for sss but since here we're focusing on the new setup I don't want to add too much complexity to this right now.

    # same as no.17
    # for principled sss
    blender sss color = translucency color
    blender sss scale = translucency weight
    
    # same as no.17
    # for bsdf sss
    # here the mix factor is used instead of the scale to match the principled shader
    blender sss color = translucency color
    blender sss scale = 1
    blender sss mix = translucency weight
    
    # compared to no.17 this adds skin translucency effects
    # for eevee sss translucency must be anabled and better shadow precision is required
    # the transmitted color is responsible for translucency so it is added to the sss color
    # an average 0.02 translucency factor is used because I'm not able yet to compute it from the iray volume density
    
    # APPROXIMATE TRANSLUCENCY ONLY THIS IS ADDED THE REST IS THE SAME
    if thin walled == on
        blender sss radius = 1,1,1
    # white or black colors disables transmission as well as scattering and sss radius goes to zero
    else
        if transmitted color == white then transmitted color = black
        if sss color == white then sss color = black
        if iray chromatic mode
            blender sss radius = (sss color + transmitted color) * 0.02
        else if iray mono mode
            blender sss radius = (sss amount + transmitted color) * 0.02  # sss amount can be greater than 1
        endif
    

  17. Alessandro Padovani reporter

    As for point 2 I can confirm that in commit 91a6f91 there's an issue with the bsdf glass. It seems the same in commit 9f28bf0 so I don't know where it started. I take as example the G8F eyes, for the eyemoisture material only the refraction is generated, that of course has no sense as a bsdf setup.

    The bsdf equations are below, they include the thin walled case, and they use the classic fresnel + refraction + glossy setup for bsdf nodes. We have to use them for bsdf.

    # bsdf glass equations (iray refraction = 1)
    
    bsdf fresnel ior = iray refraction index
    bsdf fresnel roughness = iray glossy roughness ^ 2
    bsdf glossy roughness = iray glossy roughness ^ 2
    bsdf refraction ior = iray refraction index
    
    # if share glossy input is on then volume and surface roughness are the same
    bsdf refraction roughness = iray glossy roughness ^ 2
    
    # if share glossy input is off then volume and surface roughness are different
    bsdf refraction roughness = iray refraction roughness ^ 2
    
    # if thin wallet is on then there's no volume
    bsdf refraction ior = 1
    bsdf refraction roughness = 0
    

  18. Thomas Larsson repo owner

    Now I am confused. I have an old note saying that

        # Metallic/Roughness:
        fresnel ior = 1.1 + iray glossy reflectivity * 0.7
        # Specular/Glossiness:
        fresnel ior = 1.1 + iray glossy specular / 0.078
    

    But this is a fresnel node that mixes diffuse and glossy, and it is eliminated now because the refraction strength = 1. Should there be a separate glossy node for refraction, or should the same node be mixed with both diffuse and refraction?

  19. Thomas Larsson repo owner

    The first issue is fixed now anyway, even if a better solution may be at hand later.

  20. Alessandro Padovani reporter

    Thomas those notes are for solid materials not for refractive materials. Below there’s the complete set. For bsdf refractive we have to follow the bsdf glass equations and setup reported above.

    # solid material equations (iray refraction = 0)
    
    principled specular = iray glossy reflectivity * iray glossy layered weight * iray glossy color / 0.8
    principled roughness = iray glossy roughness
    
    bsdf glossy color = iray glossy color * iray glossy layered weight
    if blender 2.80
        bsdf glossy roughness = iray glossy roughness
    if blender 2.79 
        bsdf glossy roughness = iray glossy roughness ^ 2
    bsdf fresnel ior = 1.1 + iray glossy reflectivity * 0.7
    
    # iray pbr specular glossiness coversion:
    iray glossy reflectivity = iray glossy specular / 0.078
    iray glossy roughness = 1 - iray glossiness
    

  21. Alessandro Padovani reporter

    As for commit 53ff4fe it doesn’t work because the sss radius is zero. For thin walled it has to be sss radius = 1 as reported above. Also for eevee the subsurface translucency is not checked.

    Then I see the bsdf nodes are used. Since it is possible to use the principled shader to get the same as reported above, then it would be a better way to follow the user choice when the principled option is selected, so we don't need automaterial for this.

    p.s. Please also note that eevee is designed around the principled shader, so using bsdf setups with eevee is not optimal and may also introduce unexpected artifacts. This is also and again why in my opinion joining eevee and cycles is not good. It would be better to use global bsdf for cycles and global principled for eevee. Though of course cycles can render principled as well.

  22. Thomas Larsson repo owner

    The refraction issue should be resolved now. I don’t know if it ever worked, but if it did it was a long time ago. I recently removed some old glass groups, but they had not been used for ages.

    When I load G8F the radius is not zero, but it is not 1 cm either. Rather, it depends on the SSS color and transmitted color as you suggested before.

  23. Thomas Larsson repo owner

    I really want it to be possible to switch between render engines. People will do that anyway, and if the result is horrible I will get a lot of error reports. Plus I tend to change engine myself. For best results you of course need to select the setup that is optimal for your target engine, but even if you don’t the results should be acceptable.

    Perhaps one should rename the options though, and call them Optimized for Cycles and Optimized for Eevee. That would probably be easier to understand. Calling the first option bsdf is rather confusing, since the principled node is also a bsdf. Perhaps one could also remove the auto option, and only override the choice for metals. You may lose translucency in cycles that way, but if the option says optimized for eevee that should be ok.

  24. Alessandro Padovani reporter

    Well plain and simple if one wants to switch engines then he must work with the principled shader because bsdf is not good for eevee. This also means that some iray materials will be approximated because principled is strictly pbr while iray is not.

    Then we may have a bsdf option for cycles only with the "cycles" output that will not work in eevee. And a principled option for both cycles and eevee with the "all" output that will work both in cycles and eevee, though cycles will be anyway better especially for refraction, sss and volumes where eevee is limited. That is, cycles renders the principled shader better.

    As for the names bsdf and principled are well estabilished in the blender community. Newcomers will have to learn as usual. But specifying the engine is good. I also agree that the automaterial user option is not necessary anymore since automaterial will be always on and only used for bsdf.

    • bsdf (cycles only, full iray materials)
    • principled (cycles and eevee, limited iray materials)

    edit. Then the principled option will also be easier to export to game engines and other real time pbr engines.

    edit. Then if the idea is to always include both the bsdf and principled setups in all the materials then there's no need for material selection anymore. But this would have two major drawbacks. First the materials will become very cluttered and not easy to handle though the custom nodes may help. Second it will not be possible to use cycles with the principled setup. Honestly I'd go for using bsdf for cycles and principled for both. If the user wants to switch engines then he goes for principled.

  25. Alessandro Padovani reporter

    As for the sss radius I don’t mean 1 cm but 1 as absolute value, that will be one meter I guess. This is for the thin walled case where there’s not sss color and transmitted color because there’s no volume. Thus sss is used for translucency only. In your example you probably don’t have thin walled on.

    Then again this is an approximation in line with the actual sss quality. I have improvements for sss that I need to test some more and I hope to post once the new setup works fine for the basic features.

    p.s. I probably never noticed the bsdf refraction bug since I used to work with the principled refraction. Though I’m quite sure the bsdf equations for refraction were implemented when we worked on glass. But I can remember a number of different glass setups at the time including some experimental ones. So the bsdf equations were probably lost when we dropped things.

  26. Alessandro Padovani reporter

    As for commit 1579a47 the sss translucency doesn’t work because the radius stills zero for thin walled on. The subsurface translucency is checked.

    As for the bsdf glass the new DAZ Refraction node seems good on a quick test, though it works better in cycles because of the eevee refraction limits. But it only appears if I turn off automaterial, while automaterial brings the principled setup that is not needed anymore for the bsdf option.

  27. Alessandro Padovani reporter

    Unfortunately not yet. As for commit b188e28 the principled sss is zero for the thin walled case. Other than that on a quick test it seems fine. Happy mid-august see you back on monday.

  28. Thomas Larsson repo owner

    Now principled subsurface is turned on whenever there would be a translucency group in the bsdf framework. The radius = 1 in the thin walled case, which I still don’t understand. G8F with thin walled turned on takes a long time to render in Cycles, and the result is not good. It looks good in Eevee,though.

  29. Alessandro Padovani reporter

    Commit 145e3f6 seems fine, at least the main features are there.

    As for the radius I’m not sure myself yet. Since with thin walled on we have to mimic a material with no volume, it seemed logical to maximize the sss effect. I’ll do some more tests and let you know what I find out.

  30. Alessandro Padovani reporter

    I discovered some issues with the current way to use sss. I'm marking this as resolved since this discussion is more focused on fixing the new dual output. Then I will start a new sss discussion as soon as I get some reliable results and clear explanations.

  31. Log in to comment