Add shaders

This commit is contained in:
Jonathan Giroux
2017-06-26 02:47:36 +02:00
parent f787b6aa54
commit 46118c8796
14 changed files with 1121 additions and 0 deletions

83
01-anton.glsl Normal file
View File

@ -0,0 +1,83 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
vec2 rot(vec2 v, float a)
{
float sa = sin(a);float ca = cos(a);
return mat2(ca,-sa,sa,ca) * v;
}
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
float map(vec3 pos,out float id)
{
vec3 cp = pos;
cp.y-= abs(cp.x * .7);
float f1 = distance(cp, vec3(0.,0.,10.)) - 1.;
float d = abs(pos.x);
float n = texture(texNoise,pos.xz * .01+ vec2(0.,fGlobalTime * .1)).z * (2. + d);
float f2 = distance(pos.y, -2. - n);
id = step(f1,f2);
return min(f1, f2);
}
int STEP = 128;
float ESP = .001;
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
vec3 ro = vec3(uv,-5.);
vec3 rd = normalize(vec3(uv, 1.));
vec3 cp = ro;
float cd;
int cs = 0;
float id ;
for(; cs < STEP; ++ cs)
{
cd = map(cp,id);
if(cd < ESP)
break;
cp += rd * cd * .5;
}
float f = 1.-float(cs) / float (STEP);
vec4 sc = mix(vec4(.8,.9,.3,1.),vec4(.2,.4,.7,1.),sin((fGlobalTime - cp.z)*.05));
vec2 uv2 = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
vec4 tex = texture(texPegasus,uv2 * vec2(1.,-1.) + vec2(0.,sin(uv2.x * 4.+ fGlobalTime * 1.)*.1));
out_color = mix(vec4(1.,0.,.3,1.),sc,1.-id);
if(cd > 1.)
out_color = mix(out_color,tex,1.-f);
}

76
01-eybor.glsl Normal file
View File

@ -0,0 +1,76 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
vec2 rot(vec2 p, float angle)
{
return mat2(cos(angle), -sin(angle), sin(angle), cos(angle))*p;
}
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 );
}
float box(vec3 p, vec3 dims)
{
return max(abs(p.x-dims.x), max(abs(p.y - dims.y), abs(p.z - dims.z)));
}
float scene(vec3 p)
{
return min(box(p+vec3(0., 5., 0.), vec3(3.)), p.y+ sin(p.x)*cos(p.z*.1)*3.);
}
vec3 n(vec3 p)
{
vec2 e = vec2(0., .001);
return normalize(vec3(scene(p-e.xyy)-scene(p+e.xyy),
scene(p-e.yxy)-scene(p+e.yxy),
scene(p-e.yyx)-scene(p+e.yyx)));
}
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
vec3 rd = normalize(vec3(-1.+2.*uv, 1.));
vec3 o = vec3(0., 2., 5.);
vec3 p = o;
for(int i = 0; i < 256; ++i)
{
p += scene(p)*rd;
}
vec3 color = vec3(1.);
uv = rot(uv, fGlobalTime + texture(texFFTIntegrated, .15).x);
color = vec3(max(dot(n(p), normalize(vec3(-2., -5., -3.))), 0.));
color = mix(vec3(.5, .8,.9), color, max(1.-distance(p,o)*.001, 0.));
vec4 tex = texture(texPegasus, p.xz+vec2(fGlobalTime));
color = tex.w == 1. ? tex.xyz : color;
out_color = vec4(color, 1.);
}

74
02-flopine.glsl Normal file
View File

@ -0,0 +1,74 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
float x = 0.2;
//mat3 rot(cos(x),-sin(x),0, sin(x),cos(x),0,0,0,1);
float sphere (vec3 pos, float r)
{
return length(pos) - r;
}
float box (vec3 m, vec3 t)
{
return length(max(abs(m)-t,0.0));
}
float map (vec3 pos)
{
return sphere(pos,1.0);
//return max(-sphere(pos,0.3), box(pos,vec3(0.0,0.0,0.0)));
}
/*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 );
}*/
void main()
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
vec3 pos = vec3 (uv,-5.0);
vec3 dir = normalize(vec3(uv,1.0));
float prout = 0.001;
float STEP = 250.0;
/*vec2 m;
m.x = atan(uv.x / uv.y) / 3.14;
m.y = 1 / length(uv) * .2;
float d = m.y;
float f = texture( texFFT, d ).r * 100;
m.x += sin( fGlobalTime ) * 0.1;
m.y += fGlobalTime * 0.25;
vec4 t = plas( m * 3.14, fGlobalTime ) / d;
t = clamp( t, 0.0, 1.0 );*/
float cd = 0;
for (cd = 0; cd < STEP; cd++)
{
float d = map(pos);
if (cd < prout)
break;
pos += dir*d;
}
float ratio = cd/STEP;
out_color = vec4(pos,1.0);
}

