Created
June 13, 2019 19:40
-
-
Save kebby/eb3b2663abd4097a24865eadfc21b2a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 sampler1D texFFTIntegrated; // this is continually increasing | |
float fMidiKnob; | |
float time = fGlobalTime; | |
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything | |
vec4 plas( vec2 v, float time ) | |
{ | |
float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 ); | |
return vec4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 ); | |
} | |
mat2 rot(float a) | |
{ | |
return mat2(cos(a),sin(a),-sin(a),cos(a)); | |
} | |
vec4 skybox(vec3 rd) | |
{ | |
if (rd.y < 0) return mix(vec4(0,0,0,0), vec4(0.5,0.2,0.1,1), rd.y+1); | |
return mix(vec4(0.1,0.4,0.7,1),vec4(0,0,0.2,1), rd.y); | |
} | |
void main(void) | |
{ | |
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); | |
uv -= 0.5; | |
uv.y += pow(texture(texFFTSmoothed, 0.2*abs(uv.x)).x,0.6) ; | |
uv.x += pow(texture(texFFTSmoothed, 0.2*abs(uv.y)).x,0.6) ; | |
uv /= vec2(v2Resolution.y / v2Resolution.x, 1); | |
//vec3 cp = vec3(0,2,-5); | |
//vec3 rd = normalize(vec3(uv,0.1)); | |
//vec4 sky = skybox(rd); | |
//uv *= rot(40*a); | |
float a = 100*texture(texFFTIntegrated, 0.1).x; | |
vec2 squv = uv * rot(a); | |
squv.x += 0.3*sin(texture(texFFTIntegrated,0.01).x*2.7); | |
squv.y += 0.3*1.7777*sin(texture(texFFTIntegrated,0.02).x*2.3); | |
float x = 8*sin(400*texture(texFFTIntegrated,0.03).x)+13; | |
float square = pow(clamp((1-max(0, x*abs(squv.x)-1)),0,1) * clamp((1-max(0, x*abs(squv.y)-1)),0,1),2.); | |
float t = time * 0.1; | |
uv *= 1.0 + 400*texture(texFFTSmoothed, 0.01).xx; | |
vec2 uv2 = uv; | |
uv.x += 0.1*sin(t)*sin(uv.y*11 + time); | |
uv.y += 0.1*sin(-t+1)*sin(uv.x*13 + time*1.3); | |
uv.x += 0.1*sin(-t+2)*sin(uv.y*17 + time*1.7); | |
uv.y += 0.1*sin(t+3)*sin(uv.x*19 + time*2.1); | |
uv.x += 0.1*sin(-t+4)*sin(uv.y*21 + time*3.3); | |
uv.y += 0.1*sin(-t+5)*sin(uv.x*23 + time*0.6); | |
uv.x += 0.1*sin(t+6)*sin(uv.y*29 + time*0.4); | |
uv.y += 0.1*sin(-t+7)*sin(uv.x*31 + time*4.2); | |
uv.x += 0.1*sin(t+8)*sin(uv.y*34 + time); | |
uv -= uv2; | |
vec3 d = normalize(vec3(uv,0.2)); | |
out_color = vec4(0.2,0.5,1,1)*pow(clamp(dot(d,normalize(vec3(1,1,1))),0,1),8)*clamp(sin(time*3.3),0,1); | |
out_color += vec4(1,0.5,0.2,1)*pow(clamp(dot(d,normalize(vec3(-1,1,1))),0,1),8)*clamp(sin(time*5.2),0,1);; | |
out_color += vec4(0.8,0.2,0.8,1)*pow(clamp(dot(d,normalize(vec3(1,-1,1))),0,1),8)*clamp(sin(time*3.7),0,1); | |
out_color += vec4(1,0.8,0.1,1)*pow(clamp(dot(d,normalize(vec3(-1,-1,1))),0,1),8)*clamp(sin(time*4.1),0,1);; | |
out_color += vec4(1,1,1,1)*pow(clamp(dot(d,normalize(vec3(0,0,1))),0,1),25); | |
out_color = mix(vec4(1,0.0,0.0,1),out_color,1-square); | |
out_color.xyz /= 4*length(uv2.xy); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment