aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders')
-rw-r--r--assets/shaders/Paris.frag.glsl68
-rw-r--r--assets/shaders/plasma.frag.glsl4
2 files changed, 69 insertions, 3 deletions
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 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4
5uniform sampler2D u_tex0;
6uniform float u_time;
7uniform vec2 u_resolution;
8const float PI = 3.1415926535897932;
9
10//speed
11
12const float speed = 0.1;
13const float speed_x = 0.075;
14const float speed_y = 0.000;
15
16// geometry
17const float intensity = 1.5;
18const int steps = 8;
19//const float frequency = 4.0;
20const float frequency = 2.0;
21const int angle = 7; // better when a prime
22
23// reflection and emboss
24const float delta = 20.;
25const float intence = 400.;
26const float emboss = 0.3;
27
28//---------- crystals effect
29
30 float col(vec2 coord)
31 {
32 float delta_theta = 2.0 * PI / float(angle);
33 float col = 0.0;
34 float theta = 0.0;
35 for (int i = 0; i < steps; i++)
36 {
37 vec2 adjc = coord;
38 theta = delta_theta*float(i);
39 adjc.x += cos(theta)*u_time*speed + u_time * speed_x;
40 adjc.y -= sin(theta)*u_time*speed - u_time * speed_y;
41 col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*intensity;
42 }
43
44 return cos(col);
45 }
46
47//---------- main
48
49void main(void)
50{
51vec2 p = (gl_FragCoord.xy) / u_resolution.xy, c1 = p, c2 = p;
52float cc1 = col(c1);
53
54c2.x += u_resolution.x/delta;
55float dx = emboss*(cc1-col(c2))/delta;
56
57c2.x = p.x;
58c2.y += u_resolution.y/delta;
59float dy = emboss*(cc1-col(c2))/delta;
60
61c1.x += dx;
62c1.y = -(c1.y+dy);
63
64float alpha = 1.+dot(dx,dy)*intence;
65gl_FragColor = texture2D(u_tex0,c1)*(alpha);
66// gl_FragColor = vec4(col(p),0,0,1);
67
68}
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)
22{ 22{
23 float x = v_uv.x ; 23 float x = v_uv.x ;
24 float y = v_uv.y ; 24 float y = v_uv.y ;
25 float time = color.x; 25 float time = u_time;
26 float wave = (cos(time + y / 0.2 + cos(x / 0.3 + cos((y / 0.1))))); 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))); 27 float wave1 = (sin(abs(wave + y/0.6)));
28 float wave2 = (sin(abs(wave1 + y/0.8))); 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); 29 gl_FragColor = vec4( abs(vec3(wave2,wave1,wave)),1.0);
31 //gl_FragColor = color;
32} 30}