Advertisement
Guest User

psychedelic shader

a guest
Oct 7th, 2018
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //MIT LICENSE
  2. //Discord - wospy#3232
  3.  
  4. shader_type canvas_item;
  5. uniform float global_speed =0.7;
  6.  
  7. float map(float min, float max, float value) {
  8.     return min + (max - min) * value;  
  9. }
  10.  
  11. void fragment(){
  12.  
  13. float weight11_speed =14.0/13.0*global_speed;
  14. float weight12_speed =20.0/19.0*global_speed;
  15. float weight21_speed =38.0/37.0*global_speed;
  16. float weight22_speed =24.0/23.0*global_speed;
  17. float step1_speed =3.0*8.0/ 7.0*global_speed;
  18. float step2_speed =2.0*12.0/11.0*global_speed;
  19. float step3_speed =18.0/17.0*global_speed;
  20.     vec2 uv = SCREEN_UV;    
  21.    
  22.     float range = 0.0419+TIME/10000.0;
  23.     float magical_power=sin(uv.y * 3.141592+TIME)*cos(uv.x*3.141592+TIME)*0.7;
  24.     vec2 trippyUv = vec2(uv.x + map(-range, range, smoothstep(0.0, 1.0, abs(fract(TIME * 0.320)*2.0-1.0))) * magical_power, uv.y+ map(-range, range, smoothstep(0.0, 1.0, abs(fract(TIME * 0.320)*2.0-1.0))) * magical_power);
  25.     vec4 trippyColor = textureLod(SCREEN_TEXTURE, trippyUv,0.0);
  26.     float weight0 = 1.0;
  27.     float weight1 = sin(TIME * weight11_speed) + sin(TIME * weight12_speed);
  28.     float weight2 = (sin(TIME * weight21_speed) + sin(TIME * weight22_speed))/2.0;
  29.     float weight3 = 1.0 - weight1 - weight2 - weight0;
  30.    
  31.     float step0 = 0.0;
  32.     float step1 = sin(TIME * step1_speed)+2.0;
  33.     float step2 = sin(TIME * step2_speed)*2.0+3.0;
  34.     float step3 = sin(TIME * step3_speed)*2.0+5.0;
  35.    
  36.     vec4 pixel0 = textureLod(SCREEN_TEXTURE, trippyUv, step0) * weight0;
  37.     vec4 pixel1 = textureLod(SCREEN_TEXTURE, trippyUv, step1) * weight1;
  38.     vec4 pixel2 = textureLod(SCREEN_TEXTURE, trippyUv, step2) * weight2;
  39.     vec4 pixel3 = textureLod(SCREEN_TEXTURE, trippyUv, step3) * weight3;
  40.        
  41.     COLOR = pixel0 + pixel1 + pixel2 + pixel3;
  42.     //vec4 tt=textureLod(SCREEN_TEXTURE,uv,0);
  43.     //COLOR=tt;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement