eevee does not work with the mix shader (blender 2.9 - 3.1)

Issue #927 resolved
Alessandro Padovani created an issue

I submitted this to blender artists. If it comes out that this is a eevee limitation and not a bug, then what this does mean for daz figures is that in eevee the sss effects will be ignored for shells, including geografts. And we may add this information to the docs for the users to be aware of.

note. This is also why in #251 cycles and eevee get different sss effects. Because in eevee the shell radius is ignored. Please note that the sss color works fine, but without the sss radius it doesn’t produce the expected sss effect or “softness“ so it’s just a color overlay over the diffuse color.

https://blenderartists.org/t/eevee-sss-radius-does-not-work-with-mix-shader-blender-2-9-3-1/1370393

This doesn’t seem to be a documented eevee limitation. And it’s around from a while now since both 2.9 and 3.1 get the issue. Didn’t test earlier versions. So before submitting a bug I’d ask for confirmation to others in case I miss something.

The mix shader seems to ignore the sss radius for mix = 1. This happens both with principled and the sss bsdf. Below the setup. On the left there’s mix = 0, on the right there’s mix = 1. We can see that mix = 1 loses the sss radius. Test scene included sss.blend.

https://docs.blender.org/manual/en/dev/render/eevee/materials/nodes_support.html

Comments (12)

  1. Alessandro Padovani reporter

    UPDATE. SOLUTION.

    No reply from blender artists yet but I believe I got my own answer. By reading carefully the eevee limitations it states that blended surfaces ignore all screen space effects. I guess by “blended surfaces” it means the mix shader. This also means that not only sss is affected but all the other eevee screen space effects as ambient occlusion, reflection and refraction.

    This is a big limit for daz shells, that we may want to explain in the docs for the users to be aware of.

    https://docs.blender.org/manual/en/latest/render/eevee/limitations.html

    Screen Space Effects

    Blended surfaces are not considered by these effects. They are not part of the depth prepass and do not appear in the depth buffer.

    Below an example where the screen space reflection only works for mix = 0, same for all the other eevee effects.

  2. Alessandro Padovani reporter

    note. important. This may be another good reason to implement #862. That is, if we have the shell geometry then we don’t need the mix shader. This way the daz shells will work fine with eevee.

    edit. note. important. On a second thought the issue may be more deep since actually we can’t use the mix shader at all if we want eevee to work. This also means makeups and dual lobe for example, not only shells. So #862 is only a partial fix and doesn’t always work. Nevertheless it may be an improvement over the actual situation.

    Please Thomas let us know what you think.

  3. Alessandro Padovani reporter

    note. extremely important.

    Also this means that bsdf materials will never work fine in eevee because they use the mix shader extensively. This goes back to my original plan to use bsdf only for cycles. That is, the dual output is not needed and can’t work anyway because of the eevee limitations. So practically the dual output only complicates the material setup, a lot, without any benefit.

    Unless I miss something.

  4. Alessandro Padovani reporter

    UPDATE. POSSIBLE WORKAROUND FOR EEVEE SHELLS.

    I believe I got a simple workaround.

    Since eevee only works for mix = 0 we may invert the shell fac, so that the shell material plugs at mix = 0. This should work fine enough especially with geografts that use a mask to blend with the underlying material. Below an example with ngv8.duf in #924, also referring to #251. We see that the ngv8 geograft gets the sss effect this way. This should also work fine with the other eevee effects that are restricted to mix = 0.

    note. Please note that with layered shells only the last one will work fine.

  5. Thomas Larsson repo owner

    I put in the invert node in the last commit. Is there a reason why you choose an invert node rather than a math node (subtract)? The Fac inputs of the mix nodes are scalars rather than colors.

    As for dual outputs, I disagree. Ideally a user should know what render engine he is targeting, and not use the bsdf method for Eevee. But in practice not everybody coming from a Daz background will be a CG expert, and somebody will combine Eevee and bsdf. If so, the result should not be terrible. Below is a comparison of Victoria 8.1 with makeup. In the third picture the Cycles path has been connected to the Eevee output, and in the last one the volume is included too.

  6. Alessandro Padovani reporter

    Commit 86f4051 works great thank you Thomas for the fast fix as always. I believe this way eevee gets a nice step forward.

    As for the opacity math it’s the same you can use a math node. I prefer rgb nodes because we are dealing with textures, that is, the opacity map is a texture. Indeed now that you point it I’d use a rgb multiply too instead of the math multiply. But it’s the same.

    As for bsdf for eevee of course it’s not “terrible“. What doesn’t work are the eevee screen space effects, that’s what takes eevee apart from opengl to get the idea. Indeed the ngv8 shell doesn’t get the sss effect if we use bsdf as shown below.

    You know personally I believe the dual output was always a bad idea from the start. That said it doesn’t harm, too much. It’s just unuseful in my opinion and it complicates the setups a lot that I hate to deal with complicate things when there’s no need for them. But I can live with it.

    If it’s easy enough to do I would love a global setting to turn off the dual output. I’ll never use eevee with bsdf it makes no sense to me. But I don’t want to if it is too much work for you since this is not essential.

  7. Thomas Larsson repo owner

    It would be easy to not connect the Eevee slots of the various node groups. Redefining the node groups so they don’t have Eevee slots at all would be more work. Also, I think the standalone node groups work to some degree in Eevee, e.g. the makeup in my Victoria 8.1 example above.

  8. Alessandro Padovani reporter

    Then I'm fine don't want to mess up the code for something that's not essential. Thank you for looking at it anyway, marking as resolved.

  9. Log in to comment