From f9ac4caf2f36c283c2d90bcb985e3298c417d564 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 28 Feb 2026 09:48:08 +0100 Subject: fix(tools/shadertoy): fix Next Steps instructions and update EFFECT_WORKFLOW.md - Fix assets.txt path: shaders/xxx.wgsl (not ../../src/shaders/) - Fix shader output path to workspaces/main/shaders/ - Step 5: reference cmake/DemoSourceLists.cmake COMMON_GPU_EFFECTS (not CMakeLists.txt GPU_SOURCES) - Add step for test_demo_effects.cc Co-Authored-By: Claude Sonnet 4.6 --- workspaces/main/shaders/scene2.wgsl | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 workspaces/main/shaders/scene2.wgsl (limited to 'workspaces/main/shaders') diff --git a/workspaces/main/shaders/scene2.wgsl b/workspaces/main/shaders/scene2.wgsl new file mode 100644 index 0000000..486f41e --- /dev/null +++ b/workspaces/main/shaders/scene2.wgsl @@ -0,0 +1,43 @@ +// Scene2 effect shader - ShaderToy conversion +// 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 uniforms: UniformsSequenceParams; + + +fn N(vec3f a, vec3f p) { return abs(dot(sin(uniforms.time+.1*p.z+.3*p / a), vec3f(a+a))); } +const NUM_LAYERS: f32 = 12.; + + + +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f { + // Flip Y to match ShaderToy convention (origin at bottom-left) + let flipped = vec2f(in.position.x, uniforms.resolution.y - in.position.y); + let q = flipped / uniforms.resolution; + var coord = -1.0 + 2.0 * q; + coord.x *= uniforms.resolution.x / uniforms.resolution.y; + + f32 i,s; + vec3f p = vec3f[0),r = uniforms.resolution; + + vec2f uv = (u-.5*uniforms.resolution.xy)/uniforms.resolution.y; + + f32 t = uniforms.time*.0; + vec3f col = vec3f(0); + + u = (u+u-r.xy)/r.y; + for(o*=i; i++<1e2; ) { + p += vec3f(u * s, s); + s = 6.+(p.y); + s -= N(.08); + s -= N(.2); + s -= N(.6); + s = .1 + abs(s)*.2; + o += vec4f(4,2,1,0)/s; + } + o *= smoothstep(0.8, 0.75, abs(u.y)); + o = tanh(o / 2e3 / length(u)); +} -- cgit v1.2.3