diff options
Diffstat (limited to 'assets/shaders/Star.frag.glsl')
-rw-r--r-- | assets/shaders/Star.frag.glsl | 11 |
1 files changed, 7 insertions, 4 deletions
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 | ||