summaryrefslogtreecommitdiff
path: root/workspaces/main/shaders
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-10 18:26:38 +0100
committerskal <pascal.massimino@gmail.com>2026-02-10 18:26:38 +0100
commitcb5cdbfb55cfa0185b2489ada75ff846f8aeab02 (patch)
tree91f5414631bf849e9e5f3bf46f72ea383cda6373 /workspaces/main/shaders
parent28b6d0940497d38bc1b1829f4fb7266a54636ee6 (diff)
fix: Flip Y-axis to match ShaderToy coordinate convention
ShaderToy uses bottom-left origin with Y-up, but our system uses top-left origin with Y-down. Added Y-flip in fragment shader to correctly display ShaderToy effects. **Changes:** - workspaces/main/shaders/scene1.wgsl: Flip Y before coordinate conversion - tools/shadertoy/convert_shadertoy.py: Generate Y-flip in all conversions **Formula:** ```wgsl let flipped = vec2<f32>(p.x, uniforms.resolution.y - p.y); ``` This ensures ShaderToy shaders display right-side up. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'workspaces/main/shaders')
-rw-r--r--workspaces/main/shaders/scene1.wgsl4
1 files changed, 3 insertions, 1 deletions
diff --git a/workspaces/main/shaders/scene1.wgsl b/workspaces/main/shaders/scene1.wgsl
index b0ec2ab..7af3811 100644
--- a/workspaces/main/shaders/scene1.wgsl
+++ b/workspaces/main/shaders/scene1.wgsl
@@ -246,7 +246,9 @@ fn effect(p: vec2<f32>) -> vec3<f32> {
}
@fragment fn fs_main(@builtin(position) p: vec4<f32>) -> @location(0) vec4<f32> {
- let q = p.xy / uniforms.resolution;
+ // Flip Y to match ShaderToy convention (origin at bottom-left)
+ let flipped = vec2<f32>(p.x, uniforms.resolution.y - p.y);
+ let q = flipped / uniforms.resolution;
var coord = -1.0 + 2.0 * q;
coord.x *= uniforms.resolution.x / uniforms.resolution.y;
var col = effect(coord);