Simple Processing Shader Template

Home   »   Simple Processing Shader Template

#ifdef GL_ES
precision mediump float;
#endif

#define PROCESSING_COLOR_SHADER

uniform vec2  u_resolution;
uniform vec2  u_mouse;
uniform float u_time;

void main() {
    vec2 uv = gl_FragCoord.st/u_resolution;

    float r = uv.x;
    float b = 0.5 + 0.5 * sin(u_time + 30.0*uv.y);

    float dx = u_mouse.x / u_resolution.x - uv.x; 
    float dy = 1.0 - (u_mouse.y / u_resolution.y) - uv.y; 
    float dh = sqrt(dx*dx + dy*dy); 
    float g = 1.0 - dh;

    gl_FragColor = vec4(r,g,b, 1.0);
}

Leave a Reply

Your email address will not be published. Required fields are marked *