From 4b199cf04af83f59895d4d1e9a2d8443c1ec8e06 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 3 Apr 2012 09:36:14 -0700 Subject: started the flag material --- assets/shaders/Flag.frag.glsl | 13 +++++++++++++ assets/shaders/Flag.vert.glsl | 29 +++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 assets/shaders/Flag.frag.glsl (limited to 'assets/shaders') diff --git a/assets/shaders/Flag.frag.glsl b/assets/shaders/Flag.frag.glsl new file mode 100644 index 00000000..79d4bec3 --- /dev/null +++ b/assets/shaders/Flag.frag.glsl @@ -0,0 +1,13 @@ +#ifdef GL_ES +precision highp float; +#endif + +uniform sampler2D u_tex0; + +varying vec2 v_uv; + +void main(void) +{ + vec3 col = texture2D(u_tex0, v_uv).xyz; + gl_FragColor = vec4(col,1.0); +} \ No newline at end of file diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index 7dc932a7..9da0ee1c 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl @@ -16,20 +16,33 @@ attribute vec2 texcoord; // scalar uniforms uniform float u_time; +uniform float u_waveWidth; +uniform float u_waveHeight; // matrix uniforms uniform mat4 u_mvMatrix; uniform mat4 u_projMatrix; uniform mat4 u_worldMatrix; +// varying variables +varying vec2 v_uv; + void main() { - float angle = (u_time%360)*2; - - a_pos.z = sin( a_pos.x + angle); - a_pos.z += sin( a_pos.y/2 + angle); - a_pos.z *= a_pos.x * 0.09; - gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; - - gl_FragColor = v_color; + float pi = 3.14159; + float angle = mod(u_time, pi)*2.0; + + vec3 v = a_pos; + v_uv = texcoord; + + vec2 pos = texcoord; + float tmp = pos.x; pos.x = pos.y; pos.y = tmp; + pos.x = pos.x * 1.0*pi * u_waveWidth; + pos.y = pos.y * 1.0*pi * u_waveWidth; + + v.z = sin( pos.x + angle); + v.z += sin( pos.y/2.0 + angle); + v.z *= v.y * 0.09 * u_waveHeight; + + gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; } -- cgit v1.2.3 From 0f31002ca696c1ef303d2926a504afd27305e94f Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 4 Apr 2012 05:52:54 -0700 Subject: Added Flag material --- assets/shaders/Flag.vert.glsl | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index 9da0ee1c..a5e8b2f7 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl @@ -27,22 +27,21 @@ uniform mat4 u_worldMatrix; // varying variables varying vec2 v_uv; + void main() { - float pi = 3.14159; - float angle = mod(u_time, pi)*2.0; + float pi = 3.14159; + float angle = u_time; - vec3 v = a_pos; v_uv = texcoord; - vec2 pos = texcoord; - float tmp = pos.x; pos.x = pos.y; pos.y = tmp; - pos.x = pos.x * 1.0*pi * u_waveWidth; - pos.y = pos.y * 1.0*pi * u_waveWidth; + float x = 2.0*pi*texcoord.x/u_waveWidth; + float y = 2.0*pi*texcoord.y; - v.z = sin( pos.x + angle); - v.z += sin( pos.y/2.0 + angle); - v.z *= v.y * 0.09 * u_waveHeight; + vec3 v = a_pos; + v.z = sin( x + angle ) - 2.0*u_waveHeight; + v.z += sin( 0.2*y + angle); + v.z *= x * 0.09 * u_waveHeight; gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; } -- cgit v1.2.3 From 32c973351bc6f4d682205b788dc6235fc9452e07 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 4 Apr 2012 16:58:43 -0700 Subject: added copyright info to flag frag shader --- assets/shaders/Flag.frag.glsl | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'assets/shaders') diff --git a/assets/shaders/Flag.frag.glsl b/assets/shaders/Flag.frag.glsl index 79d4bec3..b05b4888 100644 --- a/assets/shaders/Flag.frag.glsl +++ b/assets/shaders/Flag.frag.glsl @@ -1,3 +1,10 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + #ifdef GL_ES precision highp float; #endif -- cgit v1.2.3 From c1a6cacf364d79cbf23b41e7089a1a6d39afea85 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 10 Apr 2012 10:12:49 -0700 Subject: Cloud material --- assets/shaders/Cloud.frag.glsl | 23 +++++++++++++++++++++++ assets/shaders/Cloud.vert.glsl | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 assets/shaders/Cloud.frag.glsl create mode 100644 assets/shaders/Cloud.vert.glsl (limited to 'assets/shaders') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl new file mode 100644 index 00000000..522e17bb --- /dev/null +++ b/assets/shaders/Cloud.frag.glsl @@ -0,0 +1,23 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + +uniform sampler2D u_tex0; +uniform float u_surfaceAlpha; + +varying vec4 v_Colors; +varying vec2 v_texCoord0; + + +void main() +{ + gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; +} + \ No newline at end of file diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl new file mode 100644 index 00000000..fbd7f40b --- /dev/null +++ b/assets/shaders/Cloud.vert.glsl @@ -0,0 +1,42 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + +// attributes +attribute vec3 a_pos; +attribute vec2 texcoord; + +// uniforms +uniform float u_time; +uniform float u_zmin; +uniform float u_zmax; +uniform float u_surfaceAlpha; + +// matrix uniforms +uniform mat4 u_mvMatrix; +uniform mat4 u_projMatrix; +uniform mat4 u_worldMatrix; + +// varying +varying vec2 v_texCoord0; + +// constants +const float zSpeed = 1.0; + + +void main() +{ + // Transform position + vec4 pos = a_pos; + pos.z += u+time*zSpeed; + gl_Position = u_projMatrix * u_mvMatrix * pos; + + v_texCoord0 = texcoord; +} \ No newline at end of file -- cgit v1.2.3 From 1b7592f81c9b47c2b42d78efe385cd979d54d3ca Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 11 Apr 2012 06:24:05 -0700 Subject: Cloud material --- assets/shaders/Cloud.vert.glsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index fbd7f40b..c673e40c 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl @@ -34,8 +34,8 @@ const float zSpeed = 1.0; void main() { // Transform position - vec4 pos = a_pos; - pos.z += u+time*zSpeed; + vec4 pos = vec4(a_pos,1); + pos.z += u_time*zSpeed; gl_Position = u_projMatrix * u_mvMatrix * pos; v_texCoord0 = texcoord; -- cgit v1.2.3 From 331b2ad4d602016f9bb3d03be759fd81fed50c10 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 13 Apr 2012 07:08:42 -0700 Subject: Cloud Material --- assets/shaders/Cloud.frag.glsl | 4 ++-- assets/shaders/Cloud.vert.glsl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index 522e17bb..b07bb627 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -12,12 +12,12 @@ precision highp float; uniform sampler2D u_tex0; uniform float u_surfaceAlpha; -varying vec4 v_Colors; varying vec2 v_texCoord0; void main() { - gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; + // gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; + gl_FragColor = vec4(1,0,0,1); } \ No newline at end of file diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index c673e40c..9a235349 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl @@ -35,7 +35,7 @@ void main() { // Transform position vec4 pos = vec4(a_pos,1); - pos.z += u_time*zSpeed; + //pos.z += u_time*zSpeed; gl_Position = u_projMatrix * u_mvMatrix * pos; v_texCoord0 = texcoord; -- cgit v1.2.3 From 8992d9baf542135e910bb59328a592d9e330703a Mon Sep 17 00:00:00 2001 From: hwc487 Date: Sun, 15 Apr 2012 05:16:34 -0700 Subject: Cloud Material --- assets/shaders/Basic.vert.glsl | 3 +++ assets/shaders/BasicTex.frag.glsl | 19 +++++++++++++++++++ assets/shaders/Cloud.frag.glsl | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 assets/shaders/BasicTex.frag.glsl (limited to 'assets/shaders') diff --git a/assets/shaders/Basic.vert.glsl b/assets/shaders/Basic.vert.glsl index 0d5b8d63..f96f8322 100755 --- a/assets/shaders/Basic.vert.glsl +++ b/assets/shaders/Basic.vert.glsl @@ -14,6 +14,8 @@ precision highp float; attribute vec3 a_pos; attribute vec2 texcoord; +// varying +varying vec2 v_texCoord0; // matrix uniforms uniform mat4 u_mvMatrix; @@ -22,5 +24,6 @@ uniform mat4 u_worldMatrix; void main(void) { + v_texCoord0 = texcoord; gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; } \ No newline at end of file diff --git a/assets/shaders/BasicTex.frag.glsl b/assets/shaders/BasicTex.frag.glsl new file mode 100644 index 00000000..a716e77d --- /dev/null +++ b/assets/shaders/BasicTex.frag.glsl @@ -0,0 +1,19 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + +uniform sampler2D u_tex0; + +varying vec2 v_texCoord0; + + +void main() { + gl_FragColor = texture2D(u_tex0, v_texCoord0); +} diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index b07bb627..ba1ef39e 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -17,7 +17,7 @@ varying vec2 v_texCoord0; void main() { - // gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; - gl_FragColor = vec4(1,0,0,1); + gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; + //gl_FragColor = texture2D(u_tex0, v_texCoord0); } \ No newline at end of file -- cgit v1.2.3 From c0aa5e88890fbf74124d019df96c33215da99f17 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 16 Apr 2012 05:59:01 -0700 Subject: Cloud material --- assets/shaders/Cloud.frag.glsl | 5 +++-- assets/shaders/Cloud.vert.glsl | 12 ++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index ba1ef39e..c21dcf97 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -17,7 +17,8 @@ varying vec2 v_texCoord0; void main() { - gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; - //gl_FragColor = texture2D(u_tex0, v_texCoord0); + vec4 c = texture2D(u_tex0, v_texCoord0); + //c.a *= u_surfaceAlpha; + gl_FragColor = c; } \ No newline at end of file diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index 9a235349..c8ca9f3f 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl @@ -28,14 +28,22 @@ uniform mat4 u_worldMatrix; varying vec2 v_texCoord0; // constants -const float zSpeed = 1.0; +const float zSpeed = 2.0; void main() { // Transform position vec4 pos = vec4(a_pos,1); - //pos.z += u_time*zSpeed; + float dz = u_time*zSpeed; + float n = floor( dz/(u_zmax-u_zmin) ); + dz -= n*(u_zmax - u_zmin); + float z = pos.z + dz; + if (z > u_zmax) + { + z = u_zmin + (z - u_zmax); + } + pos.z = z; gl_Position = u_projMatrix * u_mvMatrix * pos; v_texCoord0 = texcoord; -- cgit v1.2.3 From 447268000c379f619c78d7132c81e23b5c252598 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 17 Apr 2012 09:20:49 -0700 Subject: Cloud material --- assets/shaders/Cloud.frag.glsl | 4 ++-- assets/shaders/Cloud.vert.glsl | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index c21dcf97..3d466a24 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -18,7 +18,7 @@ varying vec2 v_texCoord0; void main() { vec4 c = texture2D(u_tex0, v_texCoord0); - //c.a *= u_surfaceAlpha; - gl_FragColor = c; + c.a *= u_surfaceAlpha; + gl_FragColor = c; } \ No newline at end of file diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index c8ca9f3f..acd581fc 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl @@ -22,19 +22,19 @@ uniform float u_surfaceAlpha; // matrix uniforms uniform mat4 u_mvMatrix; uniform mat4 u_projMatrix; -uniform mat4 u_worldMatrix; // varying varying vec2 v_texCoord0; // constants -const float zSpeed = 2.0; +const float zSpeed = 10.0; void main() { // Transform position vec4 pos = vec4(a_pos,1); + float dz = u_time*zSpeed; float n = floor( dz/(u_zmax-u_zmin) ); dz -= n*(u_zmax - u_zmin); @@ -44,6 +44,7 @@ void main() z = u_zmin + (z - u_zmax); } pos.z = z; + gl_Position = u_projMatrix * u_mvMatrix * pos; v_texCoord0 = texcoord; -- cgit v1.2.3 From ae7eb87564632ce7c676bd728b8ff2710ff0bb83 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 18 Apr 2012 15:44:26 -0700 Subject: Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Snapping_II Conflicts: js/tools/Rotate3DToolBase.js js/tools/RotateStage3DTool.js js/tools/Translate3DToolBase.js js/tools/modifier-tool-base.js --- assets/shaders/Cloud.frag.glsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index 3d466a24..3f858b7a 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -18,7 +18,8 @@ varying vec2 v_texCoord0; void main() { vec4 c = texture2D(u_tex0, v_texCoord0); - c.a *= u_surfaceAlpha; + //c.a *= u_surfaceAlpha; + if ((c.r == 0.0) && (c.b == 0.0) && (c.g == 0.0) && (c.a == 1.0)) c = vec4( 0.0, 0.0, 1.0, 1.0 ); gl_FragColor = c; } \ No newline at end of file -- cgit v1.2.3 From 1e649405d66f17d6acddb9055b181bba7ad70566 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 16 May 2012 13:41:48 -0700 Subject: Exposing parameters in Water Material --- assets/shaders/Water2.frag.glsl | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Water2.frag.glsl b/assets/shaders/Water2.frag.glsl index 39b6aa55..49b2b647 100644 --- a/assets/shaders/Water2.frag.glsl +++ b/assets/shaders/Water2.frag.glsl @@ -8,20 +8,27 @@ uniform vec2 u_resolution; const float PI = 3.1415926535897932; //speed -const float speed = 0.2; +//const float speed = 0.2; const float speed_x = 0.3; const float speed_y = 0.3; // geometry -const float intensity = 3.; +//const float intensity = 3.; const int steps = 8; const float frequency = 4.0; const int angle = 7; // better when a prime // reflection and emboss -const float delta = 20.; +//const float delta = 20.; const float intence = 400.; -const float emboss = 0.3; +//const float emboss = 0.3; + +// uniforms +uniform float u_emboss; +uniform float u_delta; +//uniform float u_intence; +uniform float u_intensity; +uniform float u_speed; //---------- crystals effect @@ -34,9 +41,9 @@ const float emboss = 0.3; { vec2 adjc = coord; theta = delta_theta*float(i); - adjc.x += cos(theta)*u_time*speed + u_time * speed_x; - adjc.y -= sin(theta)*u_time*speed - u_time * speed_y; - col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*intensity; + adjc.x += cos(theta)*u_time*u_speed + u_time * speed_x; + adjc.y -= sin(theta)*u_time*u_speed - u_time * speed_y; + col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*u_intensity; } return cos(col); @@ -49,18 +56,17 @@ void main(void) vec2 p = (gl_FragCoord.xy) / u_resolution.xy, c1 = p, c2 = p; float cc1 = col(c1); -c2.x += u_resolution.x/delta; -float dx = emboss*(cc1-col(c2))/delta; +c2.x += u_resolution.x/u_delta; +float dx = u_emboss*(cc1-col(c2))/u_delta; c2.x = p.x; -c2.y += u_resolution.y/delta; -float dy = emboss*(cc1-col(c2))/delta; +c2.y += u_resolution.y/u_delta; +float dy = u_emboss*(cc1-col(c2))/u_delta; c1.x += dx; c1.y = -(c1.y+dy); float alpha = 1.+dot(dx,dy)*intence; gl_FragColor = texture2D(u_tex0,c1)*(alpha); -// gl_FragColor = vec4(col(p),0,0,1); } -- cgit v1.2.3 From dc92188fef67d7a2032173d7746fbc16a951a366 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 17 May 2012 15:15:43 -0700 Subject: Exposing parameters for pulse and plasma materials --- assets/shaders/Pulse.frag.glsl | 12 +++++++++--- assets/shaders/plasma.frag.glsl | 16 +++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Pulse.frag.glsl b/assets/shaders/Pulse.frag.glsl index b24c9bef..9aeb05c9 100644 --- a/assets/shaders/Pulse.frag.glsl +++ b/assets/shaders/Pulse.frag.glsl @@ -6,16 +6,22 @@ uniform float u_time; uniform vec2 u_resolution; uniform sampler2D u_tex0; +uniform float u_speed; +uniform float u_xscale; +uniform float u_yscale; + void main(void) { vec2 halfres = u_resolution.xy/2.0; vec2 cPos = gl_FragCoord.xy; - cPos.x -= 0.5*halfres.x*sin(u_time/2.0)+0.3*halfres.x*cos(u_time)+halfres.x; - cPos.y -= 0.4*halfres.y*sin(u_time/5.0)+0.3*halfres.y*cos(u_time)+halfres.y; + float time = u_time * u_speed; + + cPos.x -= u_xscale*halfres.x*sin(time/2.0)+0.3*halfres.x*cos(time)+halfres.x; + cPos.y -= u_yscale*halfres.y*sin(time/5.0)+0.3*halfres.y*cos(time)+halfres.y; float cLength = length(cPos); - vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-u_time*10.0)/25.0; + vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-time*10.0)/25.0; vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength; gl_FragColor = vec4(col,1.0); diff --git a/assets/shaders/plasma.frag.glsl b/assets/shaders/plasma.frag.glsl index 248288a6..4a5ac3da 100644 --- a/assets/shaders/plasma.frag.glsl +++ b/assets/shaders/plasma.frag.glsl @@ -16,15 +16,21 @@ precision highp float; varying vec2 v_uv; uniform float u_time; -uniform vec4 color; + +uniform float u_wave; +uniform float u_wave1; +uniform float u_wave2; +uniform float u_speed; void main(void) { float x = v_uv.x ; float y = v_uv.y ; - float time = u_time; - float wave = (cos(time + y / 0.2 + cos(x / 0.3 + cos((y / 0.1))))); - float wave1 = (sin(abs(wave + y/0.6))); - float wave2 = (sin(abs(wave1 + y/0.8))); + float time = u_time*u_speed; + + float wave = (cos(time + y / (u_wave+0.2) + cos(x / (u_wave+0.3) + cos((y / (u_wave+0.1)))))); + float wave1 = (sin(abs(wave + y/u_wave1))); + float wave2 = (sin(abs(wave1 + y/u_wave2))); + gl_FragColor = vec4( abs(vec3(wave2,wave1,wave)),1.0); } -- cgit v1.2.3 From cc3b66f817c9d72ca247d5ff789a08ec5b57a2b5 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 22 May 2012 08:38:38 -0700 Subject: Editable material properties --- assets/shaders/test_fshader.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'assets/shaders') diff --git a/assets/shaders/test_fshader.glsl b/assets/shaders/test_fshader.glsl index 629d1878..229b8989 100755 --- a/assets/shaders/test_fshader.glsl +++ b/assets/shaders/test_fshader.glsl @@ -32,7 +32,7 @@ uniform sampler2D depthMap; uniform vec4 u_matAmbient; uniform vec4 u_matDiffuse; uniform vec4 u_matSpecular; -uniform float u_matShininess; +//uniform float u_matShininess; uniform vec4 u_matEmission; uniform float u_renderGlow; -- cgit v1.2.3 From 50ede4afa801f53caff7939dad0408f9a0a8b744 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 22 May 2012 15:44:51 -0700 Subject: Editable parameters for flag, pulse, uber, and radial gradient materials. --- assets/shaders/Flag.vert.glsl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index a5e8b2f7..1c842cb0 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl @@ -16,6 +16,7 @@ attribute vec2 texcoord; // scalar uniforms uniform float u_time; +uniform float u_speed; uniform float u_waveWidth; uniform float u_waveHeight; @@ -30,8 +31,9 @@ varying vec2 v_uv; void main() { - float pi = 3.14159; - float angle = u_time; + float time = u_time * u_speed; + const float pi = 3.14159; + float angle = time; v_uv = texcoord; @@ -39,9 +41,11 @@ void main() float y = 2.0*pi*texcoord.y; vec3 v = a_pos; - v.z = sin( x + angle ) - 2.0*u_waveHeight; + v.z = sin( x + angle ); v.z += sin( 0.2*y + angle); - v.z *= x * 0.09 * u_waveHeight; + v.z *= u_waveHeight; + v.z -= 2.0*u_waveHeight; + v.z *= x * 0.09; gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; } -- cgit v1.2.3 From 725c2175f20b5e0829518f725fd26cc077748bdf Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 25 May 2012 13:35:10 -0700 Subject: Parameters for twistVertex material --- assets/shaders/Cloud.frag.glsl | 2 -- assets/shaders/TwistVert.frag.glsl | 1 - assets/shaders/TwistVert.vert.glsl | 11 ++--------- 3 files changed, 2 insertions(+), 12 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index 2447fd79..cd70d1a0 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -18,8 +18,6 @@ varying vec2 v_texCoord0; void main() { vec4 c = texture2D(u_tex0, v_texCoord0); - //c.a *= u_surfaceAlpha; - //if ((c.r == 0.0) && (c.b == 0.0) && (c.g == 0.0) && (c.a == 1.0)) c = vec4( 0.0, 0.0, 1.0, 1.0 ); gl_FragColor = c; } \ No newline at end of file diff --git a/assets/shaders/TwistVert.frag.glsl b/assets/shaders/TwistVert.frag.glsl index f8490615..01c32c42 100644 --- a/assets/shaders/TwistVert.frag.glsl +++ b/assets/shaders/TwistVert.frag.glsl @@ -28,5 +28,4 @@ void main() col = texture2D(u_tex1, v_texcoord).xyz; gl_FragColor = vec4(col, 1.0); - //gl_FragColor = v_color; } diff --git a/assets/shaders/TwistVert.vert.glsl b/assets/shaders/TwistVert.vert.glsl index 29cb30ea..9734063d 100644 --- a/assets/shaders/TwistVert.vert.glsl +++ b/assets/shaders/TwistVert.vert.glsl @@ -19,7 +19,7 @@ attribute vec2 texcoord; uniform float u_limit1; uniform float u_limit2; uniform float u_twistAmount; -uniform float u_center; +//uniform float u_center; // texture sampler uniforms uniform sampler2D u_tex0; @@ -63,17 +63,14 @@ void main(void) vec2 uv = texcoord; v_texcoord = texcoord; - //v_color = vec4(texcoord.x, texcoord.y, 0, 1); - v_zNormal = 1.0; if (uv.x < u_limit2) { float angle = GetAngle( uv.x ); float cs = cos(angle), sn = sin(angle); - pos.y -= u_center; vec3 ctrPt = pos; - float y = pos.y*cs - pos.z*sn + u_center; + float y = pos.y*cs - pos.z*sn; // + u_center; pos.z = pos.y*sn + pos.z*cs; pos.y = y; @@ -85,11 +82,7 @@ void main(void) cs = cos(angle); sn = sin(angle); rotMat = mat3( vec3( 1.0, 0.0, 0.0 ), vec3( 0.0, cs, sn ), vec3( 0.0, -sn, cs ) ); pt2 = rotMat * pt2; - pt0.y += u_center; pt1.y += u_center; pt2.y += u_center; - //vec4 nrm = u_projMatrix * u_mvMatrix * vec4( cross(pt1-pt0, pt2-pt0), 1.0 ); vec4 nrm = vec4( cross(pt1-pt0, pt2-pt0), 1.0 ); - - //v_zNormal = normal.y*sn + normal.z*cs; v_zNormal = -nrm.z; } -- cgit v1.2.3 From 6c994c4b90023cecf4fd0caafb404b859fe28f54 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 6 Jun 2012 16:34:41 -0700 Subject: material cleanup and rearchitecture --- assets/shaders/Taper.vert.glsl | 2 -- 1 file changed, 2 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Taper.vert.glsl b/assets/shaders/Taper.vert.glsl index 30b73456..eb562c2f 100644 --- a/assets/shaders/Taper.vert.glsl +++ b/assets/shaders/Taper.vert.glsl @@ -24,8 +24,6 @@ uniform float u_minVal; uniform float u_maxVal; uniform float u_center; -uniform vec4 color; - // matrix uniforms uniform mat4 u_mvMatrix; -- cgit v1.2.3 From db2bb0ab5d2747f0d07878e3b8a7d2d10c755110 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 7 Jun 2012 17:07:21 -0700 Subject: Material cleanup --- assets/shaders/Deform.frag.glsl | 3 ++- assets/shaders/Fly.frag.glsl | 5 +++-- assets/shaders/Julia.frag.glsl | 3 ++- assets/shaders/Keleidoscope.frag.glsl | 8 ++++++-- 4 files changed, 13 insertions(+), 6 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Deform.frag.glsl b/assets/shaders/Deform.frag.glsl index 1dbe45a0..a2bb4fa0 100644 --- a/assets/shaders/Deform.frag.glsl +++ b/assets/shaders/Deform.frag.glsl @@ -3,6 +3,7 @@ precision highp float; #endif uniform float u_time; +uniform float u_speed; uniform vec2 u_resolution; //uniform vec4 mouse; uniform sampler2D u_tex0; @@ -19,7 +20,7 @@ void main(void) float r2 = sqrt(dot(p+m,p+m)); vec2 uv; - uv.x = 0.2*u_time + (r1-r2)*0.25; + uv.x = 0.2*u_time*u_speed + (r1-r2)*0.25; uv.y = sin(2.0*(a1-a2)); float w = r1*r2*0.8; diff --git a/assets/shaders/Fly.frag.glsl b/assets/shaders/Fly.frag.glsl index f99b5ab8..d36928a1 100644 --- a/assets/shaders/Fly.frag.glsl +++ b/assets/shaders/Fly.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,13 +12,13 @@ void main(void) vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; vec2 uv; - float an = u_time*.25; + float an = u_time*u_speed*.25; float x = p.x*cos(an)-p.y*sin(an); float y = p.x*sin(an)+p.y*cos(an); uv.x = .25*x/abs(y); - uv.y = .20*u_time + .25/abs(y); + uv.y = .20*u_time*u_speed + .25/abs(y); gl_FragColor = vec4(texture2D(u_tex0,uv).xyz * y*y, 1.0); } diff --git a/assets/shaders/Julia.frag.glsl b/assets/shaders/Julia.frag.glsl index 68cda703..7e616c40 100644 --- a/assets/shaders/Julia.frag.glsl +++ b/assets/shaders/Julia.frag.glsl @@ -4,11 +4,12 @@ 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; - vec2 cc = vec2( cos(.25*u_time), sin(.25*u_time*1.423) ); + vec2 cc = vec2( cos(.25*u_time*u_speed), sin(.25*u_time*u_speed*1.423) ); float dmin = 1000.0; vec2 z = p*vec2(1.33,1.0); diff --git a/assets/shaders/Keleidoscope.frag.glsl b/assets/shaders/Keleidoscope.frag.glsl index 7d1bdb17..7d95a95b 100644 --- a/assets/shaders/Keleidoscope.frag.glsl +++ b/assets/shaders/Keleidoscope.frag.glsl @@ -4,20 +4,24 @@ precision highp float; uniform vec2 u_resolution; uniform float u_time; +uniform float u_speed; uniform sampler2D u_tex0; 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 = 7.0*a/3.1416; - uv.y = -u_time+ sin(7.0*r+u_time) + .7*cos(u_time+7.0*a); + uv.y = -time + sin(7.0*r+time) + .7*cos( + +7.0*a); - float w = .5+.5*(sin(u_time+7.0*r)+ .7*cos(u_time+7.0*a)); + float w = .5+.5*(sin(time+7.0*r)+ .7*cos(time+7.0*a)); vec3 col = texture2D(u_tex0,uv*.5).xyz; -- cgit v1.2.3 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/shaders') 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