Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 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;
  31.  
  32. m.x = 0.2 * cos(time * PI2);
  33. m.y = 0.2 * sin(-time * PI2);
  34.  
  35. float md = distance(pos, m);
  36. float f = 0.001 + 0.04 * cos(10.0 * time * PI2);
  37. col = vec4(0.0, 0.01, 0.03, 0.0);
  38.  
  39. if(md < f && md > 0.0){
  40. if(time < 0.5){
  41. col.rgba += vec4(0.7, 0.7, 0.1, 1.0);
  42. } else {
  43. col.rgba += vec4(0.5, 0.2, 0.5, 1.0);
  44. }
  45. }
  46.  
  47. // Blend in last frame
  48. float d = 0.01;
  49. float d1 = 0.001 * cos(pos.x * 600.0 + pos.y * 600.0) + d;
  50. float d2 = 0.001 * cos(pos.x * 600.0 + pos.y * 600.0) + d;
  51. float d3 = 0.001 * cos(pos.x * 600.0 + pos.y * 600.0) + d;
  52. float d4 = 0.001 * cos(pos.x * 600.0 + pos.y * 600.0) + d;
  53.  
  54.  
  55. col += 0.23 * texture2D(pass1, lastUV + vec2(d1, 0.0)) * vec4(1.0, 0.4, 0.0, 0.0);
  56. col += 0.23 * texture2D(pass1, lastUV + vec2(-d2, 0.0));
  57. col += 0.23 * texture2D(pass1, lastUV + vec2(0.0, d3));
  58. col += 0.23 * texture2D(pass1, lastUV + vec2(0.0, -d4));
  59.  
  60. col.rgb *= 0.99;
  61.  
  62. } else if (pass == 2){
  63. col = texture2D(pass0, lastUV);
  64. } else if (pass == 3){
  65. col = texture2D(lastPass, lastUV);
  66. }
  67.  
  68. col.a = 1.0;
  69.  
  70. gl_FragColor = col;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement