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 committed by Bastien Montagne
parent f1a4e130b3
commit d564beda44
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);