126
02-wsmind.glsl Normal file
View File

@ -0,0 +1,126 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
vec2 rotate(vec2 p, float a)
{
float c = cos(a);
float s = sin(a);
return mat2(c, s, -s, c) * p;
}
float vmax(vec3 p)
{
return max(max(p.x, p.y), p.z);
}
float cube(vec3 p, vec3 s)
{
vec3 d = abs(p) - s;
return length(max(d, 0.0)) + vmax(min(d, 0.0));
}
float tube(vec2 p, float s)
{
return length(p) - s;
}
float room(vec3 p)
{
p.xy = rotate(p.xy, fGlobalTime);
p.xz = rotate(p.xz, fGlobalTime * 0.7);
return -cube(p, vec3(10.0));
}
float tubes(vec3 p)
{
p.xy = rotate(p.xy, p.z * sin(fract(fGlobalTime)) * 0.1);
p.xz = rotate(p.xz, p.z * sin(fract(fGlobalTime * 1.3)) * 0.5);
p.xy = rotate(p.xy, fGlobalTime * 0.04 + 2.5);
p.xz = rotate(p.xz, fGlobalTime * 0.2 + 1.3);
float d = tube(p.xz, 0.1);
d = min(d, tube(p.xy, 0.1));
d = min(d, tube(p.yz, 0.1));
return d;
}
float map(vec3 p)
{
float d = room(p);
d = min(d, tubes(p));
p.xy = rotate(p.xy, p.z);
p.xy = rotate(p.xy, fGlobalTime * 2.0);
p.xz = rotate(p.xz, fGlobalTime * 2.8);
d = min(d, cube(p, vec3(1.0)));
return d;
}
vec3 normal(vec3 p)
{
vec2 e = vec2(0.001, 0.0);
return normalize(vec3(
map(p + e.xyy) - map(p - e.xyy),
map(p + e.yxy) - map(p - e.yxy),
map(p + e.yyx) - map(p - e.yyx)
));
}
float light(float d)
{
return 3.0 / (d * d + 1.0);
}
vec3 tonemap(vec3 c)
{
c = c / (c + 1.0);
return pow(c, vec3(1.0 / 2.2));
}
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
float beat = exp(-fract(fGlobalTime) * 20.0);
uv.x += sin(uv.y * 500.0) * beat;
vec3 pos = vec3(0.0, 0.0, -4.0);
vec3 dir = normalize(vec3(uv, 1.0 - length(uv) * 0.8));
for (int i = 0; i < 64; i++)
{
float d = map(pos);
if (d < 0.001) break;
pos += dir * d;
}
vec3 n = normal(pos);
float diffuse = dot(n, normalize(vec3(1.0))) * 0.5 + 0.5;
vec3 tubeLight = light(tubes(pos)) * vec3(30.0 * exp(-fract(fGlobalTime) * 10.0), 0.0, 40.0);
vec3 radiance = vec3(diffuse) * vec3(0.2, 0.0, 20.0) * 4.0 + tubeLight;
out_color = vec4(tonemap(radiance) * (1.0 / length(uv * 10.0)), 1.0);
}

70
03-lamogui.glsl Normal file
View File

@ -0,0 +1,70 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
float s(vec3 p)
{
float theta = atan(p.z, p.x);
float phi = asin(p.z);
vec2 t = abs(vec2(phi, theta) / 3.1415);
t += fGlobalTime * 0.1;
return length(p) - .5 * (1.0 + 0.3 * texture(texNoise, t).x - 0.1*sin(mod(p.y, 3.1415*2.0) + fGlobalTime )) ;
}
float plane(vec3 p)
{
return distance(p.y, -1.0);
}
float map(vec3 p)
{
float d = s(p);
d= min(d, plane(p));
return d;
}
vec3 rm(vec3 ro, vec3 rd)
{
vec3 p = ro;
for (int i = 0 ; i < 96; ++i)
{
float d = map(p);
if (abs(d) < 0.01)
break;
p += rd * d *0.9;
}
return p;
}
void main()
{
vec2 v = gl_FragCoord.xy / v2Resolution;
vec2 uv = v * 2.0 - 1.0;
uv.x *= v2Resolution.x/v2Resolution.y;
vec3 ro = vec3(0, 0, -1.0);
vec3 rd = vec3(uv, 1.0);
vec3 p = rm(ro, rd);
float d = distance(ro, p);
out_color = vec4(vec3(exp(-d)), 1.0);
}

