[Bf-blender-cvs] [b4ad0151c33] blender2.8: Eevee: Fix issues with alpha blending
Clément Foucault
noreply at git.blender.org
Thu Jan 4 10:53:43 CET 2018
Commit: b4ad0151c336ae490e2794b361ba601a58f4ae5e
Author: Clément Foucault
Date: Wed Jan 3 13:28:38 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBb4ad0151c336ae490e2794b361ba601a58f4ae5e
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.
===================================================================
M source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
===================================================================
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 */
More information about the Bf-blender-cvs
mailing list