0.00 s
Press play to see the audio moving the shader.
Shader

Hex Pulse

A honeycomb of cells; the lows light the middle, the highs the outer cells, so the music opens up from the centre.The kick sends a ring of light out through the grid; every cell's edge glows in its band's colour. P1 sensitivity, P2 cell size (big to small), P3 glow, P4 colour range (shifts the whole palette).
AuthorDARC SECTOR
LanguageGLSL (MNodes format)
Added17 Oct 2026
Views41

Free to use for anything. No credit needed.

No ratings yet

Log in to rate this shader.

Code 83 lines

// Hex Pulse: a honeycomb of cells; the lows light the middle, the highs the outer cells, so the music opens up from the centre.
// The kick sends a ring of light out through the grid; every cell's edge glows in its band's colour.
// P1 sensitivity, P2 cell size (big to small), P3 glow, P4 colour range (shifts the whole palette).

float spec(float x)
{
    return texture(iChannel0, vec2(x, 0.25)).x;
}

float band(float lo, float hi)
{
    float s = 0.0;
    for (int i = 0; i < 4; i++)
        s += spec(mix(lo, hi, (float(i) + 0.5) / 4.0));
    return s * 0.25;
}

vec3 pal(float x)
{
    return 0.5 + 0.5 * cos(6.28318 * (x + P4 + vec3(0.0, 0.33, 0.67)));
}

float hash21(vec2 p)
{
    p = fract(p * vec2(123.34, 456.21));
    p += dot(p, p + 45.32);
    return fract(p.x * p.y);
}

float seg(vec2 p, vec2 a, vec2 b)
{
    vec2 pa = p - a, ba = b - a;
    return length(pa - ba * clamp(dot(pa, ba) / max(dot(ba, ba), 1.0e-6), 0.0, 1.0));
}

// the nearest hex centre (xy) and the position inside that cell (zw)
vec4 hexCell(vec2 p)
{
    const vec2 S = vec2(1.0, 1.7320508);
    vec4 c = floor(vec4(p, p - vec2(0.5, 1.0)) / S.xyxy) + 0.5;
    vec4 h = vec4(p - c.xy * S, p - (c.zw + 0.5) * S);
    return dot(h.xy, h.xy) < dot(h.zw, h.zw) ? vec4(c.xy * S, h.xy) : vec4((c.zw + 0.5) * S, h.zw);
}

float hexDist(vec2 p)
{
    p = abs(p);
    return max(dot(p, vec2(0.5, 0.8660254)), p.x);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord)
{
    vec2 uv = (2.0 * fragCoord - iResolution.xy) / iResolution.y;
    float gain = 0.6 + P1 * 1.4;
    float k = 0.5 + P3 * 1.5;
    float bass = band(0.0, 0.06);

    float scale = 5.0 + P2 * 14.0;
    vec4 h = hexCell(uv * scale);
    vec2 centre = h.xy / scale;
    float edge = 0.5 - hexDist(h.zw);                                // 0 at the cell's border, 0.5 in its middle
    float px = scale * 2.0 / iResolution.y;

    float r = length(centre);
    float f = clamp(pow(r / 1.6, 1.4), 0.0, 1.0) * 0.9;              // centre low, outside high
    float lv = pow(clamp(band(f, f + 0.03) * gain, 0.0, 1.0), 1.3);
    float flick = 0.85 + 0.15 * sin(iTime * 6.0 + hash21(h.xy) * 30.0);

    // a ring that travels out on the kick
    float wave = exp(-abs(r - fract(iTime * 0.7) * 2.0) * 10.0) * bass;

    vec3 c = pal(f * 0.9);
    vec3 col = vec3(0.012, 0.013, 0.02);
    float fill = smoothstep(px, -px, 0.06 - edge);
    float rim = exp(-edge / (px * (1.0 + P3 * 3.0)));
    col += c * fill * (lv * 0.9 * flick + wave * 0.6);
    col += c * rim * (0.08 + 0.9 * lv + wave) * k * 0.6;

    col = col / (1.0 + 0.5 * col);
    col *= 1.0 - 0.15 * dot(uv, uv);
    fragColor = vec4(col, 1.0);
}

Made for MNodes: paste it in a Shader Code node and wire it to a Shader or Scene. The P values are the sliders above the code.

Comments

No comments yet.

← Back to shaders