summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/effects/particle_compute.wgsl3
-rw-r--r--src/shaders/heptagon.wgsl4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/effects/particle_compute.wgsl b/src/effects/particle_compute.wgsl
index 2960cc4..f3e8051 100644
--- a/src/effects/particle_compute.wgsl
+++ b/src/effects/particle_compute.wgsl
@@ -23,7 +23,8 @@ fn main(@builtin(global_invocation_id) id: vec3u) {
p.vel.y = p.vel.y - 0.01 * (1.0 + uniforms.audio_intensity * 5.0);
p.rot.x = p.rot.x + p.rot.y * 0.016;
if (p.pos.y < -1.5) {
- p.pos.y = 1.5;
+ // Stagger respawn height by index (golden ratio) to break synchronization
+ p.pos.y = 1.5 + fract(f32(i) * 0.6180339) * 3.0;
p.pos.x = (f32(i % 100u) / 50.0) - 1.0 + (uniforms.audio_intensity * 0.5);
p.vel.y = 0.0;
}
diff --git a/src/shaders/heptagon.wgsl b/src/shaders/heptagon.wgsl
index a8a450f..2467527 100644
--- a/src/shaders/heptagon.wgsl
+++ b/src/shaders/heptagon.wgsl
@@ -8,7 +8,9 @@
fn sdf_heptagon(p: vec2f, r: f32) -> f32 {
let an = 3.141593 / 7.0; // PI/7 for heptagon
let acs = vec2f(cos(an), sin(an));
- let bn = (atan2(p.x, p.y) % (2.0 * an)) - an;
+ let two_an = 2.0 * an;
+ let angle = atan2(p.y, p.x);
+ let bn = ((angle % two_an) + two_an) % two_an - an;
let q = length(p) * vec2f(cos(bn), abs(sin(bn)));
return length(q - r * acs) * sign(q.x - r * acs.x);
}