Vertex art

glint · Examples · Tutorials · Gallery

No mesh, just gl_VertexID: 20,000 points placed entirely by the vertex shader.

Audio-reactive: it moves with music from a microphone, line-in or a file.

Vertex art: an audio-reactive GLSL shader

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
uniform float time;
uniform vec2 resolution;
uniform vec3 spectrum;
uniform int vertexCount;

out vec3 v_color;

void main() {
    float id = float(gl_VertexID);
    float n = float(vertexCount);
    float t = id / n;
    float arms = 5.0;
    float a = t * 6.2831 * 40.0 + time * 0.3;
    float r = t * (0.8 + 0.2 * sin(t * arms * 6.2831 + time));
    vec2 p = vec2(cos(a), sin(a)) * r;
    p *= 1.0 + spectrum.x;
    p.x *= resolution.y / resolution.x;
    gl_Position = vec4(p, 0.0, 1.0);
    gl_PointSize = 2.0 + 3.0 * (1.0 - t);
    v_color = 0.5 + 0.5 * cos(6.2831 * (t * 3.0 + vec3(0.0, 0.33, 0.67)) + time);
}

fragment shader

#version 300 es
precision highp float;

in vec3 v_color;
out vec4 fragColor;

void main() {
    float d = length(gl_PointCoord - 0.5);
    fragColor = vec4(v_color * smoothstep(0.5, 0.0, d) * 0.6, 1.0);
}

More Starters examples

Raymarcher · Feedback trails · Audio spectrum · Lit mesh · Webcam kaleidoscope · Shadertoy style · Plasma