From d4ca478ad313c6c20834e410ba14ad3a5e7b20bf Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 12 Jun 2012 10:28:26 -0700 Subject: Material cleanup & bug fixes. --- assets/shaders/Mandel.frag.glsl | 9 ++++++--- assets/shaders/ReliefTunnel.frag.glsl | 7 +++++-- assets/shaders/SquareTunnel.frag.glsl | 3 ++- assets/shaders/Star.frag.glsl | 11 +++++++---- assets/shaders/Tunnel.frag.glsl | 3 ++- assets/shaders/Twist.frag.glsl | 7 +++++-- assets/shaders/ZInvert.frag.glsl | 7 +++++-- assets/shaders/radialBlur.frag.glsl | 5 ++--- 8 files changed, 34 insertions(+), 18 deletions(-) (limited to 'assets') 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; uniform vec2 u_resolution; uniform float u_time; +uniform float u_speed; void main(void) { vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; p.x *= u_resolution.x/u_resolution.y; - float zoo = .62+.38*sin(.1*u_time); - float coa = cos( 0.1*(1.0-zoo)*u_time ); - float sia = sin( 0.1*(1.0-zoo)*u_time ); + float time = u_time * u_speed; + + float zoo = .62+.38*sin(.1*time); + float coa = cos( 0.1*(1.0-zoo)*time ); + float sia = sin( 0.1*(1.0-zoo)*time ); zoo = pow( zoo,8.0); vec2 xy = vec2( p.x*coa-p.y*sia, p.x*sia+p.y*coa); 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; uniform vec2 u_resolution; uniform float u_time; +uniform float u_speed; uniform sampler2D u_tex0; void main(void) @@ -11,8 +12,10 @@ void main(void) vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; vec2 uv; + float time = u_time * u_speed; + float r = sqrt( dot(p,p) ); - float a = atan(p.y,p.x) + 0.5*sin(0.5*r-0.5*u_time); + float a = atan(p.y,p.x) + 0.5*sin(0.5*r-0.5*time); float s = 0.5 + 0.5*cos(7.0*a); s = smoothstep(0.0,1.0,s); @@ -20,7 +23,7 @@ void main(void) s = smoothstep(0.0,1.0,s); s = smoothstep(0.0,1.0,s); - uv.x = u_time + 1.0/( r + .2*s); + uv.x = time + 1.0/( r + .2*s); uv.y = 3.0*a/3.1416; 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; uniform vec2 u_resolution; uniform float u_time; +uniform float u_speed; uniform sampler2D u_tex0; void main(void) @@ -12,7 +13,7 @@ void main(void) vec2 uv; float r = pow( pow(p.x*p.x,16.0) + pow(p.y*p.y,16.0), 1.0/32.0 ); - uv.x = .5*u_time + 0.5/r; + uv.x = 0.5*u_time*u_speed + 0.5/r; uv.y = 1.0*atan(p.y,p.x)/3.1416; 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; #endif uniform float u_time; +uniform float u_speed; uniform vec2 u_resolution; uniform sampler2D u_tex0; @@ -10,17 +11,19 @@ void main(void) { vec2 uv; + float time = u_time * u_speed; + vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; float a = atan(p.y,p.x); float r = sqrt(dot(p,p)); - float s = r * (1.0+0.8*cos(u_time*1.0)); + float s = r * (1.0+0.8*cos(time*1.0)); - uv.x = .02*p.y+.03*cos(-u_time+a*3.0)/s; - uv.y = .1*u_time +.02*p.x+.03*sin(-u_time+a*3.0)/s; + uv.x = .02*p.y+.03*cos(-time+a*3.0)/s; + uv.y = .1*time +.02*p.x+.03*sin(-time+a*3.0)/s; float w = .9 + pow(max(1.5-r,0.0),4.0); - w*=0.6+0.4*cos(u_time+3.0*a); + w*=0.6+0.4*cos(time+3.0*a); vec3 col = texture2D(u_tex0,uv).xyz; 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; uniform vec2 u_resolution; uniform float u_time; +uniform float u_speed; uniform sampler2D u_tex0; void main(void) @@ -14,7 +15,7 @@ void main(void) float a = atan(p.y,p.x); float r = sqrt(dot(p,p)); - uv.x = .75*u_time+.1/r; + uv.x = .75*u_time*u_speed + .1/r; uv.y = a/3.1416; 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; uniform vec2 u_resolution; uniform float u_time; +uniform float u_speed; uniform sampler2D u_tex0; void main(void) @@ -14,8 +15,10 @@ void main(void) float a = atan(p.y,p.x); float r = sqrt(dot(p,p)); - uv.x = r - .25*u_time; - uv.y = cos(a*5.0 + 2.0*sin(u_time+7.0*r)) ; + float time = u_time * u_speed; + + uv.x = r - .25*time; + uv.y = cos(a*5.0 + 2.0*sin(time+7.0*r)) ; vec3 col = (.5+.5*uv.y)*texture2D(u_tex0,uv).xyz; 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; uniform vec2 u_resolution; uniform float u_time; +uniform float u_speed; uniform sampler2D u_tex0; void main(void) @@ -11,11 +12,13 @@ void main(void) vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; vec2 uv; + float time = u_time * u_speed; + float a = atan(p.y,p.x); float r = sqrt(dot(p,p)); - uv.x = cos(0.6+u_time) + cos(cos(1.2+u_time)+a)/r; - uv.y = cos(0.3+u_time) + sin(cos(2.0+u_time)+a)/r; + uv.x = cos(0.6+time) + cos(cos(1.2+time)+a)/r; + uv.y = cos(0.3+time) + sin(cos(2.0+time)+a)/r; vec3 col = texture2D(u_tex0,uv*.25).xyz; 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; uniform vec2 u_resolution; uniform float u_time; -uniform vec4 color; +uniform float u_speed; uniform sampler2D u_tex0; vec3 deform( in vec2 p ) { vec2 uv; - //float time = color.x; - float time = u_time; + float time = u_time * u_speed; vec2 q = vec2( sin(1.1*time+p.x),sin(1.2*time+p.y) ); float a = atan(q.y,q.x); -- cgit v1.2.3