Fix T53217: GLSL principled BSDF black with zero clearcoat roughness.

This commit is contained in:
Brecht Van Lommel 2017-11-01 17:12:36 +01:00
parent 71f46bc367
commit 07dbff7dc1
Notes: blender-bot 2023-02-14 08:39:23 +01:00
Referenced by issue #53683, 2.79a release
Referenced by issue #53217, Principled BSDF material turns black in the viewport when Clearcoat is set to 1 and the Clearcoat Roughness is set to 0
1 changed files with 5 additions and 1 deletions

View File

@ -2524,7 +2524,11 @@ float schlick_fresnel(float u)
float GTR1(float NdotH, float a)
{
if (a >= 1.0) return M_1_PI;
if (a >= 1.0) {
return M_1_PI;
}
a = max(a, 0.001);
float a2 = a*a;
float t = 1.0 + (a2 - 1.0) * NdotH*NdotH;
return (a2 - 1.0) / (M_PI * log(a2) * t);