FFT sphere
glint · Examples · Tutorials · Gallery
A sphere of glowing points pushed out by the spectrum in the vertex shader: bass round the equator, treble at the poles.
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.
vertex shader
#version 300 es
in vec4 a_position;
in vec3 a_normal;
uniform mat4 mvp;
uniform float time;
uniform sampler2D fft;
uniform vec3 spectrum;
uniform float beat;
uniform int beatCount;
out vec3 v_color;
void main() {
vec3 n = normalize(a_normal);
// 0 at the equator, 1 at the poles: which part of the spectrum this point shows.
float f = abs(acos(clamp(n.y, -1.0, 1.0)) / 3.14159 - 0.5) * 2.0;
float level = texture(fft, vec2(0.01 + f * 0.45, 0.25)).r;
bool silent = spectrum.x + spectrum.y + spectrum.z < 0.0001;
if (silent) level = 0.35 + 0.3 * sin(f * 12.0 - time * 3.0) * sin(atan(n.z, n.x) * 3.0 + time);
float kick = beatCount > 0 ? beat : pow(1.0 - fract(time * 2.0), 4.0);
vec3 p = n * 0.5 * (1.0 + level * 0.6 + kick * 0.06);
gl_Position = mvp * vec4(p, 1.0);
gl_PointSize = 1.5 + level * 3.5;
v_color = mix(vec3(0.15, 0.45, 1.0), vec3(1.0, 0.3, 0.65), level) * (0.3 + level);
}fragment shader
#version 300 es
precision highp float;
in vec3 v_color;
out vec4 fragColor;
void main() {
vec2 c = gl_PointCoord - 0.5;
if (dot(c, c) > 0.25) discard; // round points
fragColor = vec4(v_color, 1.0);
}More Audio-reactive examples
Spectrogram · Quarter turns · Waveform trails · Speaker cone · Shockwave · Pendulum wave · Beat cells · Spectrum tree