Skip to content

Instantly share code, notes, and snippets.

@CharStiles
Created July 12, 2020 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CharStiles/30db59b4c8c84ece18bafabce88d3f1e to your computer and use it in GitHub Desktop.
Save CharStiles/30db59b4c8c84ece18bafabce88d3f1e to your computer and use it in GitHub Desktop.
float circ( vec2 p){
return length(p) - 0.3;
}
void pR(inout vec2 p, float a) {
p = cos(a)*p + sin(a)*vec2(p.y, -p.x);
}
// Repeat in two dimensions
vec2 pMod2(inout vec2 p, vec2 size) {
vec2 c = floor((p + size*0.5)/size);
p = mod(p + size*0.5,size) - size*0.5;
return c;
}
// http://www.iquilezles.org/www/articles/palettes/palettes.htm
// As t runs from 0 to 1 (our normalized palette index or domain),
//the cosine oscilates c times with a phase of d.
//The result is scaled and biased by a and b to meet the desired constrast and brightness.
vec3 cosPalette( float t, vec3 a, vec3 b, vec3 c, vec3 d )
{
return a + b*cos( 6.28318*(c*t+d) );
}
void main () {
vec2 pos = uv();
vec2 n = uvN();
//pR(pos,time);
// pMod2(pos, vec2(2.0,2.0));
// pos = pos + vec2(0.4,0.);
float shape = circ(pos);
float explode = floor(bands.r + 0.1);
vec3 brightness = vec3(0.2,0.02,bands.r*explode);
vec3 contrast = vec3(0.2,sin(time)*0.2,cos(time)*0.2);
vec3 osc = vec3((ceil(bands.r + 0.01)));
vec3 phase = bands.xyz;
float whow = (0.5*noise(vec3(n*23.,time))) * explode;
vec4 web =texture2D(channel0,uvN() * (1.0 + whow*length(uv())));
vec3 col = cosPalette((time/1.0) + shape, brightness, contrast, osc, phase );
col = col * shape;
n.y = 1.10*n.y;
vec4 prev = texture2D(backbuffer, uvN() - vec2(0,(1.-n.y)* 0.01 + 0.01*noise(vec3(n*20.,time)) ));
col = mix(web.xyz,col,n.y ).rgb;
col = mix(col,prev.rgb,abs(sin(length(pos.y - 1.+ 1.+web.y * vec2(web.x/web.y,web.z*10.))) ));
col = mix(col,prev.rgb, 1.5-col - n.x/1.60 * 1.+ whow);
gl_FragColor = vec4(1.);
col = max(col,web.xyz);
gl_FragColor = vec4(col,1.0) ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment