diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-11-06 16:53:54 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-11-07 02:19:14 +0300 |
commit | 8a204ccdb49bd682e41a5d706726c3c77f6217fd (patch) | |
tree | 407ddb63d644dc839b82c7bd1b142a1202590908 /source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl | |
parent | bc1c263a8ada7541b4de2544757b1a765ffab0b3 (diff) |
Eevee: Support monochromatic Transparent BSDF correctly
This fits Cycles better even if it is only for grey scale values. This only
work if the blend mode is Alpha Blend or Alpha Hashed.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl index 1bd9410314b..eb03df67f6b 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl @@ -719,7 +719,6 @@ Closure closure_mix(Closure cl1, Closure cl2, float fac) Closure cl; if (cl1.ssr_id == TRANSPARENT_CLOSURE_FLAG) { - cl1.radiance = cl2.radiance; cl1.ssr_normal = cl2.ssr_normal; cl1.ssr_data = cl2.ssr_data; cl1.ssr_id = cl2.ssr_id; @@ -731,7 +730,6 @@ Closure closure_mix(Closure cl1, Closure cl2, float fac) # endif } if (cl2.ssr_id == TRANSPARENT_CLOSURE_FLAG) { - cl2.radiance = cl1.radiance; cl2.ssr_normal = cl1.ssr_normal; cl2.ssr_data = cl1.ssr_data; cl2.ssr_id = cl1.ssr_id; @@ -752,8 +750,9 @@ Closure closure_mix(Closure cl1, Closure cl2, float fac) cl.ssr_normal = cl2.ssr_normal; cl.ssr_id = cl2.ssr_id; } - cl.radiance = mix(cl1.radiance, cl2.radiance, fac); cl.opacity = mix(cl1.opacity, cl2.opacity, fac); + cl.radiance = mix(cl1.radiance * cl1.opacity, cl2.radiance * cl2.opacity, fac); + cl.radiance /= max(1e-8, cl.opacity); # ifdef USE_SSS cl.sss_data.rgb = mix(cl1.sss_data.rgb, cl2.sss_data.rgb, fac); |