Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-01-03 15:28:38 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-01-04 12:43:54 +0300
commitb4ad0151c336ae490e2794b361ba601a58f4ae5e (patch)
tree8aa9a111a34e696fd93cdafeaebd754527c8babb /source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
parentbbf810f96976692abed26cbde897a1e10f11683e (diff)
Eevee: Fix issues with alpha blending
- Hashed Alpha materials were outputing their alpha values even if the final pixel has no blending and thus no transparency. - Opacity was not clamped when using "add closure" nodes.
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.glsl6
1 files changed, 5 insertions, 1 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 37ed2235c6f..218ab5a169a 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
@@ -739,7 +739,7 @@ Closure closure_add(Closure cl1, Closure cl2)
#endif
#endif
cl.radiance = cl1.radiance + cl2.radiance;
- cl.opacity = cl1.opacity + cl2.opacity;
+ cl.opacity = saturate(cl1.opacity + cl2.opacity);
return cl;
}
@@ -774,6 +774,10 @@ vec4 volumetric_resolve(vec4 scene_color, vec2 frag_uvs, float frag_depth);
void main()
{
Closure cl = nodetree_exec();
+#ifndef USE_ALPHA_BLEND
+ /* Prevent alpha hash material writing into alpha channel. */
+ cl.opacity = 1.0;
+#endif
#if defined(USE_ALPHA_BLEND_VOLUMETRICS)
/* XXX fragile, better use real viewport resolution */