Nodes: Neon grid

glint · Examples · Tutorials · Gallery

Visual node mode: a grid of spinning neon squares (a box's distance through Glow), the lines thickening on every beat.

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

Nodes: Neon grid: 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.

fragment shader (generated from a node graph)

#version 300 es
precision highp float;

// Generated from nodes: edit the graph, or use "Convert to code" to take it from here by hand.
uniform vec2 resolution;
uniform float time;
uniform vec3 spectrum;
uniform float beat;
uniform vec3 spectrumIntegrated;

in vec2 v_texcoord;
out vec4 fragColor;

float n_hash(vec2 p) { p = fract(p * vec2(123.34, 456.21)); p += dot(p, p + 45.32); return fract(p.x * p.y); }
vec2 n_hash2(vec2 p) { return fract(sin(vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)))) * 43758.5453); }
float n_noise(vec2 p) {
  vec2 i = floor(p), f = fract(p), u = f * f * (3.0 - 2.0 * f);
  return mix(mix(n_hash(i), n_hash(i + vec2(1, 0)), u.x), mix(n_hash(i + vec2(0, 1)), n_hash(i + vec2(1, 1)), u.x), u.y);
}
vec2 n_rotate(vec2 p, float a) { float c = cos(a), s = sin(a); return mat2(c, s, -s, c) * p; }
vec3 n_palette(float t, vec3 a, vec3 b, vec3 c, vec3 d) { return a + b * cos(6.2831853 * (c * t + d)); }

void main() {
  // UV
  vec2 nn5dne96dq0_uv = (v_texcoord * 2.0 - 1.0) * vec2(resolution.x / resolution.y, 1.0);
  vec2 nn5dne96dq0_st = v_texcoord;
  // Tile
  vec2 nn5dnf97tgt_uv = (fract(nn5dne96dq0_uv * 4.0 * 0.5) - 0.5) * 2.0;
  vec2 nn5dnf97tgt_cell = floor(nn5dne96dq0_uv * 4.0 * 0.5);
  // Time
  float nn5dnf98qp9_t = time * 0.8;
  // Noise
  float nn5dnf9fgt3_out = n_noise(nn5dnf97tgt_cell * 0.6 + vec2(nn5dnf98qp9_t, nn5dnf98qp9_t * 0.7));
  // Palette
  vec3 nn5dnf9gylo_rgb = n_palette(nn5dnf9fgt3_out, vec3(0.5), vec3(0.5), vec3(2.0, 1.0, 0.0), vec3(0.5, 0.2, 0.25));
  // Rotate
  vec2 nn5dnf99qtk_uv = n_rotate(nn5dnf97tgt_uv, nn5dnf98qp9_t);
  // Box
  float nn5dnf9aayg_mask = (1.0 - smoothstep(-0.01, 0.01, (length(max(abs(nn5dnf99qtk_uv) - vec2(0.28), 0.0)) + min(max(abs(nn5dnf99qtk_uv).x - vec2(0.28).x, abs(nn5dnf99qtk_uv).y - vec2(0.28).y), 0.0))));
  float nn5dnf9aayg_dist = (length(max(abs(nn5dnf99qtk_uv) - vec2(0.28), 0.0)) + min(max(abs(nn5dnf99qtk_uv).x - vec2(0.28).x, abs(nn5dnf99qtk_uv).y - vec2(0.28).y), 0.0));
  // Audio
  float nn5dnf9bzo3_bass = spectrum.x;
  float nn5dnf9bzo3_mid = spectrum.y;
  float nn5dnf9bzo3_treble = spectrum.z;
  float nn5dnf9bzo3_beat = beat;
  float nn5dnf9bzo3_flow = spectrumIntegrated.x;
  // Multiply
  float nn5dnf9cd2n_out = (nn5dnf9bzo3_beat * 0.03);
  // Add
  float nn5dnf9dnoq_out = (nn5dnf9cd2n_out + 0.012);
  // Glow
  float nn5dnf9eqf6_out = (nn5dnf9dnoq_out / max(abs(nn5dnf9aayg_dist), 0.0005));
  // Multiply
  vec3 nn5dnf9h7hz_out = (nn5dnf9gylo_rgb * vec3(nn5dnf9eqf6_out));
  fragColor = vec4(nn5dnf9h7hz_out, 1.0);
}

More Nodes & glitch examples

Nodes: Twirl · Nodes: Polar rings · Nodes: Ink clouds · Nodes: Kaleido checker · Nodes: Expression · Nodes: Sunset stripes · Nodes: Spotlight · Nodes: Colour wheel rings