We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a6de40c commit 364cf7cCopy full SHA for 364cf7c
src/shader-chunks/shaders/normal-codec-pars.frag
@@ -5,16 +5,10 @@
5
* @see https://aras-p.info/texts/CompactNormalStorage.html
6
*/
7
8
-vec2 pp_octWrap(vec2 v) {
9
-
10
- return (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);
11
12
-}
13
14
vec2 pp_encodeNormal(vec3 n) {
15
16
n /= (abs(n.x) + abs(n.y) + abs(n.z));
17
- n.xy = (n.z >= 0.0) ? n.xy : pp_octWrap(n.xy);
+ n.xy = (n.z >= 0.0) ? n.xy : (1.0 - abs(n.yx)) * sign(n.xy);
18
return n.xy;
19
20
}
0 commit comments