Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. //PASSES=3
  2. precision highp float;
  3.  
  4. varying vec2 UV;
  5. varying vec2 lastUV;
  6. uniform vec2 mouse;
  7. uniform float time;
  8. uniform int pass;
  9. uniform sampler2D pass0;
  10. uniform sampler2D pass1;
  11. uniform sampler2D lastPass;
  12. uniform float ratio;
  13.  
  14. #define PI 3.14159265359
  15. #define PI2 6.28318
  16.  
  17. void main(void){
  18. float x = UV.x * ratio;
  19. float y = UV.y;
  20.  
  21. vec2 pos = vec2(x, y) - vec2(0.5);
  22.  
  23. vec4 col = vec4(0.0);
  24.  
  25. if(pass == 1){
  26. // Original pass: a simple circle
  27. vec2 center = vec2(0.0,0.0);
  28.  
  29.  
  30. vec2 m = vec2(0.0, 0.2 * cos(time * PI2 + 1.0));
  31.  
  32.  
  33. float md = distance(pos, m);
  34. float f = 0.003 + 0.02 * cos(10.0 * time * PI2);
  35. col = vec4(0.0);
  36.  
  37. if(md < f && md > 0.0){
  38. if(time < 0.5){
  39. col.rgba += vec4(0.7, 0.8, 0.8, 1.0);
  40. } else {
  41. col.rgba += vec4(0.2, 0.2, 0.8, 1.0);
  42. }
  43. }
  44.  
  45. // Blend in last frame
  46. float d = 0.002;
  47. float d1 = 0.007 * cos(pos.x * 20.0 + pos.y * 20.0) + d;
  48. float d2 = 0.007 * tan(pos.x * 20.0 + pos.y * 20.0) + d;
  49. float d3 = 0.007 * cos(pos.x * 20.0 + pos.y * 20.0) + d;
  50. float d4 = 0.007 * cos(pos.x * 20.0 + pos.y * 20.0) + d;
  51.  
  52.  
  53. col += 0.27 * texture2D(pass1, lastUV + vec2(d1, 0.0));
  54. col += 0.27 * texture2D(pass1, lastUV + vec2(-d2, 0.0));
  55. col += 0.27 * texture2D(pass1, lastUV + vec2(0.0, d3));
  56. col += 0.27 * texture2D(pass1, lastUV + vec2(0.0, -d4));
  57.  
  58. col.rgb *= 0.9;
  59.  
  60. } else if (pass == 2){
  61. col = texture2D(pass0, lastUV);
  62. } else if (pass == 3){
  63. col = texture2D(lastPass, lastUV);
  64. }
  65.  
  66. col.a = 1.0;
  67.  
  68. gl_FragColor = col;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement