summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-08-21 18:44:46 -0400
committerpommicket <pommicket@gmail.com>2023-08-21 18:44:46 -0400
commitd818c45c08341f8cf53df01beca6a2e297c404e1 (patch)
treec5bfc4314fde04a2099a8efb51ae38556d903ba5
parente8e25f0cf857cbfc1437eedf6c56c97b22371b82 (diff)
white noise
-rw-r--r--fractiform.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/fractiform.js b/fractiform.js
index 2889f06..516b85e 100644
--- a/fractiform.js
+++ b/fractiform.js
@@ -7,7 +7,6 @@ TODO:
- enable/disable auto-update
- resolution
- widgets:
- - white noise
- worley noise
- perlin noise
*/
@@ -688,6 +687,23 @@ float dist(${type} x, ${type} y) { return distance(x, y); }
float dot_prod(${type} x, ${type} y) { return dot(x, y); }
`,
).join('\n'),
+ `
+//! .name: White noise
+//! .description: Pure noise
+//! .category: noise
+
+float wnoise(vec4 x)
+{
+ uint k = 134775813u;
+ uvec4 u = floatBitsToUint(x) * k;
+ u = ((u >> 8) ^ u.yzwx) * k;
+ u = ((u >> 8) ^ u.yzwx) * k;
+ u = ((u >> 8) ^ u.yzwx) * k;
+ return float(u >> 8) * (1.0 / 16777216.0);
+}
+
+
+`,
];
function auto_update_enabled() {