summaryrefslogtreecommitdiff
path: root/src/shaders/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/shaders/math')
-rw-r--r--src/shaders/math/noise.wgsl7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shaders/math/noise.wgsl b/src/shaders/math/noise.wgsl
index dd97e02..dff6619 100644
--- a/src/shaders/math/noise.wgsl
+++ b/src/shaders/math/noise.wgsl
@@ -21,6 +21,13 @@ fn hash_2f(p: vec2f) -> f32 {
return fract(sin(h) * 43758.5453123);
}
+// variant for vec2f -> f32 hashing
+fn hash_2f_alt(p: vec2f) -> f32 {
+ var p3 = fract(p.xyx * .1376);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+
// Hash: vec2f -> vec2f
// 2D coordinate to 2D hash (from Shadertoy 4djSRW)
fn hash_2f_2f(p: vec2f) -> vec2f {