Nodes: Paint trails

glint · Examples · Tutorials · Gallery

Visual node mode with feedback: paint with the mouse, last frame zooms and fades. Fade and brush are parameters (MIDI them).

Nodes: Paint trails: a 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 vec2 mouse;
uniform float brush;
uniform float time;
uniform sampler2D feedback;
uniform float fade;

in vec2 v_texcoord;
out vec4 fragColor;

vec3 n_hsv(vec3 c) { vec3 p = abs(fract(c.xxx + vec3(1.0, 2.0 / 3.0, 1.0 / 3.0)) * 6.0 - 3.0); return c.z * mix(vec3(1.0), clamp(p - 1.0, 0.0, 1.0), c.y); }

void main() {
  // UV
  vec2 nn5dna7djsh_uv = (v_texcoord * 2.0 - 1.0) * vec2(resolution.x / resolution.y, 1.0);
  vec2 nn5dna7djsh_st = v_texcoord;
  // Mouse
  vec2 nn5dna7e159_uv = (mouse * 2.0 - 1.0) * vec2(resolution.x / resolution.y, 1.0);
  vec2 nn5dna7e159_st = mouse;
  // Move
  vec2 nn5dna7fk3m_uv = nn5dna7djsh_uv - nn5dna7e159_uv;
  // Parameter
  float nn5dna7hlts_value = brush;
  // Circle
  float nn5dna7igq0_mask = (1.0 - smoothstep(nn5dna7hlts_value - 0.03, nn5dna7hlts_value + 0.03, length(nn5dna7fk3m_uv)));
  float nn5dna7igq0_dist = (length(nn5dna7fk3m_uv) - nn5dna7hlts_value);
  // Time
  float nn5dna7guqo_t = time * 0.2;
  // HSV
  vec3 nn5dna7jl3d_rgb = n_hsv(vec3(nn5dna7guqo_t, 0.8, 1.0));
  // Multiply
  vec3 nn5dna7kn6w_out = (vec3(nn5dna7igq0_mask) * nn5dna7jl3d_rgb);
  // Expression
  vec2 nn5dna7lv4h_out = vec2(((nn5dna7djsh_st) - 0.5) * 0.992 + 0.5);
  // Image
  vec3 nn5dna7mull_rgb = texture(feedback, nn5dna7lv4h_out).rgb;
  float nn5dna7mull_a = texture(feedback, nn5dna7lv4h_out).a;
  // Parameter
  float nn5dna7nojq_value = fade;
  // Multiply
  vec3 nn5dna7o0xm_out = (nn5dna7mull_rgb * vec3(nn5dna7nojq_value));
  // Max
  vec3 nn5dna7p74c_out = max(nn5dna7kn6w_out, nn5dna7o0xm_out);
  fragColor = vec4(nn5dna7p74c_out, 1.0);
}

More Nodes & glitch examples

Nodes: Neon rings · Nodes: Kaleidoscope · Nodes: Liquid cells · Nodes: Beat tiles · Nodes: Twirl · Nodes: Polar rings · Nodes: Ink clouds