summaryrefslogtreecommitdiff
path: root/drivers/gles3/shaders
diff options
context:
space:
mode:
authorAndreas Haas <Hinsbart@users.noreply.github.com>2017-10-02 22:51:51 +0200
committerGitHub <noreply@github.com>2017-10-02 22:51:51 +0200
commit1e9465096d9c738057aad81d5046b85777155f87 (patch)
treeb4409743741fad1ad5bac6625ac9e3c68f67433f /drivers/gles3/shaders
parent359704bccf6b68c17f4c405685a01b5ed975bea1 (diff)
parent3e09b9b3353bcaf2b60b4bd3ef3fb2c5a9189ad8 (diff)
Merge pull request #11700 from tagcup/clearcoat_fix
Fix clearcoat without Schlick-GGX specular.
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r--drivers/gles3/shaders/scene.glsl8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 41d5ef5bc9..dee5994124 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1014,7 +1014,7 @@ LIGHT_SHADER_CODE
#elif defined(SPECULAR_DISABLED)
//none..
-#else
+#elif defined(SPECULAR_SCHLICK_GGX)
// shlick+ggx as default
float alpha = roughness * roughness;
@@ -1057,6 +1057,12 @@ LIGHT_SHADER_CODE
#endif
#if defined(LIGHT_USE_CLEARCOAT)
+# if !defined(SPECULAR_SCHLICK_GGX)
+ vec3 H = normalize(V + L);
+ float dotLH5 = SchlickFresnel( dotLH );
+ float dotNH = max(dot(N,H), 0.0 );
+# endif
+
float Dr = GTR1(dotNH, mix(.1,.001,clearcoat_gloss));
float Fr = mix(.04, 1.0, dotLH5);
float Gr = G1V(dotNL, .25) * G1V(dotNV, .25);