Particle Fountain
Sparks thrown up from the floor and falling back, each spark tied to a frequency band. Lows throw from the middle, high…
Free to use for anything. No credit needed.
// Radar: a sweeping scanner. Each frequency band is a contact that lights up when the sweep passes.
// P1 sweep speed, P2 range (more rings, zooms out), P3 static noise, P4 glitch.
float hash21(vec2 p)
{
p = fract(p * vec2(123.34, 456.21));
p += dot(p, p + 45.32);
return fract(p.x * p.y);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord)
{
vec2 uv = (2.0 * fragCoord - iResolution.xy) / iResolution.y;
float bass = texture(iChannel0, vec2(0.03, 0.25)).x;
float slice = floor(fragCoord.y / 6.0);
float tick = floor(iTime * 10.0);
float gate = step(1.0 - P4 * 0.25, hash21(vec2(slice, tick)));
uv.x += gate * (hash21(vec2(slice + 7.0, tick)) - 0.5) * 0.25 * P4;
float range = 0.6 + P2 * 0.9;
vec2 q = uv / range;
float d = length(q);
float a = atan(q.y, q.x);
float sweep = iTime * (0.4 + P1 * 3.0);
float da = mod(sweep - a, 6.28318);
float inside = 1.0 - smoothstep(0.98, 1.0, d);
float wedge = exp(-da * 2.5) * inside;
float sweepLine = exp(-da * 40.0) * inside;
float rings = 3.0 + floor(P2 * 5.0);
float ring = (1.0 - smoothstep(0.002, 0.006, abs(fract(d * rings + 0.5) - 0.5) / rings)) * inside;
float axis = (1.0 - smoothstep(0.0, 0.004, min(abs(q.x), abs(q.y)))) * inside;
float blips = 0.0;
for (int i = 0; i < 24; i++)
{
float fi = float(i);
float ang = hash21(vec2(fi, 1.3)) * 6.28318 - 3.14159;
float rad = 0.12 + 0.8 * hash21(vec2(fi, 7.1));
vec2 pos = rad * vec2(cos(ang), sin(ang));
float level = texture(iChannel0, vec2(pow((fi + 0.5) / 24.0, 2.0), 0.25)).x;
float dd = length(q - pos);
float size = 0.01 + 0.035 * level;
float dang = mod(sweep - ang, 6.28318);
float persist = exp(-dang * 0.9);
blips += (1.0 - smoothstep(size * 0.5, size, dd)) * persist * (0.15 + 2.0 * level);
}
vec3 phosphor = vec3(0.1, 0.9, 0.6);
vec3 col = vec3(0.01, 0.02, 0.02);
col += phosphor * (wedge * 0.35 + sweepLine * 0.8 + ring * 0.18 + axis * 0.12 + blips);
float rimEdge = smoothstep(0.985, 1.0, d) * (1.0 - smoothstep(1.0, 1.012, d));
col += phosphor * rimEdge * (0.4 + bass);
col += (hash21(fragCoord * 0.5 + iTime * 60.0) - 0.5) * 0.25 * P3;
col *= 1.0 - 0.1 * 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.
Log in or create an account to place a comment.