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>2017-09-12 15:19:57 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-09-12 15:25:04 +0300
commitf2b3e1f7127681db97501777dcb1d169fd1e86a5 (patch)
tree34a8a1903c2364eefc5ea866f2d38292bfc67526 /source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
parent7a6f9ab587e6e7b7daead5c84a31343ed3e6184d (diff)
Eevee: Fix T52480: Can't reproduce Metallic transparency with Principled + Mix Shader
You can now use a transparent shader as a completly transparent bsdf. And use whatever alpha mask in a mix shader between a transparent bsdf and another bsdf.
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.glsl9
1 files changed, 9 insertions, 0 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 92d4b5aaed0..38dc886dd7d 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
@@ -568,6 +568,9 @@ struct Closure {
int ssr_id;
};
+/* This is hacking ssr_id to tag transparent bsdf */
+#define TRANSPARENT_CLOSURE_FLAG -2
+
#define CLOSURE_DEFAULT Closure(vec3(0.0), 1.0, vec4(0.0), vec2(0.0), -1)
uniform int outputSsrId;
@@ -585,6 +588,12 @@ Closure closure_mix(Closure cl1, Closure cl2, float fac)
cl.ssr_normal = cl2.ssr_normal;
cl.ssr_id = cl2.ssr_id;
}
+ if (cl1.ssr_id == TRANSPARENT_CLOSURE_FLAG) {
+ cl1.radiance = cl2.radiance;
+ }
+ if (cl2.ssr_id == TRANSPARENT_CLOSURE_FLAG) {
+ cl2.radiance = cl1.radiance;
+ }
cl.radiance = mix(cl1.radiance, cl2.radiance, fac);
cl.opacity = mix(cl1.opacity, cl2.opacity, fac);
return cl;