GLSL - Fireflies in Darkness



// This is a rework of https://www.shadertoy.com/view/lsfGzr,
// created by @paulofalcao, with sound, by Radical Ed
// License: Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License


#define time iTime

float makePoint(float x,float y,float fx,float fy,float sx,float sy,float t, float w){
   float xx=x+sin(t*fx)*sx*tan(fx*t)*log(fx*t);
   float yy=y+cos(t*fy)*sy*tan(fy*t)*log(fy*t);
   return 5.0*abs(sin(25.0*t/337.0))/sqrt(xx*xx+yy*yy)+log(w/4.0);
}

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {

   vec2 p=(fragCoord.xy/iResolution.x)*2.0-vec2(1.0,iResolution.y/iResolution.x);


 
   // create pixel coordinates
   vec2 uv = fragCoord.xy / iResolution.xy;

   // the sound texture is 512x2
   int tx = int(uv.x*512.0);
 

   // second row is the sound wave, one texel is one mono sample
   float wave = texelFetch( iChannel0, ivec2(tx,1), 0 ).x;
 
   vec2 translate = vec2(cos(iTime),sin(iTime));
 
 
 
   p=p*7.0*abs(sin(iTime));
   p += translate*1.35*sin(iTime);
 
   float x=p.x;
   float y=p.y;
 
   vec3 col = vec3( 0.0, 0.0, 0.0);

    // add wave form on top
   //col += smoothstep( 0.0, 0.15, abs(wave- uv.x)/2.0 );
 
    //if (wave > 0.4) { wave = 0.4 ;}
 

   float a=
   makePoint(x + col.x,y + col.y,2.0,2.9,0.3,0.3,time, wave);
   a=a+makePoint(x + col.x,y + col.y,1.9,2.0,0.4,0.4,time, wave);
   a=a+makePoint(x + col.x,y + col.y,0.8,0.7,0.4,0.5,time, wave);
   a=a+makePoint(x + col.x,y + col.y,2.3,0.1,0.6,0.3,time, wave);
   a=a+makePoint(x + col.x,y + col.y,0.8,1.7,0.5,0.4,time, wave);
   a=a+makePoint(x + col.x,y + col.y,0.3,1.0,0.4,0.4,time, wave);
   a=a+makePoint(x + col.x,y + col.y,1.4,1.7,0.4,0.5,time, wave);
   a=a+makePoint(x + col.x,y + col.y,1.3,2.1,0.6,0.3,time, wave);
   a=a+makePoint(x + col.x,y + col.y,1.8,1.7,0.5,0.4,time, wave);
   
 
   float b=
   makePoint(x + col.x,y + col.y,1.2,1.9,0.3,0.3,time, wave);
   b=b+makePoint(x + col.x,y + col.y,0.7,2.7,0.4,0.4,time, wave);
   b=b+makePoint(x + col.x,y + col.y,1.4,0.6,0.4,0.5,time, wave);
   b=b+makePoint(x + col.x,y + col.y,2.6,0.4,0.6,0.3,time, wave);
   b=b+makePoint(x + col.x,y + col.y,0.7,1.4,0.5,0.4,time, wave);
   b=b+makePoint(x + col.x,y + col.y,0.7,1.7,0.4,0.4,time, wave);
   b=b+makePoint(x + col.x,y + col.y,0.8,0.5,0.4,0.5,time, wave);
   b=b+makePoint(x + col.x,y + col.y,1.4,0.9,0.6,0.3,time, wave);
   b=b+makePoint(x + col.x,y + col.y,0.7,1.3,0.5,0.4,time, wave);
 

   float c=
   makePoint(x + col.x,y + col.y,3.7,0.3,0.3,0.3,time, wave);
   c=c+makePoint(x + col.x,y + col.y,1.9,1.3,0.4,0.4,time, wave);
   c=c+makePoint(x + col.x,y + col.y,0.8,0.9,0.4,0.5,time, wave);
   c=c+makePoint(x + col.x,y + col.y,1.2,1.7,0.6,0.3,time, wave);
   c=c+makePoint(x + col.x,y + col.y,0.3,0.6,0.5,0.4,time, wave);
   c=c+makePoint(x + col.x,y + col.y,0.3,0.3,0.4,0.4,time, wave);
   c=c+makePoint(x + col.x,y + col.y,1.4,0.8,0.4,0.5,time, wave);
   c=c+makePoint(x + col.x,y + col.y,0.2,0.6,0.6,0.3,time, wave);
   c=c+makePoint(x + col.x,y + col.y,1.3,0.5,0.5,0.4,time, wave);
 
 
   vec3 d=vec3(a,b,c)/22.0;
 
 
   fragColor = vec4(d.x*2.0,d.x,d.x,1.0);
}

Categories: , Share

Leave a Reply

Update cookies preferences