60
03-sicarde.glsl Normal file
View File

@ -0,0 +1,60 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
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 );
}
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
vec2 m;
m.x = atan(uv.x / uv.y) / 3.14;
m.y = 1 / length(uv) * .2;
float d = m.y;
float f = texture( texFFT, d ).r * 100;
m.x += sin( fGlobalTime ) * 0.1;
m.y += fGlobalTime * 0.25;
vec4 t = plas( m * 3.14, fGlobalTime ) / d;
t = clamp( t, 0.0, 1.0 );
out_color = (f + t) * abs(uv).xxyy;
out_color += texture(texKC, clamp(uv * 2.0 - vec2(-0.7, 0.7), 0.0, 1.0));
uv.y *= -1;
uv *= 2;
vec2 uvLove = uv;
uvLove *= 2.25;
uvLove.x += -fGlobalTime;
uvLove.y = clamp(uvLove.y, 0.00, 1.0);
out_color += texture(texPegasus, uvLove);
uv.y += abs(sin(fGlobalTime / .25)) * 0.5 - 0.4;
uv += 0.85;
vec2 uvPoney2 = uv - vec2(1.5, 0.0);
uvPoney2.x *= -1;
out_color += texture(texPegasus, vec2(clamp(uv.x - 0.7, 0.0, 1.0), clamp(uv.y - 0.5, 0.0, 1.0)));
out_color += texture(texPegasus, vec2(clamp(uvPoney2.x - 0.7, 0.0, 1.0), clamp(uvPoney2.y - 0.5, 0.0, 1.0)));
}

102
04-ponk.glsl Normal file
View File

@ -0,0 +1,102 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
layout(location = 0) out vec4 color; // out_color must be written in order to see anything
#define PI 3.14158
#define TAU PI*2.
#define t fGlobalTime*.3
float sphere (vec3 p, float r) { return length(p)-r; }
float cyl (vec2 p, float r) { return length(p)-r; }
vec3 moda (vec2 p, float count) {
float an = TAU/count;
float a = atan(p.y,p.x)+an/2.;
float c = floor(a/an);
a = mod(a,an)-an/2.;
c = mix(c, abs(c), step(count/2., abs(c)));
return vec3(vec2(cos(a),sin(a))*length(p),c);
}
mat2 rot (float a) { float c=cos(a),s=sin(a); return mat2(c,-s,s,c); }
float smin (float a, float b, float r) {
float h = clamp(.5+.5*(b-a)/r, 0.,1.);
return mix(b,a,h)-r*h*(1.-h);
}
float map (vec3 p);
vec3 normal (vec3 p){
float e = 0.01;
return normalize(vec3(map(p+vec3(e,0,0))-map(p-vec3(e,0,0)),
map(p+vec3(0,e,0))-map(p-vec3(0,e,0)),
map(p+vec3(0,0,e))-map(p-vec3(0,0,e))));
}
float iso (vec3 p, float r) { return dot(p, normalize(sign(p)))-r; }
float map (vec3 p) {
p.xy *= rot(t);
p.yz *= rot(t*.5);
p.xz *= rot(t*.3);
p.xz *= rot(p.y*.3+t);
float cyl2 = cyl(p.xz, .3+.8 * (.5+.5*sin(p.y*1.+t*10.)));
float a = atan(p.y,p.x);
float l = length(p.xy);
float c = 10.;
//p.x = mod(abs(l*.5-4.)+t*2., c)-c/2.;
//p.y = cos(a)*10.;
vec3 p1 = moda(p.xz, 20.);
float wave1 = sin(t*10.+p.y*0.5+p1.z);
p1.x -= 2.+(.5+.5*wave1);
p.xz = p1.xy;
float celly = 3.;
vec3 p2 = p1;
p.y = mod(p.y+t*10.+p1.z,celly)-celly/2.;
float sph1 = sphere(p, 0.2+.2*(.5+.5*sin(p.y+t*10.)));
float cyl1 = cyl(p.xz, 0.2*wave1+.02);
float scene = smin(sph1, cyl1, .3);
scene = smin(scene, cyl2, .3);
p.y = mod(p.y+t*10.,celly)-celly/2.;
float iso1 = iso(p,0.2+.2*wave1);
scene = smin(scene, iso1, .13);
return scene;
}
void main(void)
{
vec2 uv = (gl_FragCoord.xy-.5*v2Resolution.xy)/v2Resolution.y;
vec3 eye = vec3(uv, -5.), ray = (vec3(uv,.5)), pos = eye;
int ri = 0;
for (int i = 0; i < 50; ++i) {
float dist = map(pos);
if (dist < 0.01) {
break;
}
pos += ray*dist;
ri = i;
}
vec3 n = normal(pos);
float ratio = float(ri)/50.;
color = vec4(1.);
color.rgb = n*.5+.5;
color.rgb *= 1.- ratio;
}

