#version 410 core uniform float fGlobalTime; // in seconds uniform vec2 v2Resolution; // viewport resolution (in pixels) uniform float fFrameTime; // duration of the last frame, in seconds uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients uniform sampler1D texFFTIntegrated; // this is continually increasing uniform sampler2D texPreviousFrame; // screenshot of the previous frame uniform sampler2D texChecker; uniform sampler2D texNoise; uniform sampler2D texTex1; uniform sampler2D texTex2; uniform sampler2D texTex3; uniform sampler2D texTex4; layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything float time = fGlobalTime; float rd(vec3 p){return fract(sin(dot(floor(p),vec3(45.,65.,269.)))*7845.236);} mat2 rot(float t){float c = cos(t); float s = sin(t); return mat2 (c,-s,s,c);} float bl (vec2 p, vec2 b){ vec2 q = abs(p)-b; return length(max(vec2(0.),q))+min(0.,max(q.x,q.y));} float box (vec3 p, vec3 b){ vec3 q = abs(p)-b; return length(max(vec3(0.),q))+min(0.,max(q.x,max(q.z,q.y)));} float zl1 ;float zl2;float bl2;float zl3; float bl3; float map(vec3 p,vec3 tm){ vec3 pb =p; vec3 pc = p; pc.xy *= rot(tm.y); vec3 pnc =pc; vec3 pn = p; vec3 pl = p; p = abs(p); p -= 1.; if(p.x>p.y)p.xy=p.yx; if(p.x>p.z)p.xz=p.zx; vec3 p2 = p; vec3 rp1 = vec3 (2.); p = mod(p,rp1)-0.5*rp1; vec3 rp2 = vec3 (4.); p2 = mod(p2,rp2)-0.5*rp2; float d1 = bl(p.zy,vec2(0.2)); float d2 = bl(pn.xz,vec2(5.)); float d4 = bl(p2.xz,vec2(0.1)); float dl =min(d1,d4); float d3 = max(min(d1,d4),-d2); zl1 = max(d4,-d2); //return d3; pc = abs(pc); pc += 3.; if(pc.x40.){break;} if(d<0.01){break;} p += r*d; dd +=d; } vec3 n = nor(p,tm); float tex = rd(p*30.); float s = smoothstep(40.,0.,dd); float dn = smoothstep(0.,2.,length(p.y))*smoothstep(0.,2.,length(p.x))*smoothstep(0.,2.,length(p.z)); float ml = distance(0.5,fract(p.x*0.1+time*2.)); float l1 = smoothstep(2.,0.,zl1)*0.2+smoothstep(3.,0.,zl1)*0.1*smoothstep(0.,0.5,ml)*dn; l1 += smoothstep(1.,0.,zl1)*1.5*smoothstep(0.25,0.26,ml); float l2 = smoothstep(0.05,0.,zl2)*2.+bl2*0.05; float l3 = smoothstep(0.05,0.,zl3)*2.+bl3*0.5; float ld = clamp(dot(n,-r),0.,1.); float fres = pow(1.-ld,3.+tex*6.)*0.1; float spec = pow(ld,5.+tex*10.)*0.2; float b = sqrt(24.); float c = 0.; float d = pow(length(uv.y),2.)*0.03+0.0001; float r0 = (fres+spec+l1+l2+l3)*s; for(float j = -0.5*b;j <=0.5*b;j++) for(float k = -0.5*b;k <=0.5*b;k++){ c += texture(texPreviousFrame,uc+vec2(j,k)*d).a; } c /= 24.; float tr = step(0.7,fract(time*0.3)); vec3 r1 = mix(vec3(1.),3.*abs(1.-2.*fract(c*0.4+mix(0.45,0.85,tr)+vec3(0.,-1./3.,1./3.)))-1.,mix(0.25,0.8,tr))*c; vec3 r2 = pow(r1,mix(vec3(0.55,0.8,0.7),vec3(1.2),length(uv.y))); out_color =vec4(r2,r0); }