aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/radialBlur.frag.glsl
diff options
context:
space:
mode:
authorhwc4872012-01-27 15:52:36 -0800
committerhwc4872012-01-27 15:52:36 -0800
commit86a801c057fc3b0580d6130be5740c2ee503444f (patch)
tree8b014e981273464afde4e0603cdf70c6e90eee48 /assets/shaders/radialBlur.frag.glsl
parent302e3eb01037ff550bc93547cb8d5d0a0780b312 (diff)
downloadninja-86a801c057fc3b0580d6130be5740c2ee503444f.tar.gz
updated from old repo
Diffstat (limited to 'assets/shaders/radialBlur.frag.glsl')
-rw-r--r--assets/shaders/radialBlur.frag.glsl47
1 files changed, 47 insertions, 0 deletions
diff --git a/assets/shaders/radialBlur.frag.glsl b/assets/shaders/radialBlur.frag.glsl
new file mode 100644
index 00000000..673d082a
--- /dev/null
+++ b/assets/shaders/radialBlur.frag.glsl
@@ -0,0 +1,47 @@
1
2precision highp float;
3
4uniform vec2 u_resolution;
5uniform float u_time;
6uniform vec4 color;
7uniform sampler2D u_tex0;
8
9vec3 deform( in vec2 p )
10{
11 vec2 uv;
12
13 //float time = color.x;
14 float time = u_time;
15 vec2 q = vec2( sin(1.1*time+p.x),sin(1.2*time+p.y) );
16
17 float a = atan(q.y,q.x);
18 float r = sqrt(dot(q,q));
19
20 uv.x = sin(0.0+1.0*time)+p.x*sqrt(r*r+1.0);
21 uv.y = sin(0.6+1.1*time)+p.y*sqrt(r*r+1.0);
22
23 return texture2D(u_tex0,uv*.5).xyz;
24}
25
26void main(void)
27{
28 vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
29 //vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / vec2(500,500).xy;
30 vec2 s = p;
31
32 vec3 total = vec3(0.0);
33 vec2 d = (vec2(0.0,0.0)-p)/40.0;
34 float w = 1.0;
35 for( int i=0; i<40; i++ )
36 {
37 vec3 res = deform(s);
38 res = smoothstep(0.1,1.0,res*res);
39 total += w*res;
40 w *= .99;
41 s += d;
42 }
43 total /= 40.0;
44 float r = 1.5/(1.0+dot(p,p));
45
46 gl_FragColor = vec4( total*r,1.0);
47} \ No newline at end of file