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.
// Frozen Sector: an endless cold hangar with a grid floor, ceiling lamps and fog.
// The bass pulses the lamps, the waveform makes the light shake a little.
// P1 amount of fog, P2 grid size, P3 camera motion, P4 light colour (cold blue to warm orange).
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 w = texture(iChannel0, vec2(fract(uv.x * 0.5 + 0.5), 0.75)).x;
uv.x -= sin(iTime * 0.4) * 0.25 * P3;
uv.y += (w - 0.5) * 0.03;
vec3 tint = mix(vec3(0.35, 0.55, 1.0), vec3(1.0, 0.55, 0.25), P4);
float ay = max(abs(uv.y), 0.015);
float z = 1.0 / ay;
float x = uv.x * z;
float zz = z + iTime * (0.5 + P3 * 4.0);
float sc = 0.4 + P2 * 1.2;
float lx = smoothstep(0.44, 0.5, abs(fract(x * sc) - 0.5));
float lz = smoothstep(0.44, 0.5, abs(fract(zz * sc) - 0.5));
float grid = max(lx, lz);
float fog = exp(-z * (0.03 + P1 * 0.2));
vec3 col = tint * grid * 0.5 * fog;
float isCeil = step(0.0, uv.y);
float lamp = (1.0 - smoothstep(0.04, 0.1, abs(fract(x * 0.25) - 0.5))) * (1.0 - smoothstep(0.1, 0.25, abs(fract(zz * 0.15) - 0.5)));
col += tint * lamp * isCeil * (0.6 + 2.5 * bass) * fog * 1.5;
float haze = exp(-ay * 3.5) * (0.15 + P1 * 0.9);
col += tint * haze * 0.6;
float shaft = pow(1.0 - smoothstep(0.0, 0.5, abs(fract(uv.x * 2.0 + iTime * 0.03) - 0.5)), 6.0);
col += tint * shaft * P1 * 0.15 * (0.5 + w);
col += (hash21(fragCoord + iTime) - 0.5) * 0.02;
col *= 1.0 - 0.08 * 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.