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 06c067d commit ced0567Copy full SHA for ced0567
1 file changed
src/shader-chunks/shaders/normal-codec-pars.frag
@@ -3,6 +3,7 @@
3
*
4
* @see https://knarkowicz.wordpress.com/2014/04/16/octahedron-normal-vector-encoding/
5
* @see https://aras-p.info/texts/CompactNormalStorage.html
6
+ * @see https://x.com/Stubbesaurus/status/937994790553227264
7
*/
8
9
vec2 pp_encodeNormal(vec3 n) {
@@ -15,7 +16,6 @@ vec2 pp_encodeNormal(vec3 n) {
15
16
17
vec3 pp_decodeNormal(vec2 f) {
18
- // https://twitter.com/Stubbesaurus/status/937994790553227264
19
vec3 n = vec3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y));
20
float t = clamp(-n.z, 0.0, 1.0);
21
n.xy += vec2(n.x >= 0.0 ? -t : t, n.y >= 0.0 ? -t : t);
0 commit comments