diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-28 09:48:08 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-28 09:48:08 +0100 |
| commit | f9ac4caf2f36c283c2d90bcb985e3298c417d564 (patch) | |
| tree | 70960c6115442c6f342ee5c0e50726e9c8f9f226 /workspaces/main/shaders | |
| parent | bc1beb58ba259263eb98d43d2aa742307764591c (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'workspaces/main/shaders')
| -rw-r--r-- | workspaces/main/shaders/scene2.wgsl | 43 |
1 files changed, 43 insertions, 0 deletions
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<uniform> 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)); +} |
