Skip to content

Commit 134169a

Browse files
committed
Fix normal encoding
sign() returns 0 if the argument is 0 which is not desired in this case
1 parent 49e5304 commit 134169a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shader-chunks/shaders/normal-codec-pars.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
vec2 pp_encodeNormal(vec3 n) {
1010

1111
n /= (abs(n.x) + abs(n.y) + abs(n.z));
12-
n.xy = (n.z >= 0.0) ? n.xy : (1.0 - abs(n.yx)) * sign(n.xy);
12+
n.xy = (n.z >= 0.0) ? n.xy : (1.0 - abs(n.yx)) * vec2(n.x >= 0.0 ? 1.0 : -1.0, n.y >= 0.0 ? 1.0 : -1.0);
1313
return n.xy;
1414

1515
}

0 commit comments

Comments
 (0)