Advertisement
Guest User

bonzomatic script

a guest
Apr 9th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #version 410 core
  2.  
  3. uniform float fGlobalTime; // in seconds
  4. uniform vec2 v2Resolution; // viewport resolution (in pixels)
  5.  
  6. uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
  7. uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
  8. uniform sampler1D texFFTIntegrated; // this is continually increasing
  9.  
  10. uniform sampler2D texTex1;
  11. uniform sampler2D texTex2;
  12. uniform sampler2D texTex3;
  13. uniform sampler2D texTex4;
  14. uniform sampler2D texNoise;
  15. uniform sampler2D texChecker;
  16.  
  17.  
  18. layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
  19.  
  20. const float pi = 2 * atan(1);
  21.  
  22. void rot (inout vec2 uv, float alpha)
  23. {
  24.   uv = uv * cos(alpha) + vec2(uv.y, -uv.x) * -sin(alpha);
  25. }
  26.  
  27.  
  28. void main(void)
  29. {
  30.   vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
  31.  
  32.  
  33.  
  34.   uv -= 0.5;
  35.   uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
  36.  
  37.   vec2 uv2 = uv;
  38.  
  39.   uv = abs(uv*1.3);
  40.  
  41.   //uv.y*=smoothstep(0.0, 0.4, length(uv))*(cos(fGlobalTime*0.001)*0.5+1.6);
  42.   uv = vec2(length(uv)- uv.y*0.02, smoothstep(0, 1, uv.y)*(cos(fGlobalTime*0.001)*0.5+1.6));
  43.  
  44.   rot(uv, cos(fGlobalTime)*pi*2);
  45.  
  46.   uv *= uv / pi * 2 * (cos(fGlobalTime*0.05)*0.3+0.5);
  47.   uv += uv / pi * 0.2 * (sin(texture(texFFT, 0.3).x*0.05)*0.3+0.5);
  48.   uv -= uv / pi * 0.2 * (cos(texture(texFFT, 0.3).x*0.5)*0.3+0.5);
  49.  
  50.  
  51.  
  52.   rot(uv, texture(texFFTSmoothed, 0.02).x*500 * (sin(fGlobalTime*0.005)*0.5-0.5));
  53.  
  54.   uv.x*=sin(length(uv));
  55.  
  56.   out_color = vec4(0);
  57.  
  58.   vec2 center = vec2(texture(texFFTSmoothed, 0.02).x * 3.5 / (length(uv)*100000000)+sin(texture(texFFT, 0.01).x)*0.2+0.2, texture(texFFTSmoothed, 0.7).x * 140 / length(uv)*0.000000001);
  59.  
  60.   float c = distance(uv, center);
  61.  
  62.   out_color += texture(texChecker, vec2(1-c))*0.3 + (sin(fGlobalTime) * 0.1 - 0.5) * 0.6+0.4;
  63.  
  64.   rot(uv, 0.04);
  65.   c = distance(uv, center);
  66.  
  67.   out_color += texture(texTex4, vec2(c+.4, c))*0.3+0.3;
  68.  
  69.   rot(uv, 0.04 * mod(fGlobalTime, 0.1));
  70.   c = distance(uv, center);
  71.  
  72.  
  73.   out_color += texture(texTex4, vec2(c+.4, c))*0.3;
  74.  
  75.   center = vec2(texture(texFFTSmoothed, 0.2).x * 3, texture(texFFTSmoothed, 0.4).x * 30);
  76.   c = distance(uv, center);
  77.  
  78.  
  79.   out_color += texture(texTex4, vec2(-c-.1)*0.001)*0.2;
  80.  
  81.   out_color -= c * 0.75;
  82.  
  83.   out_color.rgb = pow(out_color.rgb, vec3(0.4));
  84.  
  85.   out_color.b += 0.5-sin(texture(texFFTSmoothed, 0.03).x)*0.5+0.5*c - uv.x;
  86.  
  87.   out_color = abs(out_color) * 0.4;
  88.  
  89.   out_color.rgb -= vec3(length(uv))*0.75;
  90.  
  91.   float m = max(max(max(out_color.r, out_color.g), out_color.b), 1);
  92.   out_color.rgb = normalize(out_color.rgb)/m;
  93.  
  94.   vec3 scene2 = vec3(0);
  95.   scene2 += pow((1- length(uv2)), 19)*0.5;
  96.   scene2 += texture(texNoise, uv2+mod(fGlobalTime*0.1,1)).rgb*0.5;
  97.   scene2 = pow(scene2, vec3(2));
  98.   out_color.rgb = mix(out_color.rgb, scene2, smoothstep(1, 0, (length(uv2)*100-30*pow(texture(texFFTSmoothed, 0.0015).x, .5)-5)));
  99.  
  100.  
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement