From 3e09b9b3353bcaf2b60b4bd3ef3fb2c5a9189ad8 Mon Sep 17 00:00:00 2001 From: Ferenc Arn Date: Fri, 29 Sep 2017 10:57:00 -0400 Subject: Fix clearcoat without Schlick-GGX specular. Fixes #11698. --- drivers/gles3/shaders/scene.glsl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 5c7cfecf3e..7de9b02b8d 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1013,7 +1013,7 @@ LIGHT_SHADER_CODE #elif defined(SPECULAR_DISABLED) //none.. -#else +#elif defined(SPECULAR_SCHLICK_GGX) // shlick+ggx as default float alpha = roughness * roughness; @@ -1056,6 +1056,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); -- cgit v1.2.3