#version 410 core uniform float fGlobalTime; // in seconds uniform vec2 v2Resolution; // viewport resolution (in pixels) uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients uniform sampler2D texBirds; uniform sampler2D texGrass; uniform sampler2D texNormal; uniform sampler2D texPerlin; uniform sampler2D texTiles; uniform sampler2D texZigZag; layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything const float PI = 3.14159; void main() { vec2 uv = vec2((gl_FragCoord.x - v2Resolution.x*.5) / v2Resolution.y, (gl_FragCoord.y - v2Resolution.y*.5) / v2Resolution.y); uv *= 2.0; float factor = 0.; float f2 = 0.; float radius = 0.54; const int count = 20; for(int i = 0;i != count;++i) { float offset = sin(2 * PI * float(i) / float(count) + fGlobalTime * 0.4); float base = length(uv-vec2(offset, sin(fGlobalTime + 2 * PI * float(i) / float(count)))) + radius; factor += smoothstep(0., 1., 1.0 - base); factor += 0.2 * smoothstep(0., 1., 1.0 - base - sin(fGlobalTime) * 0.05); f2 += smoothstep(0., 1., 1.0 - base); factor += 0.1 * factor * texture(texPerlin, uv).x; } vec3 color = vec3(factor * 0.4, factor, factor); color += vec3(0, uv.y*0.4*factor, 0) + f2 * length(texture(texGrass, uv).xyz); out_color = vec4(color,1); }