79
04-semtoraap.glsl Normal file
View File

@ -0,0 +1,79 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
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 );
}
vec2 getPos(float time)
{
if(time<1) return vec2(0,time);
else if(time<1.3) return vec2(time-1,1);
else if(time<1.8) return vec2(0.3, 1.3-time);
else if(time<2.0) return vec2(2.1-time,0.5);
else if(time<2.5) return vec2(0.1, 2.5-time);
else return vec2(2.6-time,0);
}
vec4 getColor(vec2 pos)
{
vec2 track[7];
track[0]=vec2(0,0);
track[1]=vec2(0,1);
track[2]=vec2(0.3,1);
track[3]=vec2(0.3,0.5);
track[4]=vec2(0.1,0.5);
track[5]=vec2(0.1,0);
track[6]=vec2(0,0);
bool ok=false;
int i;
for(i=0;i<6;i++)
{
vec2 dp = pos-track[i];
dp=normalize(dp);
vec2 segment = track[i+1] - track[i];
float segmentLength = sqrt(dot(segment,segment));
float dotp = dot(dp, segment);
if(dotp>0 && dotp < segmentLength)
{
vec2 segmentPos = dp + segment * (dotp / segmentLength);
dp = pos - segmentPos;
float distSqr = dot(dp,dp);
if(distSqr < 0.1) ok = true;
}
}
return ok ? texture(texChecker, pos) : vec4(0,0,0,1);
}
void main(void)
{
vec2 screenCoords = gl_FragCoord.xy / v2Resolution;
screenCoords -= 0.5;
vec2 texPos = vec2(screenCoords.x, 1);
texPos.x /= screenCoords.y;
texPos.y /= screenCoords.y;
vec2 pos = getPos(mod(fGlobalTime * 0.1,2.6));
texPos += pos * 10;
out_color = screenCoords.y < 0 ? getColor(texPos) : vec4(0,0,0,1);
}

70
05-anton.glsl Normal file
View File

@ -0,0 +1,70 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
float dist(float f, float w)
{
return step(length(f),w) * step(length(f),w + .2);
}
vec2 rot(vec2 v, float a)
{
float sa = sin(a); float ca = cos(a);
return mat2(ca,-sa,sa,ca) * v;
}
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
float st = pow(abs(fract(fGlobalTime) - .5),.9) ;
float time = fGlobalTime + st;
uv = rot(uv,length(uv) * sin(fGlobalTime * .1) * 3 + time );
uv = mod(uv + .25, vec2(.5)) - .25;
float a = atan(uv.y,uv.x);
a += sin(fGlobalTime * 2.) * 15;
a = abs(a - .5) + .5;
float s = texture(texFFTSmoothed,gl_FragCoord.x / v2Resolution.x).x;
float c = distance(uv , vec2(.0,.0));
float f = dist(c + a * .01, .1);
uv.y += sin(uv.x * 4. + time) * .1;
f = max(f, uv.y);
f += step(abs(gl_FragCoord.y / v2Resolution.y - s),.01) ;
vec4 c1 = vec4(.1,.5,.1,1.);
vec4 c2 = vec4(.3,.1,.9,1.);
out_color = mix(c1,c2,f);
}

72
05-pasta.glsl Normal file
View File

