|
@@ -0,0 +1,60 @@
|
|
1
|
+#version 410 core
|
|
2
|
+
|
|
3
|
+uniform float fGlobalTime; // in seconds
|
|
4
|
+uniform vec2 v2Resolution; // viewport resolution (in pixels)
|
|
5
|
+
|
|
6
|
+uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
|
|
7
|
+uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
|
|
8
|
+uniform sampler1D texFFTIntegrated; // this is continually increasing
|
|
9
|
+uniform sampler2D texChecker;
|
|
10
|
+uniform sampler2D texNoise;
|
|
11
|
+uniform sampler2D texTex1;
|
|
12
|
+uniform sampler2D texTex2;
|
|
13
|
+uniform sampler2D texTex3;
|
|
14
|
+uniform sampler2D texTex4;
|
|
15
|
+
|
|
16
|
+layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
|
|
17
|
+
|
|
18
|
+vec2 rot(vec2 p, float a)
|
|
19
|
+{
|
|
20
|
+ return mat2(cos(a),sin(-a),
|
|
21
|
+ sin(a),cos(-a)) * p;
|
|
22
|
+}
|
|
23
|
+
|
|
24
|
+float sphere(vec3 p )
|
|
25
|
+{
|
|
26
|
+ p.xz=rot(p.xz,-texture(texFFTIntegrated, 0.05).r);
|
|
27
|
+ return length(p)-(1.0+texture(texFFT,0.1).r*100+texture(texNoise,vec2(p.x,p.y+fGlobalTime/5.0)).r);//*(1+10.*texture(texFFT,0.1).r);
|
|
28
|
+}
|
|
29
|
+
|
|
30
|
+float dist(vec3 p)
|
|
31
|
+{
|
|
32
|
+ float d = 1000000.0;
|
|
33
|
+ p.xy = rot(p.xy, 0.1*p.z-fGlobalTime);
|
|
34
|
+ vec3 g = mod(p, 5.0) - 5.0 *0.5;
|
|
35
|
+ d = sphere(g);
|
|
36
|
+ //d = min(d, sphere(p-vec3(1.0,0.,0.)));
|
|
37
|
+return d;
|
|
38
|
+}
|
|
39
|
+
|
|
40
|
+void main(void)
|
|
41
|
+{
|
|
42
|
+ vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
|
|
43
|
+ uv -= 0.5;
|
|
44
|
+ uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
|
|
45
|
+
|
|
46
|
+ vec3 p0 = vec3(0,0,-3+100.*texture(texFFTIntegrated, 0.05).x);
|
|
47
|
+ vec3 dir = normalize(vec3(uv,1));
|
|
48
|
+
|
|
49
|
+ float st = 1.0;
|
|
50
|
+ vec3 p = p0;
|
|
51
|
+ for(int i=0;i<128;i++) {
|
|
52
|
+ float d = dist(p);
|
|
53
|
+ if (abs(d)<0.01) { st = float(i) / 128.0;break; }
|
|
54
|
+ p += d * dir;
|
|
55
|
+ }
|
|
56
|
+
|
|
57
|
+ vec3 c = vec3(exp(-distance(p,p0)*0.01)) * (0.5 + 0.5*(1.0-st));
|
|
58
|
+ c *= 1.0+3.0*vec3(texture(texFFT, 0.05+ p.x).r, texture(texFFT, 0.15+ p.y).r, texture(texFFT, 0.25+ p.z).r) * 10;
|
|
59
|
+ out_color = vec4(c,1);
|
|
60
|
+}
|