From 9e812f35ffa751e9215c5427c0c44005bd357924 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 7 Mar 2012 17:18:38 -0800 Subject: Fixed a few problems with Plasma material. --- assets/shaders/plasma.frag.glsl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/plasma.frag.glsl b/assets/shaders/plasma.frag.glsl index 2ab8f49c..248288a6 100644 --- a/assets/shaders/plasma.frag.glsl +++ b/assets/shaders/plasma.frag.glsl @@ -22,11 +22,9 @@ void main(void) { float x = v_uv.x ; float y = v_uv.y ; - float time = color.x; + 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 tmp = u_time * 0.1; gl_FragColor = vec4( abs(vec3(wave2,wave1,wave)),1.0); - //gl_FragColor = color; } -- cgit v1.2.3 From fdeed8051c3af538d28ca3bc599121cea483c22c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 22 Mar 2012 15:47:56 -0700 Subject: Squashed commit of the following GL integration Signed-off-by: Valerio Virgillito --- assets/shaders/Paris.frag.glsl | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 assets/shaders/Paris.frag.glsl (limited to 'assets/shaders') diff --git a/assets/shaders/Paris.frag.glsl b/assets/shaders/Paris.frag.glsl new file mode 100644 index 00000000..690b1453 --- /dev/null +++ b/assets/shaders/Paris.frag.glsl @@ -0,0 +1,68 @@ +#ifdef GL_ES +precision highp float; +#endif + +uniform sampler2D u_tex0; +uniform float u_time; +uniform vec2 u_resolution; +const float PI = 3.1415926535897932; + +//speed + +const float speed = 0.1; +const float speed_x = 0.075; +const float speed_y = 0.000; + +// geometry +const float intensity = 1.5; +const int steps = 8; +//const float frequency = 4.0; +const float frequency = 2.0; +const int angle = 7; // better when a prime + +// reflection and emboss +const float delta = 20.; +const float intence = 400.; +const float emboss = 0.3; + +//---------- crystals effect + + float col(vec2 coord) + { + float delta_theta = 2.0 * PI / float(angle); + float col = 0.0; + float theta = 0.0; + for (int i = 0; i < steps; i++) + { + 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; + } + + return cos(col); + } + +//---------- main + +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 = p.x; +c2.y += u_resolution.y/delta; +float dy = emboss*(cc1-col(c2))/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