Synthwave drive
glint · Examples · Tutorials · Gallery
A neon grid rushing towards a striped sun, with mountains drawn by the spectrum and the grid flaring on every kick.
Audio-reactive: it moves with music from a microphone, line-in or a file.

An example in glint, a free live shader editor in the browser: the GLSL code floats over the running picture and recompiles as you type.
The code
One pass, in GLSL.
fragment shader
#version 300 es
precision highp float;
uniform float time;
uniform vec2 resolution;
uniform vec3 spectrum;
uniform float beat;
uniform float beatTime;
uniform int beatCount;
uniform sampler2D fft;
in vec2 v_texcoord;
out vec4 fragColor;
// 1 on each kick, fading; without audio, a steady pulse twice a second.
float kick() { return beatCount > 0 ? beat : pow(1.0 - fract(time * 2.0), 4.0); }
// Seconds since the last kick, and which kick it was (the same fallback).
float sinceKick() { return beatCount > 0 ? beatTime : fract(time * 2.0) / 2.0; }
float kickId() { return beatCount > 0 ? float(beatCount) : floor(time * 2.0); }
// One FFT bin, 0..1 across the spectrum (bass on the left).
float bin(float x) { return texture(fft, vec2(x, 0.25)).r; }
// Is anything playing? (Examples fake their input when not.)
bool silent() { return spectrum.x + spectrum.y + spectrum.z < 0.0001; }
float hash(float n) { return fract(sin(n * 127.1) * 43758.5453); }
float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
vec2 hash2(float n) { return fract(sin(vec2(n * 127.1, n * 269.5)) * 43758.5453); }
mat2 rot(float a) { float c = cos(a), s = sin(a); return mat2(c, s, -s, c); }
vec3 pal(float t) { return 0.5 + 0.5 * cos(6.28318 * (t + vec3(0.0, 0.33, 0.67))); }
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * resolution) / resolution.y;
vec3 horizonCol = vec3(0.9, 0.3, 0.5);
vec3 col;
if (uv.y > 0.0) {
// Sky, then a sun whose stripes widen towards the bottom.
col = mix(horizonCol, vec3(0.08, 0.02, 0.2), smoothstep(0.0, 0.45, uv.y));
vec2 sp = uv - vec2(0.0, 0.17);
float sun = smoothstep(0.2, 0.195, length(sp));
float stripes = sp.y > 0.0 ? 1.0 : step(-sp.y * 4.0, fract(sp.y * 30.0 - time * 0.5));
vec3 sunCol = mix(vec3(1.0, 0.2, 0.5), vec3(1.0, 0.9, 0.2), smoothstep(-0.2, 0.2, sp.y));
col = mix(col, sunCol, sun * stripes);
col += vec3(1.0, 0.3, 0.5) * 0.15 * exp(-length(sp) * 4.0) * (1.0 + spectrum.x);
// Mountains: the spectrum, mirrored, kept low in the middle so the sun shows.
float h = 0.02 + bin(0.02 + abs(uv.x) * 0.3) * 0.25 * smoothstep(0.1, 0.5, abs(uv.x));
if (uv.y < h) col = vec3(0.05, 0.0, 0.1);
col += vec3(0.2, 0.9, 1.0) * smoothstep(0.004, 0.0, abs(uv.y - h));
} else {
// The floor: a grid in perspective. Depth is camera height / how far below the horizon.
float depth = 0.25 / max(-uv.y, 0.001);
vec2 g = vec2(uv.x * depth, depth + time * 4.0);
// Line width from fwidth, so lines stay one pixel wide however far away.
vec2 gd = (0.5 - abs(fract(g) - 0.5)) / fwidth(g);
float line = 1.0 - clamp(min(gd.x, gd.y), 0.0, 1.0);
col = vec3(0.03, 0.0, 0.06) + vec3(1.0, 0.2, 0.8) * line * (0.6 + kick());
col = mix(col, horizonCol * 0.5, exp(uv.y * 12.0));
}
fragColor = vec4(col, 1.0);
}More Audio-reactive examples
Spectrum flower · Starburst · Mirror bars · Punch zoom · Kick fireworks · Spectrogram · Quarter turns · Waveform trails