From 5f64a20daa81a6182d4898dcd6f86870ad0bf9d5 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 8 Mar 2026 10:22:43 +0100 Subject: feat: new clouds --- src/effects/scene2.wgsl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/effects/scene2.wgsl b/src/effects/scene2.wgsl index 3221321..5131fea 100644 --- a/src/effects/scene2.wgsl +++ b/src/effects/scene2.wgsl @@ -7,29 +7,31 @@ @group(0) @binding(2) var uniforms: UniformsSequenceParams; +const CloudColor = vec4f(3.0, 2.3, 1.0, 1.0); + fn N(a: vec3f, p: vec3f) -> f32 { - return abs(dot(sin(uniforms.time + 0.1 * p.z + 0.6 * p / a), a)); + return abs(dot(sin(uniforms.time * .7 + 0.1 * p.z + 0.6 * p / a), a)); } @fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f { let r = uniforms.resolution; let uv = in.position.xy; let u = (2. * uv - r.xy) / r.y; + let len_u = 1600. * max(length(u), 0.0001); var p = vec3f(0.0); - var col = vec3f(0.0); + var col = vec4f(0.0); for (var i: f32 = 0.0; i < 100.0; i += 1.0) { - var s = 6.0 + p.y; + var s = 6.0 + p.y - .3 * p.x; s -= N(vec3f(0.15), p); s -= N(vec3f(0.5), p); s -= N(vec3f(1.2), p); s = 0.1 + abs(s) * 0.2; - col += vec3f(3.0, 2.0, 1.0) / s; + col += CloudColor / s; p += vec3f(u * s, s); } - col *= smoothstep(0.8, 0.75, abs(u.y)); - let len_u = max(length(u), 0.0001); - col = tanh(col / 2000.0 / len_u); - return vec4f(col, 1.0); + col *= smoothstep(0.8, 0.75 - .3 * uniforms.beat_phase, abs(u.y)); + col = tanh(col / len_u); + return vec4f(col.rgb, 1.0); } -- cgit v1.2.3