diff options
author | hwc487 | 2012-06-12 10:28:26 -0700 |
---|---|---|
committer | hwc487 | 2012-06-12 10:28:26 -0700 |
commit | d4ca478ad313c6c20834e410ba14ad3a5e7b20bf (patch) | |
tree | 28e44c5ab1b2f9dbfd32aedba51402ac2d26a0ff /assets/shaders | |
parent | db2bb0ab5d2747f0d07878e3b8a7d2d10c755110 (diff) | |
download | ninja-d4ca478ad313c6c20834e410ba14ad3a5e7b20bf.tar.gz |
Material cleanup & bug fixes.
Diffstat (limited to 'assets/shaders')
-rw-r--r-- | assets/shaders/Mandel.frag.glsl | 9 | ||||
-rw-r--r-- | assets/shaders/ReliefTunnel.frag.glsl | 7 | ||||
-rw-r--r-- | assets/shaders/SquareTunnel.frag.glsl | 3 | ||||
-rw-r--r-- | assets/shaders/Star.frag.glsl | 11 | ||||
-rw-r--r-- | assets/shaders/Tunnel.frag.glsl | 3 | ||||
-rw-r--r-- | assets/shaders/Twist.frag.glsl | 7 | ||||
-rw-r--r-- | assets/shaders/ZInvert.frag.glsl | 7 | ||||
-rw-r--r-- | assets/shaders/radialBlur.frag.glsl | 5 |
8 files changed, 34 insertions, 18 deletions
diff --git a/assets/shaders/Mandel.frag.glsl b/assets/shaders/Mandel.frag.glsl index 6465899d..62be76b9 100644 --- a/assets/shaders/Mandel.frag.glsl +++ b/assets/shaders/Mandel.frag.glsl | |||
@@ -4,15 +4,18 @@ precision highp float; | |||
4 | 4 | ||
5 | uniform vec2 u_resolution; | 5 | uniform vec2 u_resolution; |
6 | uniform float u_time; | 6 | uniform float u_time; |
7 | uniform float u_speed; | ||
7 | 8 | ||
8 | void main(void) | 9 | void main(void) |
9 | { | 10 | { |
10 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | 11 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; |
11 | p.x *= u_resolution.x/u_resolution.y; | 12 | p.x *= u_resolution.x/u_resolution.y; |
12 | 13 | ||
13 | float zoo = .62+.38*sin(.1*u_time); | 14 | float time = u_time * u_speed; |
14 | float coa = cos( 0.1*(1.0-zoo)*u_time ); | 15 | |
15 | float sia = sin( 0.1*(1.0-zoo)*u_time ); | 16 | float zoo = .62+.38*sin(.1*time); |
17 | float coa = cos( 0.1*(1.0-zoo)*time ); | ||
18 | float sia = sin( 0.1*(1.0-zoo)*time ); | ||
16 | zoo = pow( zoo,8.0); | 19 | zoo = pow( zoo,8.0); |
17 | vec2 xy = vec2( p.x*coa-p.y*sia, p.x*sia+p.y*coa); | 20 | vec2 xy = vec2( p.x*coa-p.y*sia, p.x*sia+p.y*coa); |
18 | vec2 cc = vec2(-.745,.186) + xy*zoo; | 21 | vec2 cc = vec2(-.745,.186) + xy*zoo; |
diff --git a/assets/shaders/ReliefTunnel.frag.glsl b/assets/shaders/ReliefTunnel.frag.glsl index cee707db..5bd727cf 100644 --- a/assets/shaders/ReliefTunnel.frag.glsl +++ b/assets/shaders/ReliefTunnel.frag.glsl | |||
@@ -4,6 +4,7 @@ precision highp float; | |||
4 | 4 | ||
5 | uniform vec2 u_resolution; | 5 | uniform vec2 u_resolution; |
6 | uniform float u_time; | 6 | uniform float u_time; |
7 | uniform float u_speed; | ||
7 | uniform sampler2D u_tex0; | 8 | uniform sampler2D u_tex0; |
8 | 9 | ||
9 | void main(void) | 10 | void main(void) |
@@ -11,8 +12,10 @@ void main(void) | |||
11 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | 12 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; |
12 | vec2 uv; | 13 | vec2 uv; |
13 | 14 | ||
15 | float time = u_time * u_speed; | ||
16 | |||
14 | float r = sqrt( dot(p,p) ); | 17 | float r = sqrt( dot(p,p) ); |
15 | float a = atan(p.y,p.x) + 0.5*sin(0.5*r-0.5*u_time); | 18 | float a = atan(p.y,p.x) + 0.5*sin(0.5*r-0.5*time); |
16 | 19 | ||
17 | float s = 0.5 + 0.5*cos(7.0*a); | 20 | float s = 0.5 + 0.5*cos(7.0*a); |
18 | s = smoothstep(0.0,1.0,s); | 21 | s = smoothstep(0.0,1.0,s); |
@@ -20,7 +23,7 @@ void main(void) | |||
20 | s = smoothstep(0.0,1.0,s); | 23 | s = smoothstep(0.0,1.0,s); |
21 | s = smoothstep(0.0,1.0,s); | 24 | s = smoothstep(0.0,1.0,s); |
22 | 25 | ||
23 | uv.x = u_time + 1.0/( r + .2*s); | 26 | uv.x = time + 1.0/( r + .2*s); |
24 | uv.y = 3.0*a/3.1416; | 27 | uv.y = 3.0*a/3.1416; |
25 | 28 | ||
26 | float w = (0.5 + 0.5*s)*r*r; | 29 | float w = (0.5 + 0.5*s)*r*r; |
diff --git a/assets/shaders/SquareTunnel.frag.glsl b/assets/shaders/SquareTunnel.frag.glsl index 51ef7b7c..1298a03a 100644 --- a/assets/shaders/SquareTunnel.frag.glsl +++ b/assets/shaders/SquareTunnel.frag.glsl | |||
@@ -4,6 +4,7 @@ precision highp float; | |||
4 | 4 | ||
5 | uniform vec2 u_resolution; | 5 | uniform vec2 u_resolution; |
6 | uniform float u_time; | 6 | uniform float u_time; |
7 | uniform float u_speed; | ||
7 | uniform sampler2D u_tex0; | 8 | uniform sampler2D u_tex0; |
8 | 9 | ||
9 | void main(void) | 10 | void main(void) |
@@ -12,7 +13,7 @@ void main(void) | |||
12 | vec2 uv; | 13 | vec2 uv; |
13 | 14 | ||
14 | float r = pow( pow(p.x*p.x,16.0) + pow(p.y*p.y,16.0), 1.0/32.0 ); | 15 | float r = pow( pow(p.x*p.x,16.0) + pow(p.y*p.y,16.0), 1.0/32.0 ); |
15 | uv.x = .5*u_time + 0.5/r; | 16 | uv.x = 0.5*u_time*u_speed + 0.5/r; |
16 | uv.y = 1.0*atan(p.y,p.x)/3.1416; | 17 | uv.y = 1.0*atan(p.y,p.x)/3.1416; |
17 | 18 | ||
18 | vec3 col = texture2D(u_tex0,uv).xyz; | 19 | vec3 col = texture2D(u_tex0,uv).xyz; |
diff --git a/assets/shaders/Star.frag.glsl b/assets/shaders/Star.frag.glsl index f63fe605..f61f43c9 100644 --- a/assets/shaders/Star.frag.glsl +++ b/assets/shaders/Star.frag.glsl | |||
@@ -3,6 +3,7 @@ precision highp float; | |||
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | uniform float u_time; | 5 | uniform float u_time; |
6 | uniform float u_speed; | ||
6 | uniform vec2 u_resolution; | 7 | uniform vec2 u_resolution; |
7 | uniform sampler2D u_tex0; | 8 | uniform sampler2D u_tex0; |
8 | 9 | ||
@@ -10,17 +11,19 @@ void main(void) | |||
10 | { | 11 | { |
11 | vec2 uv; | 12 | vec2 uv; |
12 | 13 | ||
14 | float time = u_time * u_speed; | ||
15 | |||
13 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | 16 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; |
14 | float a = atan(p.y,p.x); | 17 | float a = atan(p.y,p.x); |
15 | float r = sqrt(dot(p,p)); | 18 | float r = sqrt(dot(p,p)); |
16 | float s = r * (1.0+0.8*cos(u_time*1.0)); | 19 | float s = r * (1.0+0.8*cos(time*1.0)); |
17 | 20 | ||
18 | uv.x = .02*p.y+.03*cos(-u_time+a*3.0)/s; | 21 | uv.x = .02*p.y+.03*cos(-time+a*3.0)/s; |
19 | uv.y = .1*u_time +.02*p.x+.03*sin(-u_time+a*3.0)/s; | 22 | uv.y = .1*time +.02*p.x+.03*sin(-time+a*3.0)/s; |
20 | 23 | ||
21 | float w = .9 + pow(max(1.5-r,0.0),4.0); | 24 | float w = .9 + pow(max(1.5-r,0.0),4.0); |
22 | 25 | ||
23 | w*=0.6+0.4*cos(u_time+3.0*a); | 26 | w*=0.6+0.4*cos(time+3.0*a); |
24 | 27 | ||
25 | vec3 col = texture2D(u_tex0,uv).xyz; | 28 | vec3 col = texture2D(u_tex0,uv).xyz; |
26 | 29 | ||
diff --git a/assets/shaders/Tunnel.frag.glsl b/assets/shaders/Tunnel.frag.glsl index 9deb52fb..def28e2e 100644 --- a/assets/shaders/Tunnel.frag.glsl +++ b/assets/shaders/Tunnel.frag.glsl | |||
@@ -4,6 +4,7 @@ precision highp float; | |||
4 | 4 | ||
5 | uniform vec2 u_resolution; | 5 | uniform vec2 u_resolution; |
6 | uniform float u_time; | 6 | uniform float u_time; |
7 | uniform float u_speed; | ||
7 | uniform sampler2D u_tex0; | 8 | uniform sampler2D u_tex0; |
8 | 9 | ||
9 | void main(void) | 10 | void main(void) |
@@ -14,7 +15,7 @@ void main(void) | |||
14 | float a = atan(p.y,p.x); | 15 | float a = atan(p.y,p.x); |
15 | float r = sqrt(dot(p,p)); | 16 | float r = sqrt(dot(p,p)); |
16 | 17 | ||
17 | uv.x = .75*u_time+.1/r; | 18 | uv.x = .75*u_time*u_speed + .1/r; |
18 | uv.y = a/3.1416; | 19 | uv.y = a/3.1416; |
19 | 20 | ||
20 | vec3 col = texture2D(u_tex0,uv).xyz; | 21 | vec3 col = texture2D(u_tex0,uv).xyz; |
diff --git a/assets/shaders/Twist.frag.glsl b/assets/shaders/Twist.frag.glsl index b7477747..ab66cdae 100644 --- a/assets/shaders/Twist.frag.glsl +++ b/assets/shaders/Twist.frag.glsl | |||
@@ -4,6 +4,7 @@ precision highp float; | |||
4 | 4 | ||
5 | uniform vec2 u_resolution; | 5 | uniform vec2 u_resolution; |
6 | uniform float u_time; | 6 | uniform float u_time; |
7 | uniform float u_speed; | ||
7 | uniform sampler2D u_tex0; | 8 | uniform sampler2D u_tex0; |
8 | 9 | ||
9 | void main(void) | 10 | void main(void) |
@@ -14,8 +15,10 @@ void main(void) | |||
14 | float a = atan(p.y,p.x); | 15 | float a = atan(p.y,p.x); |
15 | float r = sqrt(dot(p,p)); | 16 | float r = sqrt(dot(p,p)); |
16 | 17 | ||
17 | uv.x = r - .25*u_time; | 18 | float time = u_time * u_speed; |
18 | uv.y = cos(a*5.0 + 2.0*sin(u_time+7.0*r)) ; | 19 | |
20 | uv.x = r - .25*time; | ||
21 | uv.y = cos(a*5.0 + 2.0*sin(time+7.0*r)) ; | ||
19 | 22 | ||
20 | vec3 col = (.5+.5*uv.y)*texture2D(u_tex0,uv).xyz; | 23 | vec3 col = (.5+.5*uv.y)*texture2D(u_tex0,uv).xyz; |
21 | 24 | ||
diff --git a/assets/shaders/ZInvert.frag.glsl b/assets/shaders/ZInvert.frag.glsl index b1fd1748..1566b881 100644 --- a/assets/shaders/ZInvert.frag.glsl +++ b/assets/shaders/ZInvert.frag.glsl | |||
@@ -4,6 +4,7 @@ precision highp float; | |||
4 | 4 | ||
5 | uniform vec2 u_resolution; | 5 | uniform vec2 u_resolution; |
6 | uniform float u_time; | 6 | uniform float u_time; |
7 | uniform float u_speed; | ||
7 | uniform sampler2D u_tex0; | 8 | uniform sampler2D u_tex0; |
8 | 9 | ||
9 | void main(void) | 10 | void main(void) |
@@ -11,11 +12,13 @@ void main(void) | |||
11 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | 12 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; |
12 | vec2 uv; | 13 | vec2 uv; |
13 | 14 | ||
15 | float time = u_time * u_speed; | ||
16 | |||
14 | float a = atan(p.y,p.x); | 17 | float a = atan(p.y,p.x); |
15 | float r = sqrt(dot(p,p)); | 18 | float r = sqrt(dot(p,p)); |
16 | 19 | ||
17 | uv.x = cos(0.6+u_time) + cos(cos(1.2+u_time)+a)/r; | 20 | uv.x = cos(0.6+time) + cos(cos(1.2+time)+a)/r; |
18 | uv.y = cos(0.3+u_time) + sin(cos(2.0+u_time)+a)/r; | 21 | uv.y = cos(0.3+time) + sin(cos(2.0+time)+a)/r; |
19 | 22 | ||
20 | vec3 col = texture2D(u_tex0,uv*.25).xyz; | 23 | vec3 col = texture2D(u_tex0,uv*.25).xyz; |
21 | 24 | ||
diff --git a/assets/shaders/radialBlur.frag.glsl b/assets/shaders/radialBlur.frag.glsl index 673d082a..c4520e58 100644 --- a/assets/shaders/radialBlur.frag.glsl +++ b/assets/shaders/radialBlur.frag.glsl | |||
@@ -3,15 +3,14 @@ precision highp float; | |||
3 | 3 | ||
4 | uniform vec2 u_resolution; | 4 | uniform vec2 u_resolution; |
5 | uniform float u_time; | 5 | uniform float u_time; |
6 | uniform vec4 color; | 6 | uniform float u_speed; |
7 | uniform sampler2D u_tex0; | 7 | uniform sampler2D u_tex0; |
8 | 8 | ||
9 | vec3 deform( in vec2 p ) | 9 | vec3 deform( in vec2 p ) |
10 | { | 10 | { |
11 | vec2 uv; | 11 | vec2 uv; |
12 | 12 | ||
13 | //float time = color.x; | 13 | float time = u_time * u_speed; |
14 |