diff options
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)); +} |
