Skip to content

Commit b8850dc

Browse files
authored
Fix brdf.rg may less than 0 (#2173)
* fix: brdf.xy may less than 0
1 parent 12576a2 commit b8850dc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/core/src/shaderlib/pbr/ibl_frag_define.glsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ vec3 envBRDFApprox(vec3 specularColor,float roughness, float dotNV ) {
3434

3535
vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;
3636

37-
return specularColor * AB.x + AB.y;
37+
// AB may less than 0 at high roughness, ref: https://github.com/galacean/engine/pull/2173
38+
return max(specularColor * AB.x + AB.y, 0.0);
3839

3940
}
4041

0 commit comments

Comments
 (0)