Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 1b4ceee

Browse files
committed
unpm-packages: fix #1
Thanks @wblankenship for lending me your machine to debug this one!
1 parent 1b5f3d7 commit 1b4ceee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

unpm-packages/logic-multiples.glsl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ void main() {
2121

2222
float m1 = texture2D(metric1, uv).r;
2323
float m2 = texture2D(metric2, uv).r;
24-
float ci = texture2D(category, uv).r;
24+
25+
// The tiny offset value is workaround for floating point
26+
// precision issues on indexes, as seen here:
27+
// * https://github.com/nodesource/understanding-npm/issues/1
28+
// * https://twitter.com/maxogden/status/611213732551593984
29+
float ci = texture2D(category, uv).r + 0.00001;
2530

2631
vec2 idx = vec2(mod(ci, categoryCount.x), floor(ci / categoryCount.y)) - (categoryCount - 1.0) * 0.5;
2732

0 commit comments

Comments
 (0)