Untitled Shader

Draft
60.0 FPS 16.6ms 1.0x
GPU DIAGNOSTICS
Frame Rate 60.0 FPS
Frame Time 16.6 ms
Delta Min / Max 14 / 19 ms
Resolution 960 × 540
Passes & Draws 1 Pass (1 Draw)
FBO Texture VRAM 0.0 MB
Resolution Scaling:
0.00s
precision mediump float; varying mediump vec2 a_pos; uniform float u_time; //seconds since page load uniform float u_stime; //seconds since shader compile uniform vec4 u_mouse; //xy: current pos, zw: click pos uniform vec2 u_resolution; uniform float u_frame; //frame counter uniform float u_timedelta; //time between frames uniform sampler2D u_channel0; //channel 0 input uniform sampler2D u_channel1; //channel 1 input uniform sampler2D u_channel2; //channel 2 input uniform sampler2D u_channel3; //channel 3 input uniform vec2 u_channelresolution[4]; //texture resolutions uniform vec4 u_keys; //x: left/A, y: right/D, z: up/W, w: down/S uniform float u_key_space; //1.0 when Spacebar active void mainImage( out vec4 c, in vec2 fc ) { // Centered coordinates: (0,0) is center of screen vec2 p = (fc * 2.0 - u_resolution.xy) / min(u_resolution.x, u_resolution.y); // Dynamic reaction to Arrow Keys / WASD p.x += (u_keys.y - u_keys.x) * 0.4; p.y += (u_keys.z - u_keys.w) * 0.4; // Circular distance from center float d = length(p); // Smooth rainbow gradient vec3 col = 0.5 + 0.5 * cos(u_time + p.xyx + vec3(0.0, 2.0, 4.0)); // Concentric circular waves pulsing outward col *= 0.5 + 0.5 * sin(d * 14.0 - u_time * 3.0); // Spacebar inverts colors if (u_key_space > 0.5) col = 1.0 - col; // Blend with Channel 0 media buffer if active vec2 uv = fc / u_resolution.xy; vec4 tex0 = texture2D(u_channel0, uv); if (length(tex0.rgb) > 0.001) { col = mix(col, tex0.rgb, 0.75); } c = vec4(col, 1.0); } void main(void) { mainImage(gl_FragColor, gl_FragCoord.xy); }
🎛️ Media Buffers (u_channel0 – u_channel3) ShaderToy Parity 🎮 Keyboard: u_keys (WASD/Arrows), u_key_space
Sample with: texture2D(u_channel0, uv)
Aa
💬 Discussion & Feedback 0 Comments
No comments yet. Start the discussion below!