[Bf-blender-cvs] [0e7409d466f] master: EEVEE Shader comments: Explain why material gets darkened when using mix shader

Dalai Felinto noreply at git.blender.org
Tue Feb 19 22:51:37 CET 2019


Commit: 0e7409d466f25f70674151b5fe62177104938729
Author: Dalai Felinto
Date:   Tue Feb 19 18:33:46 2019 -0300
Branches: master
https://developer.blender.org/rB0e7409d466f25f70674151b5fe62177104938729

EEVEE Shader comments: Explain why material gets darkened when using mix shader

We are still ditching the specular intensity of SSR (ssr_data.xyz).
But at least now there is some comment about it.

See T61704 for user reports on that matter.

Comments with the blessing of Clément Foucault.

===================================================================

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 28ffe37abf1..64473d93054 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
@@ -741,16 +741,23 @@ Closure closure_mix(Closure cl1, Closure cl2, float fac)
 #    endif
 #  endif
 	}
+
+	/* When mixing SSR don't blend roughness.
+	 *
+	 * It makes no sense to mix them really, so we take either one of them and
+	 * tone down its specularity (ssr_data.xyz) while keeping its roughness (ssr_data.w).
+	 */
 	if (cl1.ssr_id == outputSsrId) {
-		cl.ssr_data = mix(cl1.ssr_data.xyzw, vec4(vec3(0.0), cl1.ssr_data.w), fac); /* do not blend roughness */
+		cl.ssr_data = mix(cl1.ssr_data.xyzw, vec4(vec3(0.0), cl1.ssr_data.w), fac);
 		cl.ssr_normal = cl1.ssr_normal;
 		cl.ssr_id = cl1.ssr_id;
 	}
 	else {
-		cl.ssr_data = mix(vec4(vec3(0.0), cl2.ssr_data.w), cl2.ssr_data.xyzw, fac); /* do not blend roughness */
+		cl.ssr_data = mix(vec4(vec3(0.0), cl2.ssr_data.w), cl2.ssr_data.xyzw, fac);
 		cl.ssr_normal = cl2.ssr_normal;
 		cl.ssr_id = cl2.ssr_id;
 	}
+
 	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);



More information about the Bf-blender-cvs mailing list