fix: clamp 0 at last output (#2243)

This commit is contained in:
zhuxudong
2024-07-18 12:23:06 +08:00
committed by GitHub
parent f5dc3bd6bb
commit 9c9d84a184
2 changed files with 2 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ vec4 gammaToLinear(vec4 srgbIn){
}
vec4 linearToGamma(vec4 linearIn){
linearIn = max(linearIn, 0.0);
return vec4( pow(linearIn.rgb, vec3(1.0 / 2.2)), linearIn.a);
}

View File

@@ -34,9 +34,7 @@ vec3 envBRDFApprox(vec3 specularColor,float roughness, float dotNV ) {
vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;
// AB may less than 0 at high roughness, ref: https://github.com/galacean/engine/pull/2173
return max(specularColor * AB.x + AB.y, 0.0);
return specularColor * AB.x + AB.y;
}