Lissajous scope
glint · Examples · Tutorials · Gallery
An X-Y oscilloscope: the waveform against itself a quarter-turn later, drawn in green phosphor that glows and fades (a feedback pass), behind glass with a graticule.
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
2 passes, drawn in this order each frame, in GLSL.
Phosphor: 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;
uniform sampler2D feedback;
in vec2 v_texcoord;
out vec4 fragColor;
float wave(float x) { return texture(fft, vec2(x, 0.75)).r * 2.0 - 1.0; }
float segment(vec2 p, vec2 a, vec2 b) {
vec2 pa = p - a, ba = b - a;
return length(pa - ba * clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0));
}
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * resolution) / resolution.y;
vec3 prev = texture(feedback, gl_FragCoord.xy / resolution).rgb * 0.88;
// Quiet? Fall back to a classic 3:2 figure.
float loud = clamp(spectrum.x + spectrum.y * 2.0, 0.0, 1.0);
float d = 1e9;
vec2 last = vec2(0.0);
for (int i = 0; i <= 96; i++) {
float t = float(i) / 96.0;
vec2 audio = vec2(wave(t), wave(fract(t + 0.25))) * 0.9;
vec2 fig = 0.38 * vec2(sin(time * 0.7 + t * 6.28318 * 3.0), sin(t * 6.28318 * 2.0));
vec2 pt = mix(fig, audio, loud);
if (i > 0) d = min(d, segment(uv, last, pt));
last = pt;
}
vec3 col = prev + vec3(0.25, 1.0, 0.45) * 0.0025 / (d + 0.002);
fragColor = vec4(min(col, vec3(4.0)), 1.0);
}Screen: fragment shader
#version 300 es
precision highp float;
uniform sampler2D prevPass;
uniform vec2 resolution;
in vec2 v_texcoord;
out vec4 fragColor;
void main() {
vec2 st = gl_FragCoord.xy / resolution;
vec2 uv = (gl_FragCoord.xy - 0.5 * resolution) / resolution.y;
vec3 col = texture(prevPass, st).rgb;
col = 1.0 - exp(-col);
// Graticule: a line every 0.1, brighter axes, faint.
vec2 g = abs(fract(uv * 10.0 + 0.5) - 0.5) / fwidth(uv * 10.0);
col += vec3(0.1, 0.25, 0.15) * (1.0 - min(min(g.x, g.y), 1.0)) * 0.35;
col += vec3(0.1, 0.3, 0.15) * 0.3 * (1.0 - min(min(abs(uv.x), abs(uv.y)) / fwidth(uv.x), 1.0));
// The tube: dark edges.
col *= smoothstep(0.95, 0.35, length(uv * vec2(0.8, 1.0)));
fragColor = vec4(col, 1.0);
}More Audio-reactive examples
Sub-bass tunnel · Spectrum city · Kick ripples · Beat kaleidoscope · Strobe shapes · LED meter · Bass blob · Vinyl