better bsdf refraction for eevee

Issue #332 resolved
Alessandro Padovani created an issue

daz studio 4.14, blender 2.91, diffeo a3eb09e

This is related to #326. Here I'll discuss the eevee section for improvement. Cycles is good already. For this purpose I included a test scene. Below there's iray, then cycles, then eevee with the current a3eb09e commit.

We can see that eevee misses both the glass color and refraction. We can also see that cycles is not good with caustics but this is a limit with cycles and we can do nothing.

Before we start we need some better precision for eevee in the refraction section. Those will be our minimal requirements.

I like the idea to use the transparency shader for thin glass, because it's fast and clean, and ior = 1 doesn't use refraction anyway. Now to get eevee working we don't need a special setup, but just good eevee settings. So I removed the eevee output in the DAZ Refraction group. Below the setup. That's the default with just the eevee output removed.

Please note that for thin glass the DAZ Refraction group will use the transparent shader both for cycles and eevee. While for volumetric glass the group will use the refraction shader both for cycles and eevee.

Now below the eevee settings that are needed for the thin glass. Since we don't use refraction then it is not checked. Also we use alpha blend instead of alpha hash, because alpha hash can't show the glass color with transparency. Beware that this also means that there are limits as for the transparency sorting because alpha blend works by sorting objects, not pixels.

Then alpha hash can show the glass color if we use refraction instead of transparency, but this means to give up the transparency for thin glass. So I did not.

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

Then below the eevee rendering with the fix. Now eevee shows both the glass color and refraction. We can see that the screen space reflections are missing though. This seems a limitation of eevee that can't do reflections together with refraction, or with alpha blend. Aslo please note that the shadows are gray. Again this is a limitation of eevee that can't do colored shadows.

Comments (9)

  1. Thomas Larsson repo owner

    Thank you, that was easy to understand. I get a slightly different result for the red ball: there is a strange pattern on one side. Do you have any idea why?

  2. Alessandro Padovani reporter

    That happens to me if I don’t fit the refraction precision as explained above. As for commit 76eb7d1 the eevee settings are not good so the rendering is bad.

    This is the setting for thin glass (thin walled on), where we use transparency. That’s blend + hashed + no backface + no refraction. No backface is needed for alpha blend as explained in the link above.

    This is the setting for volumetric glass (thin walled off), where we use refraction. That’s hashed + hashed + refraction.

  3. Thomas Larsson repo owner

    OK, things work better now. But the pattern on the left side of the red ball is still there, although other problems are gone.

  4. Alessandro Padovani reporter

    The minimum requirement from the plugin is thickness = 0.2 m, it must be 0.02 m as reported above. That’s why you see the pattern. Apart this commit a5d8847 works fine for the eevee settings.

  5. Log in to comment