Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //PASSES=3
- precision highp float;
- varying vec2 UV;
- varying vec2 lastUV;
- uniform vec2 mouse;
- uniform float time;
- uniform int pass;
- uniform sampler2D pass0;
- uniform sampler2D pass1;
- uniform sampler2D lastPass;
- uniform float ratio;
- #define PI 3.14159265359
- #define PI2 6.28318
- void main(void){
- float x = UV.x * ratio;
- float y = UV.y;
- vec2 pos = vec2(x, y) - vec2(0.5);
- vec4 col = vec4(0.0);
- if(pass == 1){
- // Original pass: a simple circle
- vec2 center = vec2(0.0,0.0);
- vec2 m;
- m.x = 0.2 * cos(time * PI2);
- m.y = 0.2 * sin(-time * PI2);
- float md = distance(pos, m);
- float f = 0.001 + 0.04 * cos(10.0 * time * PI2);
- col = vec4(0.0, 0.01, 0.03, 0.0);
- if(md < f && md > 0.0){
- if(time < 0.5){
- col.rgba += vec4(0.7, 0.7, 0.1, 1.0);
- } else {
- col.rgba += vec4(0.5, 0.2, 0.5, 1.0);
- }
- }
- // Blend in last frame
- float d = 0.01;
- float d1 = 0.001 * cos(pos.x * 600.0 + pos.y * 600.0) + d;
- float d2 = 0.001 * cos(pos.x * 600.0 + pos.y * 600.0) + d;
- float d3 = 0.001 * cos(pos.x * 600.0 + pos.y * 600.0) + d;
- float d4 = 0.001 * cos(pos.x * 600.0 + pos.y * 600.0) + d;
- col += 0.23 * texture2D(pass1, lastUV + vec2(d1, 0.0)) * vec4(1.0, 0.4, 0.0, 0.0);
- col += 0.23 * texture2D(pass1, lastUV + vec2(-d2, 0.0));
- col += 0.23 * texture2D(pass1, lastUV + vec2(0.0, d3));
- col += 0.23 * texture2D(pass1, lastUV + vec2(0.0, -d4));
- col.rgb *= 0.99;
- } else if (pass == 2){
- col = texture2D(pass0, lastUV);
- } else if (pass == 3){
- col = texture2D(lastPass, lastUV);
- }
- col.a = 1.0;
- gl_FragColor = col;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement