Sflp - Shaders [top]

// boolean edge detection via fwidth (fast derivative) float edge = smoothstep(0.0, fwidth(d), abs(d));

gl_FragColor = vec4(col, 1.0); // sflp vertex: no camera, no matrix, just NDC quad attribute vec2 position; varying vec2 uv; void main() uv = position * 0.5 + 0.5; // (0..1) if position is -1..1 gl_Position = vec4(position, 0.0, 1.0); sflp shaders

void main() // normalized pixel coord (-1..1) aspect corrected vec2 p = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y); // boolean edge detection via fwidth (fast derivative)

// raw sinusoidal waves on axes vec2 q = p; q.x += sin(time * 1.7 + p.y * 8.0) * 0.1; q.y += cos(time * 1.3 + p.x * 7.0) * 0.1; gl_FragColor = vec4(col

// cheap distance field float d = length(p) - 0.5;

// 3-tone palette: black / hot pink / cyan vec3 black = vec3(0.0); vec3 pink = vec3(1.0, 0.2, 0.8); vec3 cyan = vec3(0.2, 0.9, 1.0);

// color by position & time (no branching) vec3 col = mix(pink, cyan, sin(p.x * 3.14159 + time) * 0.5 + 0.5); col = mix(black, col, edge);

X

Need to create an account?