summaryrefslogtreecommitdiff
path: root/tools/shadertoy/example.txt
blob: e0287de70794e7a03869cd5045dc2c250ec13d22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Example ShaderToy shader for testing convert_shadertoy.py
// Simple animated gradient effect
//
// Test with:
//   ./tools/shadertoy/convert_shadertoy.py tools/shadertoy/example.txt Rainbow

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    // Normalized pixel coordinates (from 0 to 1)
    vec2 uv = fragCoord / iResolution.xy;

    // Center coordinates
    vec2 center = uv - 0.5;

    // Distance from center
    float dist = length(center);

    // Animated rainbow colors
    vec3 col = 0.5 + 0.5 * cos(iTime + dist * 10.0 + vec3(0.0, 2.0, 4.0));

    // Pulsing effect
    col *= 1.0 + 0.2 * sin(iTime * 2.0);

    // Output to screen
    fragColor = vec4(col, 1.0);
}