aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/radialBlur.frag.glsl
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-24 12:08:49 -0800
committerPushkar Joshi2012-02-24 12:08:49 -0800
commit03ca7a5ed13c25faaa9100bb666e062fd15335e6 (patch)
treec51112223ceb9121cd595a60335eb2795215590f /assets/shaders/radialBlur.frag.glsl
parentfcb12cc09eb3cd3b42bd215877ba18f449275b75 (diff)
parent053fc63a2950c7a5ee4ebf98033b64d474a3c46e (diff)
downloadninja-03ca7a5ed13c25faaa9100bb666e062fd15335e6.tar.gz
Merge branch 'pentool' into brushtool
Conflicts: imports/codemirror/mode/scheme/scheme.js js/tools/BrushTool.js
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