@ -0,0 +1,72 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
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 );
}
float coucoulecercle(vec2 uv, vec2 center, float r)
{
return length(uv - center) < r ? 1 : 0;
}
void main(void)
{
float nosewidth = 0.5;
float noseheight = 0.1;
float baser = 0.1;
float dr = 0.1;
float dt = 1.2;
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
float t = 1 - mod(pow(fGlobalTime, 2), dt) / dt;
float r = baser + t * dr;
vec4 bgcol = vec4(.0);
vec4 forcol = vec4(1.0);
float c = coucoulecercle(uv, vec2(-nosewidth * 0.5, noseheight), r) + coucoulecercle(uv, vec2(nosewidth * 0.5, noseheight), r);
vec2 alttexuv = uv + dt * fGlobalTime * 0.5;
forcol = texture(texNoise, alttexuv);
float angle = atan(uv.x, uv.y) + mod(fGlobalTime, 3.1416);
float anglecol = mod(angle, 1.0) < 0.5 ? 1 : 0;
/*
vec2 m;
m.x = atan(uv.x / uv.y) / 3.14;
m.y = 1 / length(uv) * .2;
float d = m.y;
float f = texture( texFFT, d ).r * 100;
m.x += sin( fGlobalTime ) * 0.1;
m.y += fGlobalTime * 0.25;
vec4 t = plas( m * 3.14, fGlobalTime ) / d;
t = clamp( t, 0.0, 1.0 );
*/
vec2 uvPegasus = uv * -0.5 + vec2(0.45, 0.5);
bgcol = texture(texPegasus, uvPegasus);
out_color = mix(bgcol, forcol, c);
}

81
06-koltes.glsl Normal file
View File

@ -0,0 +1,81 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
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 );
}
#define t fGlobalTime
float C,S;
#define rot(a) mat2(C=cos(a),S=sin(a),-S,C)
struct M{float d;vec3 c;};
M mmin(M a,M b,float k){
float h=clamp((b.d-a.d)/k*.5+.5,0.,1.);
M m;
m.d=mix(b.d,a.d,h)-k*h*(1.-h);
m.c=mix(b.c,a.c,h);
return m;
}
M map(vec3 p){
p.xz*=rot(t*.3);
p.y+=.2*sin(t*3.);
float a=atan(p.z,p.x);
M m;
float d=length(p.xz);
d=dot(normalize(vec2(.9,-.2)),vec2(d,p.y+2.));
d=max(d,p.y-.5);
m.d=d;
vec2 st=vec2(a*10.,-a*1.);
st*=(1.-st);
m.c=vec3(.9,.8,0.);
d=length(p.xz)-.8*(smoothstep(.0,.5,p.y)-smoothstep(1.5,2.5,p.y))+.1-.1*sin(a*8.+p.y*15.);
M m2;
m2.d=d;
m2.c=mix(vec3(.9),vec3(.9,.1,.1),step(.5,fract(a/6.2831*8.+p.y*15./6.2831)));
m=mmin(m,m2,.1);
return m;
}
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
vec3 ro=vec3(uv,-5.),rd=normalize(vec3(uv,1.)),mp=ro;
M m;
float f;for(f=0.;f<30.;++f){
m=map(mp);
if(abs(m.d)<.001)break;
mp+=rd*m.d;
}
float a=atan(uv.y+.8,uv.x)/6.2831*40.+t;
vec3 bg=mix(vec3(.0,.4,.8), vec3(.1,.5,.9),step(.5,fract(a)));
float mbg=min(1.,length(mp-ro)*.01);
vec3 c=mix(m.c*(1.-f/30.),bg,mbg);
for(f=0.;f<40.;++f){
vec4 h=fract(sin(f+vec4(0.,3.,5.,8.))*1e4);
h.y=fract(h.y-t*.1);
vec3 p=(h.xyz-.5)*10.;
p.xz*=rot(t*.5);
float d=length(cross(p-ro,rd));
c+=vec3(.01)/d/d;
}
out_color = vec4(c,1.);
}

78
06-pouletvert.glsl Normal file
View File

@ -0,0 +1,78 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
vec3 greenA = vec3(34, 117, 76);
vec3 greenB = vec3(181, 230, 29);
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 );
// Alors, c'est l'histoire d'un type qui rentre dans un café et plouf !
// Un jour je suis allé sur la Lune
// oh putain c'était le bordel
}
void main(void)
{
greenA /= 255.;
greenB /= 255.;
vec3 white = vec3(1.,1.,1.);
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
vec2 uv2 = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
//uv2 = distance();
float radius = 0.25;
radius += cos(atan(uv.x, uv.y));
float l = distance(uv, vec2(.0, .0));
l = step(radius + sin( fGlobalTime * 2. ) * .1, l);
vec2 move = uv;
move.x *= 2.;
move.y *= sin( fGlobalTime * 10.) + 1.5;
float c = distance(move, vec2(.0, .0));
c = step(.1, c);
vec2 m;
m.x = atan(uv.x / uv.y) / 3.14;
m.y = 1 / length(uv) * .2;
float d = m.y;
float f = texture( texFFT, d ).r * 100;
m.x += sin( fGlobalTime ) * 0.1;
m.y += fGlobalTime * 0.25;
vec4 t = plas( m * 3.14, fGlobalTime ) / d;
t = clamp( t, 0.0, 1.0 );
vec3 caca = mix(greenB, greenA, l * c);
out_color = vec4(mix(caca, white * fGlobalTime * .001, uv.y) , .1);
}

