Files
gpupaper/shaders/fuzzy_clouds.frag
2026-06-15 22:56:47 +02:00

30 lines
726 B
GLSL

// i don't remember what i based this off of or if it was just fiddling,
// found it in my shader list and thought the clouds were pretty good,
// for what it is
uniform float time;
uniform vec2 resolution;
float noise(vec3 p) {
float v = 0.0, a;
for (a = .85; a > .15; a *=.75) {
v += a * abs(dot( sin( .1*time + .1*p.z + .1*p/a) , vec3(a*3.)) );
p += p;
}
return v;
}
void mainImage(out vec4 o, vec2 u) {
float i = 0.0, s = 0.0;
o = vec4(0.0);
vec3 p = vec3(0.0);
vec2 r = resolution;
u = ( u+u - r.xy ) / r.y;
for( ; i++ < 1e2; ) {
p += vec3(u * s, s);
s = .1 + .2* abs( 12.-abs(p.y) - noise(p) );
o += 1./s;
}
o = tanh(vec4(5,2,1,0)*o /3e3/ length(u));
}