Noise
Three octaves of value noise (each half the amplitude, twice the
frequency, drifting in a different direction) summed into one continuous
field, then colored the same way plasma is — iAccent plus three fixed
hues.
Value noise is a smoothed hash grid: pick a random value at every integer lattice point, then bilinearly interpolate between them with a Hermite-eased fractional. Stacking octaves adds detail without breaking the smoothness — the classic recipe for organic-looking texture.
[glsl]: shader source
// Three-octave value-noise field cycled through a four-color palette.
// @slider tempo 0.1 3.0 1.0 0.05
uniform float tempo;
float hash(vec2 p){
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
}
// bilinearly-interpolated hash grid, Hermite-smoothed
float valueNoise(vec2 p){
vec2 i = floor(p);
vec2 f = fract(p);
f = f * f * (3.0 - 2.0 * f);
return mix(
mix(hash(i), hash(i + vec2(1.0, 0.0)), f.x),
mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), f.x),
f.y);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord / iResolution.xy;
float t = iTime * 0.2 * tempo;
// three octaves: each half amplitude, twice frequency, drifting different way
float n = valueNoise(uv * 5.0 + t) * 0.5;
n += valueNoise(uv * 10.0 - t * 0.5) * 0.25;
n += valueNoise(uv * 20.0 + t * 0.3) * 0.125;
vec3 c1 = iAccent;
vec3 c2 = vec3(0.35, 0.75, 1.00);
vec3 c3 = vec3(1.00, 0.35, 0.55);
vec3 c4 = vec3(0.55, 0.25, 0.85);
float idx = n * 4.0;
vec3 col;
if(idx < 1.0) col = mix(c1, c2, idx);
else if(idx < 2.0) col = mix(c2, c3, idx - 1.0);
else if(idx < 3.0) col = mix(c3, c4, idx - 2.0);
else col = mix(c4, c1, idx - 3.0);
fragColor = vec4(col * 0.4, 1.0);
}