73
07-flopine.glsl Normal file
View File

@ -0,0 +1,73 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
float sphere(vec3 pos, float r)
{
return length(pos) - r;
}
float box (vec3 t, vec3 m)
{
return length(max(abs(t)-m,0.0));
}
float map (vec3 pos)
{
float x = fGlobalTime;
mat3 prout = mat3 (cos(x), -sin(x), 0., sin(x), cos(x), 0.,0., 0., 1.);
pos = prout*pos;
pos = mod(pos,2.)-1.;
return max(sphere(vec3(pos),0.5),sphere(pos,1.0));
}
/*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 );
}*/
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
vec3 pos = vec3(0.0,0.0,-5.);
vec3 dir = normalize(vec3(uv,1.0));
for (float i=0; i<64; i++)
{
float d = map(pos);
if (d<0.001)
break;
pos += dir*d;
}
/*vec2 m;
m.x = atan(uv.x / uv.y) / 3.14;
m.y = 1 / length(uv) * .2;
float d = m.y;
float f = texture( texFFT, d ).r * 100;
m.x += sin( fGlobalTime ) * 0.1;
m.y += fGlobalTime * 0.25;
vec4 t = plas( m * 3.14, fGlobalTime ) / d;
t = clamp( t, 0.0, 1.0 );*/
out_color = vec4(pos,1.0);
}

77
07-wsmind.glsl Normal file
View File

@ -0,0 +1,77 @@
#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
uniform sampler2D texChecker;
uniform sampler2D texKC;
uniform sampler2D texNoise;
uniform sampler2D texPegasus;
uniform sampler2D texTex1;
uniform sampler2D texTex2;
uniform sampler2D texTex3;
uniform sampler2D texTex4;
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
vec2 rotate(vec2 p, float a)
{
float c = cos(a);
float s = sin(a);
return mat2(c, s, -s, c) * p;
}
float circle(vec2 uv, float r, float w, float f, float speed)
{
float a = atan(uv.y, uv.x) + fGlobalTime * speed;
float d = length(uv);
float e = step(mod(a * f, 6.2832), 0.4);
return e * smoothstep(r, r + 0.01, d) * smoothstep(r + w, r + w - 0.01, d);
}
vec3 plop(vec2 uv)
{
return dot(uv, vec2(0.707, 0.707)) * vec3(cos(uv.x), cos(uv.y), sin(uv.x));
}
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
float s = circle(uv, 0.3, 0.05, 40.0, 0.3);
s += circle(uv, 0.2, 0.01, 10.0, 1.0 + texture(texFFT, 0.001).r * 100.0);
for (int i = 0; i < 10; i++)
{
s += circle(uv, 0.4 + 0.04 * float(i), 0.02, float(i), float(i) * 0.01);
}
uv.y += sin(uv.x + fGlobalTime * 0.4) * 0.1;
s += circle(uv, 0.04, 0.5, 3.0, 0.3);
for (int i = 0; i < 5; i++)
{
s += clamp(length(uv - vec2(sin(uv.y * 100.0 + fGlobalTime * 4.0), uv.y)), 0.0, 0.1);
}
uv = abs(uv);
for (int i = 0; i < 20; i++)
{
s += 0.2 * (1.0 - step(0.9, abs((uv.y + float(i) * 0.2) * 20.0 - 10.0 - sin(uv.x * 10.0 + fGlobalTime * 2.0))));
}
vec3 color = vec3(s) + plop(uv);
color = color / (color + 1.0);
color += texture(texPegasus, uv * 0.5 + 0.5).rgb * 0.4 * circle(uv, 0.2, 0.4, 2.0, 0.2);
color = pow(color, vec3(1.0 / 2.2));
color *= pow(color, vec3(length(uv * 20.0)));
out_color = vec4(color, 1.0);
}