#version 150 precision highp float; //Ethan Alexander Shulman February 29, 2020 "Galactic Noise" in vec3 in_Position; out vec4 uv; out float time; layout(std140) uniform ShaderviewBlock { vec4 mouse; float screenX,screenY; int frame,framerate; }; #define screen vec2(screenX,screenY) #define PI 3.14159265358 mat2 r2(float a) { float sn = sin(a), cs = cos(a); return mat2(cs,-sn,sn,cs); } vec4 hash(vec4 a) { return fract(abs(sin(a.ywxz*766.345)+cos(normalize(a)*4972.92855))*2048.97435+abs(a.wxyz)*.2735); } vec3 hsvToRGB(vec3 hsv) { return mix(clamp(abs(mod(hsv.x*6.0+vec3(0.,4.,2.),6.)-3.0)-1.0,0.,1.),vec3(1),hsv.y)*hsv.z; } float twave(float x) { x = fract(x); return x*2.-max(0.,x*4.-2.); } void vert() { time = float(frame)/float(framerate); uv = vec4(in_Position.xy*(.25+twave(time*.03))*vec2(screenX/screenY,1),(in_Position.xy*.5+.5)*screen); gl_Position = vec4(in_Position,1); } void frag() { vec3 c = vec3(0); for (float p = 1.; p < 100.; p++) { vec4 pp = hash(p*vec4(.01,.1,1.,10.)); c += cos((time*-.05+length(uv.xy-(pp.xy*2.-1.)))*p*vec3(pp.zw*10.,10))/p; } gl_FragColor = vec4(hsvToRGB(pow(clamp(c*.2+.5,0.,1.),vec3(1.,4.,3.))),1); //gl_FragColor = vec4(pow(abs(c*.4),vec3(1.5)),1); }