diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-10-22 13:18:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-22 13:18:24 +0200 |
commit | d60b7749245522e384096d8cf045937ffc91304b (patch) | |
tree | 9960b8212620daa7c988fb02e05abd528b2d9680 /drivers | |
parent | fc09e1436654415f7130b69d049b420d7e5e8d54 (diff) | |
parent | 06fcbe009242b2139e98ef60432240734336bf7b (diff) |
Merge pull request #12297 from tagcup/clearcoat_fix
Don't add clearcoat BRDF to specular light as-is.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 9619dadbdd..317ca91d98 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1073,7 +1073,7 @@ LIGHT_SHADER_CODE float cNdotH = max(dot(N,H), 0.0); float cLdotH = max(dot(L,H), 0.0); -#if defined(LIGHT_USE_ANISOTROPY) +# if defined(LIGHT_USE_ANISOTROPY) float aspect = sqrt(1.0-anisotropy*0.9); float rx = roughness/aspect; @@ -1085,11 +1085,11 @@ LIGHT_SHADER_CODE float D = D_GGX_anisotropic(cNdotH, ax, ay, XdotH, YdotH); float G = G_GGX_anisotropic_2cos(cNdotL, ax, ay, XdotH, YdotH) * G_GGX_anisotropic_2cos(cNdotV, ax, ay, XdotH, YdotH); -#else +# else float alpha = roughness * roughness; float D = D_GGX(cNdotH, alpha); float G = G_GGX_2cos(cNdotL, alpha) * G_GGX_2cos(cNdotV, alpha); -#endif +# endif // F float F0 = 1.0; // FIXME float cLdotH5 = SchlickFresnel(cLdotH); @@ -1115,7 +1115,9 @@ LIGHT_SHADER_CODE float Gr = G_GGX_2cos(cNdotL, .25) * G_GGX_2cos(cNdotV, .25); - specular_light += .25*clearcoat*Gr*Fr*Dr; + float specular_brdf_NL = 0.25 * clearcoat * Gr * Fr * Dr * cNdotL; + + specular_light += specular_brdf_NL * light_color * specular_blob_intensity * attenuation; } #endif } |