diff options
author | hwc487 | 2012-01-27 15:52:36 -0800 |
---|---|---|
committer | hwc487 | 2012-01-27 15:52:36 -0800 |
commit | 86a801c057fc3b0580d6130be5740c2ee503444f (patch) | |
tree | 8b014e981273464afde4e0603cdf70c6e90eee48 /assets/shaders | |
parent | 302e3eb01037ff550bc93547cb8d5d0a0780b312 (diff) | |
download | ninja-86a801c057fc3b0580d6130be5740c2ee503444f.tar.gz |
updated from old repo
Diffstat (limited to 'assets/shaders')
-rw-r--r-- | assets/shaders/Julia.frag.glsl | 25 | ||||
-rw-r--r-- | assets/shaders/Keleidoscope.frag.glsl | 25 | ||||
-rw-r--r-- | assets/shaders/Mandel.frag.glsl | 55 | ||||
-rw-r--r-- | assets/shaders/Pulse.frag.glsl | 22 | ||||
-rw-r--r-- | assets/shaders/Tunnel.frag.glsl | 23 | ||||
-rw-r--r-- | assets/shaders/Twist.frag.glsl | 23 | ||||
-rw-r--r-- | assets/shaders/plasma.frag.glsl | 32 | ||||
-rw-r--r-- | assets/shaders/plasma.vert.glsl | 42 | ||||
-rw-r--r-- | assets/shaders/radialBlur.frag.glsl | 47 | ||||
-rw-r--r-- | assets/shaders/radialGradient.frag.glsl | 51 | ||||
-rw-r--r-- | assets/shaders/radialGradient.vert.glsl | 28 | ||||
-rw-r--r-- | assets/shaders/test_fshader.glsl | 25 |
12 files changed, 385 insertions, 13 deletions
diff --git a/assets/shaders/Julia.frag.glsl b/assets/shaders/Julia.frag.glsl new file mode 100644 index 00000000..68cda703 --- /dev/null +++ b/assets/shaders/Julia.frag.glsl | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform vec2 u_resolution; | ||
6 | uniform float u_time; | ||
7 | |||
8 | void main(void) | ||
9 | { | ||
10 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | ||
11 | vec2 cc = vec2( cos(.25*u_time), sin(.25*u_time*1.423) ); | ||
12 | |||
13 | float dmin = 1000.0; | ||
14 | vec2 z = p*vec2(1.33,1.0); | ||
15 | for( int i=0; i<64; i++ ) | ||
16 | { | ||
17 | z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y ); | ||
18 | float m2 = dot(z,z); | ||
19 | if( m2>100.0 ) break; | ||
20 | dmin=min(dmin,m2); | ||
21 | } | ||
22 | |||
23 | float color = sqrt(sqrt(dmin))*0.7; | ||
24 | gl_FragColor = vec4(color,color,color,1.0); | ||
25 | } \ No newline at end of file | ||
diff --git a/assets/shaders/Keleidoscope.frag.glsl b/assets/shaders/Keleidoscope.frag.glsl new file mode 100644 index 00000000..7d1bdb17 --- /dev/null +++ b/assets/shaders/Keleidoscope.frag.glsl | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform vec2 u_resolution; | ||
6 | uniform float u_time; | ||
7 | uniform sampler2D u_tex0; | ||
8 | |||
9 | void main(void) | ||
10 | { | ||
11 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | ||
12 | vec2 uv; | ||
13 | |||
14 | float a = atan(p.y,p.x); | ||
15 | float r = sqrt(dot(p,p)); | ||
16 | |||
17 | uv.x = 7.0*a/3.1416; | ||
18 | uv.y = -u_time+ sin(7.0*r+u_time) + .7*cos(u_time+7.0*a); | ||
19 | |||
20 | float w = .5+.5*(sin(u_time+7.0*r)+ .7*cos(u_time+7.0*a)); | ||
21 | |||
22 | vec3 col = texture2D(u_tex0,uv*.5).xyz; | ||
23 | |||
24 | gl_FragColor = vec4(col*w,1.0); | ||
25 | } \ No newline at end of file | ||
diff --git a/assets/shaders/Mandel.frag.glsl b/assets/shaders/Mandel.frag.glsl new file mode 100644 index 00000000..6465899d --- /dev/null +++ b/assets/shaders/Mandel.frag.glsl | |||
@@ -0,0 +1,55 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform vec2 u_resolution; | ||
6 | uniform float u_time; | ||
7 | |||
8 | void main(void) | ||
9 | { | ||
10 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | ||
11 | p.x *= u_resolution.x/u_resolution.y; | ||
12 | |||
13 | float zoo = .62+.38*sin(.1*u_time); | ||
14 | float coa = cos( 0.1*(1.0-zoo)*u_time ); | ||
15 | float sia = sin( 0.1*(1.0-zoo)*u_time ); | ||
16 | zoo = pow( zoo,8.0); | ||
17 | vec2 xy = vec2( p.x*coa-p.y*sia, p.x*sia+p.y*coa); | ||
18 | vec2 cc = vec2(-.745,.186) + xy*zoo; | ||
19 | |||
20 | vec2 z = vec2(0.0); | ||
21 | vec2 z2 = z*z; | ||
22 | float m2; | ||
23 | float co = 0.0; | ||
24 | |||
25 | |||
26 | // chrome/angelproject/nvidia/glslES don't seem to like to "break" a loop... | ||
27 | // so we have to rewrite it in another way | ||
28 | /* | ||
29 | for( int i=0; i<256; i++ ) | ||
30 | { | ||
31 | z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y ); | ||
32 | m2 = dot(z,z); | ||
33 | if( m2>1024.0 ) break; | ||
34 | co += 1.0; | ||
35 | } | ||
36 | */ | ||
37 | |||
38 | for( int i=0; i<256; i++ ) | ||
39 | { | ||
40 | if( m2<1024.0 ) | ||
41 | { | ||
42 | z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y ); | ||
43 | m2 = dot(z,z); | ||
44 | co += 1.0; | ||
45 | } | ||
46 | } | ||
47 | |||
48 | co = co + 1.0 - log2(.5*log2(m2)); | ||
49 | |||
50 | co = sqrt(co/256.0); | ||
51 | gl_FragColor = vec4( .5+.5*cos(6.2831*co+0.0), | ||
52 | .5+.5*cos(6.2831*co+0.4), | ||
53 | .5+.5*cos(6.2831*co+0.7), | ||
54 | 1.0 ); | ||
55 | } \ No newline at end of file | ||
diff --git a/assets/shaders/Pulse.frag.glsl b/assets/shaders/Pulse.frag.glsl new file mode 100644 index 00000000..b24c9bef --- /dev/null +++ b/assets/shaders/Pulse.frag.glsl | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform float u_time; | ||
6 | uniform vec2 u_resolution; | ||
7 | uniform sampler2D u_tex0; | ||
8 | |||
9 | void main(void) | ||
10 | { | ||
11 | vec2 halfres = u_resolution.xy/2.0; | ||
12 | vec2 cPos = gl_FragCoord.xy; | ||
13 | |||
14 | cPos.x -= 0.5*halfres.x*sin(u_time/2.0)+0.3*halfres.x*cos(u_time)+halfres.x; | ||
15 | cPos.y -= 0.4*halfres.y*sin(u_time/5.0)+0.3*halfres.y*cos(u_time)+halfres.y; | ||
16 | float cLength = length(cPos); | ||
17 | |||
18 | vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-u_time*10.0)/25.0; | ||
19 | vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength; | ||
20 | |||
21 | gl_FragColor = vec4(col,1.0); | ||
22 | } \ No newline at end of file | ||
diff --git a/assets/shaders/Tunnel.frag.glsl b/assets/shaders/Tunnel.frag.glsl new file mode 100644 index 00000000..9deb52fb --- /dev/null +++ b/assets/shaders/Tunnel.frag.glsl | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform vec2 u_resolution; | ||
6 | uniform float u_time; | ||
7 | uniform sampler2D u_tex0; | ||
8 | |||
9 | void main(void) | ||
10 | { | ||
11 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | ||
12 | vec2 uv; | ||
13 | |||
14 | float a = atan(p.y,p.x); | ||
15 | float r = sqrt(dot(p,p)); | ||
16 | |||
17 | uv.x = .75*u_time+.1/r; | ||
18 | uv.y = a/3.1416; | ||
19 | |||
20 | vec3 col = texture2D(u_tex0,uv).xyz; | ||
21 | |||
22 | gl_FragColor = vec4(col*r,1.0); | ||
23 | } \ No newline at end of file | ||
diff --git a/assets/shaders/Twist.frag.glsl b/assets/shaders/Twist.frag.glsl new file mode 100644 index 00000000..b7477747 --- /dev/null +++ b/assets/shaders/Twist.frag.glsl | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform vec2 u_resolution; | ||
6 | uniform float u_time; | ||
7 | uniform sampler2D u_tex0; | ||
8 | |||
9 | void main(void) | ||
10 | { | ||
11 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | ||
12 | vec2 uv; | ||
13 | |||
14 | float a = atan(p.y,p.x); | ||
15 | float r = sqrt(dot(p,p)); | ||
16 | |||
17 | uv.x = r - .25*u_time; | ||
18 | uv.y = cos(a*5.0 + 2.0*sin(u_time+7.0*r)) ; | ||
19 | |||
20 | vec3 col = (.5+.5*uv.y)*texture2D(u_tex0,uv).xyz; | ||
21 | |||
22 | gl_FragColor = vec4(col,1.0); | ||
23 | } \ No newline at end of file | ||
diff --git a/assets/shaders/plasma.frag.glsl b/assets/shaders/plasma.frag.glsl new file mode 100644 index 00000000..2ab8f49c --- /dev/null +++ b/assets/shaders/plasma.frag.glsl | |||
@@ -0,0 +1,32 @@ | |||
1 | // | ||
2 | // Fragment shader for procedural bricks | ||
3 | // | ||
4 | // Authors: Dave Baldwin, Steve Koren, Randi Rost | ||
5 | // based on a shader by Darwyn Peachey | ||
6 | // | ||
7 | // Copyright (c) 2002-2006 3Dlabs Inc. Ltd. | ||
8 | // | ||
9 | // See 3Dlabs-License.txt for license information | ||
10 | // | ||
11 | |||
12 | #ifdef GL_ES | ||
13 | precision highp float; | ||
14 | #endif | ||
15 | |||
16 | |||
17 | varying vec2 v_uv; | ||
18 | uniform float u_time; | ||
19 | uniform vec4 color; | ||
20 | |||
21 | void main(void) | ||
22 | { | ||
23 | float x = v_uv.x ; | ||
24 | float y = v_uv.y ; | ||
25 | float time = color.x; | ||
26 | float wave = (cos(time + y / 0.2 + cos(x / 0.3 + cos((y / 0.1))))); | ||
27 | float wave1 = (sin(abs(wave + y/0.6))); | ||
28 | float wave2 = (sin(abs(wave1 + y/0.8))); | ||
29 | float tmp = u_time * 0.1; | ||
30 | gl_FragColor = vec4( abs(vec3(wave2,wave1,wave)),1.0); | ||
31 | //gl_FragColor = color; | ||
32 | } | ||
diff --git a/assets/shaders/plasma.vert.glsl b/assets/shaders/plasma.vert.glsl new file mode 100644 index 00000000..f817c143 --- /dev/null +++ b/assets/shaders/plasma.vert.glsl | |||
@@ -0,0 +1,42 @@ | |||
1 | // | ||
2 | // Vertex shader for procedural bricks | ||
3 | // | ||
4 | // Authors: Dave Baldwin, Steve Koren, Randi Rost | ||
5 | // based on a shader by Darwyn Peachey | ||
6 | // | ||
7 | // Copyright (c) 2002-2006 3Dlabs Inc. Ltd. | ||
8 | // | ||
9 | // |