summaryrefslogtreecommitdiff
path: root/src/effects/scene2.wgsl
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-28 11:50:13 +0100
committerskal <pascal.massimino@gmail.com>2026-02-28 11:50:13 +0100
commitb9c2a0394343ff3586880d118b7d549b3e748cad (patch)
treebfc437f805c6b7344951107df8c7cd69a7ec421f /src/effects/scene2.wgsl
parent21d8a0b86ceda19812e9869a72e49c56c90ae3da (diff)
refactor(effects): co-locate effect WGSL shaders with their .h/.cc in src/effects/
Move 13 effect-specific shaders from workspaces/main/shaders/ to src/effects/ so each effect's .h, .cc, and .wgsl are together. Update assets.txt paths in both main and test workspaces. Update EFFECT_WORKFLOW.md to reflect new location. Shared/reusable snippets remain in src/shaders/. handoff(Gemini): shaders moved; src/effects/ now has .h, .cc, and .wgsl per effect. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/effects/scene2.wgsl')
-rw-r--r--src/effects/scene2.wgsl37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/effects/scene2.wgsl b/src/effects/scene2.wgsl
new file mode 100644
index 0000000..7df91c3
--- /dev/null
+++ b/src/effects/scene2.wgsl
@@ -0,0 +1,37 @@
+// Scene2 effect shader - ShaderToy conversion (volumetric clouds)
+// Generated by convert_shadertoy.py
+// NOTE: Manual review recommended - conversion is basic
+
+#include "sequence_uniforms"
+#include "render/fullscreen_uv_vs"
+
+@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams;
+
+fn N(a: vec3f, p: vec3f) -> f32 {
+ return abs(dot(sin(uniforms.time + 0.1 * p.z + 0.3 * p / a), a + a));
+}
+
+@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f {
+ let r = uniforms.resolution;
+ let frag_coord = vec2f(in.position.x, r.y - in.position.y);
+ let u = (frag_coord + frag_coord - r) / r.y;
+
+ var p = vec3f(0.0);
+ var col = vec4f(0.0);
+ var s: f32 = 0.0;
+
+ for (var i: f32 = 0.0; i < 100.0; i += 1.0) {
+ p += vec3f(u * s, s);
+ s = 6.0 + p.y;
+ s -= N(vec3f(0.08), p);
+ s -= N(vec3f(0.2), p);
+ s -= N(vec3f(0.6), p);
+ s = 0.1 + abs(s) * 0.2;
+ col += vec4f(4.0, 2.0, 1.0, 0.0) / 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.rgb, 1.0);
+}