Files
gpupaper/shaders/example.frag
T
2026-06-08 21:00:34 +02:00

24 lines
729 B
GLSL

// Example Shadertoy-style fragment shader for gpupaper.
// Demonstrates use of 'time' and 'resolution' uniforms.
//
// Usage: gpupaper HDMI-A-1 shaders/example.frag
uniform vec2 resolution;
uniform float time;
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord / resolution;
// Animated gradient
float r = 0.5 + 0.5 * sin(time * 0.7 + uv.x * 3.0);
float g = 0.5 + 0.5 * sin(time * 0.5 + uv.y * 3.0 + 2.094);
float b = 0.5 + 0.5 * sin(time * 0.3 + (uv.x + uv.y) * 3.0 + 4.189);
// Vignette
vec2 centered = uv - 0.5;
float vignette = 1.0 - dot(centered, centered) * 2.0;
vignette = clamp(vignette, 0.0, 1.0);
fragColor = vec4(vec3(r, g, b) * vignette, 1.0);
}