Add 2017-12-08

This commit is contained in:
Jonathan Giroux
2017-12-23 21:49:32 +01:00
parent 70b96b665b
commit dd46b557ba
20 changed files with 1670 additions and 0 deletions

74
2017-12-08/01-eybor.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 texNoise;
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 sampleTexture(sampler1D sampler)
{
float m = 0.0;
for (int i = 0; i< 8; ++i)
{
m = max(m, texelFetch(sampler, i, 0).x);
}
return m;
}
#define PI 3.141592
void main(void)
{
vec2 uv = 2.*vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 1.;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
float accBass = sampleTexture(texFFTIntegrated);
float currentBass = sampleTexture(texFFTSmoothed)*.1;
uv.x += sin(accBass)*.5 + currentBass*.2;
uv.y += cos(accBass)*.5 - currentBass*.2;
float angle= (atan(uv.x, uv.y)+PI)/(2.*PI)*16.;
float rot = accBass*.5;
uv = mat2(cos(rot), -sin(rot), sin(rot), cos(rot))*uv;
vec3 d = vec3(mix(sqrt(dot(uv, uv)), max(abs(uv.x), abs(uv.y)), (1.-sin(accBass*2.))*.5));
d.r -= currentBass*.9;
d.b += currentBass*.9;
vec3 v = d;
v = v*32-fGlobalTime*4.;
v = sin(v);
float anim = (1.-sin(fGlobalTime))*.5;
v *= smoothstep(.1-anim*.1, .25-anim*.25, angle-floor(angle));
v *= smoothstep(.9+anim*.1,.75+anim*.25, angle-floor(angle));
v = smoothstep(.0, .1, max(1.-v*v,0.));
v *= smoothstep(.0, .02, angle-floor(angle));
v *= smoothstep(1.,.98, angle-floor(angle));
v *=(1.-exp(-d*.4));
out_color = vec4(v, 1.);
}

View File

@ -0,0 +1,95 @@
#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 texNoise;
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 smin(float a, float b, float k)
{
float h = clamp(0.5+0.5*(b-a)/k,0.,1.);
return mix(b,a,h)-k*h*(1.-h);
}
//vec2 (vec2 p, float angle)
//{
//float c = cos(angle);
//float s = sin(angle);
//return vec2 (p * (c,-s,s,c));
//}
vec2 moda (vec2 p, float per)
{
float angle = atan(p.y, p.x);
float l = length(p);
angle = mod(angle-per/2., per)-per/2.;
return vec2(cos(angle),sin(angle))*l;
}
float sphe (vec3 p, float r)
{
p.y-=.7;
return length(p)-r;
}
float cylY (vec3 p, float r, float h)
{
return max(length(p.xz)-r, abs(p.y)-h);
}
float plane (vec3 p, vec2 uv)
{
vec4 text = texture(texTex4, uv/2.);
p.y +=.5;
p.y+=text.x;
return p.y;
}
float cylX (vec3 p, float r, float h)
{
p.xz = moda(p.xz, 2.*3.14/5.);
p.x -= 0.8;
p.xy += p.z*sin(fGlobalTime);
p.y += 0.3;
r-=p.x*0.2;
return max(length(p.yz)-r, abs(p.x)-h);
}
float SDF(vec3 p, vec2 uv)
{
//return cylX(p, 0.2, 0.7);
float body = smin(cylY(p,0.3,.5), sphe(p,0.5), 0.4);
float all_body = smin(body,cylX(p, 0.2, 1.), 0.5);
return min(all_body, plane(p, uv));
}
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 p = vec3 (0.01,0.01,-3.);
vec3 dir = normalize(vec3(uv, 1.));
float shad = 0.;
for (int i=0; i<60; i++)
{
float d = SDF(p, uv);
if (d<0.01)
{shad = float(i)/60.;
break;}
p += d*dir;
}
out_color = vec4(vec3(1-shad),1.);
}

110
2017-12-08/02-anton.glsl Normal file
View File

@ -0,0 +1,110 @@
#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 texNoise;
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
#define REP(p,r) (mod(p + r/2., r) - r/ 2.)
mat2 rot(float a)
{
float c = cos(a); float s = sin(a);
return mat2(c,-s,s,c);
}
float map(vec3 pos)
{
float t = pos.z;
float time = fGlobalTime;
time += pow(sin(time * 4.),2.);
float r = 1.;
r += sin(pos.z * 0.15 + time) * .5 + .7;
pos.z -= time * 1. ;
pos. xy *= rot(t * .01+ sin(t * .1 + fGlobalTime * 2.));
//pos.xy = REP(pos.xy, 100.);
pos.x = abs(pos.x);
float cy = distance(pos.xy, vec2(9.));
return cy - r;
}
vec3 normal(vec3 p)
{
vec2 e = vec2(.1,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)
));
}
#define STEP 64.
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(0.);
vec3 rd = normalize(vec3(uv,1.));
vec3 cp = ro;
float id = 0.;
for(float st = 0.; st < 1.; st += (1. / STEP))
{
float cd = map(cp);
if(cd < .01)
{
id = 1. - st;
break;
}
cp += rd * cd;
}
vec3 lpos = vec3(0., 0.,15.);
vec3 ldir = normalize(cp - lpos);
vec3 norm = normal(cp);
float li = clamp(dot(norm,ldir),0.,1.);
float r = mod(fGlobalTime * .5, 2.);
float f = step(length(uv), r) - step(length(uv), r - .5);
out_color = mix(vec4(f),vec4(norm,0.),id);
}

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 texNoise;
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
mat2 r2d(float a){
float c=cos(a), s=sin(a);
return mat2(c, s,-s, c);
}
float sc(vec3 p){
p = abs(p);
p = max(p,p.yzx);
return min(p.x, min(p.y, p.z)) - .31;
}
float de(vec3 p){
p.y += cos(fGlobalTime)*.1;
//p.x += cos(fGlobalTime)*.1;
p.x = abs(p.x) - .3;
p.xy *=r2d(fGlobalTime +p.z + p.y);
float s=1.;
float d = 0;
vec3 q = p;
for(int i =0;i<5;i++){
q = mod(p*s+1, 2) - 1;
d = max(d, -sc(q)/s);
s+=3;
}
return d;
}
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(0, 0, -fGlobalTime-tan(fGlobalTime)),p;
vec3 rd = normalize(vec3(uv, -1));
p = ro;
float i = 0;
for(;i<1;i+=.01){
float d = de(p);
if(d<.0001) break;
p+=rd*d;
}
i/= sqrt(abs(tan(fGlobalTime*4.) + p.x*p.x + p.y*p.y)) *.1;
vec3 c = mix(vec3(.7, .3, .2), vec3(.1, .1, .2), i*sin(p.z));
//c *= texture(texNoise, p.xz).x;
c *= pow(length(ro-p), 1.1);
out_color = vec4(c, 1);
}

118
2017-12-08/03-lamogui.glsl Normal file
View File

@ -0,0 +1,118 @@
#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 texNoise;
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 bass()
{
float b = 0.0;
for (int i = 0; i < 8; ++i)
{
b = max(b, texelFetch(texFFTIntegrated, i, 0).x);
}
return b;
}
float bass2()
{
float b = 0.0;
for (int i = 0; i < 8; ++i)
{
b = max(b, texelFetch(texFFT, i, 0).x);
}
return b;
}
mat2 rot2d(float a )
{
float c = cos(a);
float s = sin(a);
return mat2(c, -s, s, c);
}
float megabass =0.0;
float megabass2 =0.0;
float map(vec3 p)
{
p.xy = p.xy * rot2d(p.z * 0.2);
return cos(p.x) + sin(p.y + 1.0) + cos(p.z) + (0.05 + 0.2 * megabass2) * cos(p.y + p.z * 20.0) + 0.1 * cos(p.y);
}
vec3 grad(vec3 p)
{
vec2 eps = vec2(0.001, 0.0);
return normalize(vec3(map(p + eps.xyy) - map(p - eps.xyy),
map(p + eps.yxy) - map(p - eps.yxy),
map(p + eps.yyx) - map(p - eps.yyx)));
}
vec3 rm(vec3 ro, vec3 rd, out float st)
{
vec3 p = ro;
for (int i = 0; i < 64; ++i)
{
float d = map(p);
if (abs(d) < 0.001)
{
st = i;
break;
}
p += d * rd * 0.8;
}
return p;
}
vec3 shade(vec3 p, vec3 ro, float st, vec3 n)
{
vec3 color = exp(-distance(p, ro)* 0.1) * (n * 0.5 + 0.5) * pow((float(st) / 64.0), 0.5);
color = mix(vec3(0.1, 0.7, 1.0), color, exp(-distance(p, ro)* 0.1));
return color;
}
void main(void)
{
megabass = bass();
megabass2 = bass2();
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(0.0, 0.0, megabass * 8.0);
vec3 rd = normalize(vec3(uv, 0.7 - length(uv)));
rd.xy *= rot2d(megabass);
float st = 0.0;
vec3 p = rm(ro, rd, st);
vec3 n = grad(p);
vec3 color = shade(p, ro, st, n);
vec3 rd2 = reflect(rd, n);
vec3 ro2 = p + 0.1 * rd2;
vec3 p2 = rm(ro2, rd2, st);
vec3 n2 = grad(p2);
vec3 color2 = shade(p2, ro, st, n2);
color = mix(color, color2, 0.5);
out_color = vec4(color, 1.0);
}

133
2017-12-08/03-xt95.glsl Normal file
View File

@ -0,0 +1,133 @@
#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 texNoise;
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 bass;
float bassTime;
float obj(vec3 p)
{
vec3 pp = p;
pp.z = mod(p.z, 10.)-5.;
float d= -abs(p.x-1.)+3.+cos(length(pp.yz*3.)-fGlobalTime)*.1;
return d;
}
float obj2(vec3 p)
{
float d = length(p.xy-vec2(1.+cos(p.z),0.+sin(p.z)))-.1;
return d;
}
float map(vec3 p)
{
float d = dot(cos(p.xyz), sin(p.zxy))+1.;
d += cos(p.z*10.)*bass*.2;
d = min(d, obj(p));
d = min(d, obj2(p));
return d*.8;
}
vec3 normal(vec3 p)
{
vec3 n;
vec2 eps = vec2(0.01,0.);
n.x = map(p) - map(p+eps.xyy);
n.y = map(p) - map(p+eps.yxy);
n.z = map(p) - map(p+eps.yyx);
return normalize(n);
}
mat2 rotate(float v)
{
float a = cos(v);
float b = sin(v);
return mat2(a,b,-b,a);
}
vec3 raymarch(vec3 ro, vec3 rd)
{
vec3 p = ro;
for(int i=0; i<64; i++)
{
float d = map(p);
p += rd * d;
}
return p;
}
vec3 shade( vec3 ro, vec3 rd, vec3 p, vec3 n)
{
vec3 ld = normalize(vec3(.1,1.,-.5));
vec3 col = vec3(0.);
col = vec3(1.) * max(0., dot(n,ld))*.3;
col += mix(vec3(1.,.7,.1), vec3(.1,1.,.7), rd.x)*length(p-ro)*.05;
return col;
}
void main(void)
{
bassTime = 0.;
for(int i=0; i<10; i++)
bassTime += texelFetch(texFFTIntegrated, i,0).r;
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
bass = 0.1;
for(int i=0; i<10; i++)
bass += texelFetch(texFFTSmoothed, i,0).r;
vec3 ro = vec3(1.,0.,-fGlobalTime*.1-bassTime*.5);
vec3 rd = normalize(vec3(uv*2.,-1.));
rd.xy = rotate(bassTime*.01)*rd.xy;
vec3 p = raymarch(ro,rd);
vec3 n = normal(p);
vec3 col = shade(ro, rd, p, n);
for(int i=0; i<3; i++)
if(obj(p)<.1)
{
ro = p;
rd = reflect(rd,n);
p = raymarch(ro+rd*.1,rd);
n = normal(p);
col = shade(ro, rd, p, n);
}
if(obj2(p)<.1)
col += vec3(.1,.7,1.) * bass;
out_color = vec4(col, 1.);
}

83
2017-12-08/04-coyhot.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 texNoise;
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 bass()
{
float b = 0;
for (int i=0; i<8; ++i)
{
b = max(b,texelFetch(texFFTIntegrated,i,0).x);
}
return b;
}
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 origuv = uv;
float time = bass()+(fGlobalTime/10);
uv.y += (sin(uv.x*5+time))/10-(uv.x);
origuv.x += time/10;
vec4 theNoise= texture(texNoise,origuv);
uv.y += (theNoise.r)/5;
uv.x = abs(uv.x);
uv.y = abs(uv.y);
vec2 m;
m.x = atan(uv.x / uv.y) / 3.14;
m.y = 1 / length(uv) * .2;
m.y += time + (fGlobalTime/10);
m.x += ((fGlobalTime/30)*sin(m.y/100));
float d = m.y;
float ratio = (sin((m.x*50)+time*(-10))/sin(m.y*50))*500;
// out_color = theNoise;
out_color = vec4(ratio);
// out_color = f + t;
}
// 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 );

133
2017-12-08/04-xtrium.glsl Normal file
View File

@ -0,0 +1,133 @@
#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 texNoise;
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 noise(vec2 p)
{
return fract(sin(dot(p,p) * 49357.159));
}
float noise3(vec3 p)
{
return fract(sin(dot(p.xy,p.yx) * 49357.159));
}
float map(vec3 p)
{
float n = noise(floor(p.xz)) * 4.0;
float nt = texture(texNoise, fract(p.xz*0.1)).r;
float d1 = p.y + texelFetch(texFFTSmoothed, 4, 0).r + 0.1 * nt + 20.0 * n;
float d2 = length(p - vec3(0.0, 1.5, -5.0 - fGlobalTime * 0.1)) - (n + (fract(texelFetch(texFFTIntegrated, 4, 0).r) * 0.5 + 0.5)) * 0.2 + 0.5 * noise3((p + vec3(fGlobalTime*0.1)) * 0.0001 + vec3(n * 0.5));
return min(d1,d2);
}
vec3 skycolor(vec3 d)
{
float t1 = smoothstep(-0.1, 0.0, d.y);
vec3 cbase = vec3(0.4, 0.3, 0.25) * t1;
vec3 c1 = vec3(0.7, 0.8, 0.9) * clamp(d.y, 0.0, 1.0);
c1 += vec3(1.0, 0.5, 0.0) * 0.2 * clamp(1.0-d.y, 0.0, 1.0);
return mix(cbase,c1,t1);
}
bool rm(vec3 ro, vec3 rd, out vec3 hit)
{
vec3 p = ro;
for(int i = 0; i < 128; ++i)
{
float d = map(p);
if(d < 0.005)
{
hit = p;
return true;
}
p += rd * d;
}
return false;
}
vec3 nr(vec3 p)
{
vec2 eps = vec2(.005, 0.0);
return normalize(vec3(
map(p + eps.xyy) - map(p - eps.xyy),
map(p + eps.yxy) - map(p - eps.yxy),
map(p + eps.yyx) - map(p - eps.yyx)
));
}
float shd(vec3 ro, vec3 rd)
{
vec3 p = ro;
float shf = 1000.0;
for(int i = 0; i < 32; ++i)
{
float d = map(p);
shf = min(shf, d);
}
return smoothstep(0.0, 0.05, shf);
}
vec3 shade(vec3 ro, vec3 rd, vec3 hit)
{
vec3 lp = vec3(0.0, 10.0, 30.0 - fGlobalTime * 0.1);
vec3 V = normalize(hit-ro);
vec3 N = nr(hit);
vec3 L = normalize(lp-ro);
vec3 H = normalize(L+V);
float dist = distance(ro, hit);
float att = 10.0 / (1.0 + dist * dist * .1);
float dif = max(0.0, dot(N, L));
float spec = max(0.0, pow(dot(N, H), 64.0));
return vec3(dif+spec)*att * shd(hit + 0.05 * N, -L) + (N.y*0.5+0.5)*skycolor(-V)*0.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);
vec3 ro = vec3(0.0, 1.5, -fGlobalTime * 0.1);
vec3 rd = normalize(vec3(uv, -1.5));
vec3 cfinal = skycolor(rd);
vec3 hit = vec3(0.0);
if(rm(ro, rd, hit))
{
vec3 sh =shade(ro, rd, hit);
cfinal = mix(sh, cfinal, smoothstep(16., 32., distance(ro, hit)));
}
out_color = vec4(pow(cfinal, vec3(1.0/2.2)),1.0);
}

View File

@ -0,0 +1,93 @@
#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 texNoise;
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 moda(vec2 p, float per)
{
float angle = atan(p.y,p.x);
float l = length(p);
angle = mod(angle-per/2., per)-per/2.;
return vec2 (cos(angle), sin(angle))*l;
}
vec2 rot (vec2 p, float angle)
{
float c = cos(angle);
float s = sin(angle);
return mat2(c,-s,s,c)*p;
}
float sphe (vec3 p, float r)
{return length(p)-r;}
float box (vec3 p, vec3 c)
{return length(max(abs(p)-c,0.));}
float SDF (vec3 p)
{
float per = 1.1;
p.xz = moda(p.xz, 2.*3.14/5.);
p.x -= 13.;
p.z = mod(p.z-per/2., per)-per/2.;
p.yz = rot(p.yz, fGlobalTime);
p.xz = rot(p.xz, sin(fGlobalTime));
//p.y += .8;
return max (-sphe(p, 0.4), box(p, vec3(0.3)));
}
vec3 norms (vec3 p)
{
vec2 eps = vec2 (0.01,0.0);
return normalize(vec3(SDF(p+eps.xyy)-SDF(p-eps.xyy),
SDF(p+eps.yxy)-SDF(p-eps.yxy),
SDF(p+eps.yyx)-SDF(p-eps.yyx)
)
);
}
float lighting (vec3 n, vec3 l)
{
return dot(n,l)*0.5+0.5;
}
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 p = vec3 (0.01,0.01,-6.);
vec3 dir = normalize(vec3(uv*0.7, 1.));
float shad = 0.;
vec3 color = vec3(0.);
vec3 light = vec3 (3.,1.,-3.);
for (int i = 0; i< 100; i++)
{
float d = SDF(p);
if (d<0.01)
{
vec3 norm = norms(p);
color = vec3 (lighting(norm, light))*vec3(0.4,0.4,0.1);
break;
}
d *= 0.7;
p += d*dir;
}
out_color = vec4(color,1.);
}

View File

@ -0,0 +1,90 @@
#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 texNoise;
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
mat2 r2d(float a){
float c = cos(a), s = sin(a);
return mat2(c, s, -s, c);
}
float de(vec3 p) {
//p.xy *= r2d(1/1e5*fGlobalTime);
p.x = abs(p.x) - 25;
p.xz *= r2d(3.14/4);
p = mod(p+30, 60) - 30;
vec3 q = p;
p.y += sin(p.x*3.);
float r= 15 + 3*pow(.5+.5*sin(15*fGlobalTime), 4);
p.z*=2-p.y/15;
p.y = 4 + 1.2 * p.y - abs(p.x) * sqrt(max((20 - abs(p.x))/15, 0));
float sph = length(p) - r;
float sph2 = length(q) - 9.;
q.y -= 7.;
q.x -= 7.;
float sph4 = length(q.xy + cos(fGlobalTime)) - 3.;
q.x+= 14.;
float sph5 = length(q.xy - cos(fGlobalTime)) - 3.;
float d = max(sph, -sph2);
d = max(d, -sph4);
d = max(d, -sph5);
return d/3.;
}
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(cos(fGlobalTime)*20, fGlobalTime*50, -50*sqrt(abs(tan(fGlobalTime))));
vec3 rd = normalize(vec3(uv, -1)), p;
p = ro;
float i=0;
for(;i<1;i+=.01) {
float d= de(p);
if(d<.01) break;
p+=rd*d;
}
vec3 c = mix(vec3(.9, .3, .5), vec3(.2, .1, .2), i);
c = mix(c, vec3(.2, .1, .2), 1 - exp(-.005 * length(ro-p)));
out_color = vec4(c, 1);
}

97
2017-12-08/06-coyhot.glsl Normal file
View File

@ -0,0 +1,97 @@
#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 texNoise;
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 uv2 = uv;
vec2 uv3 = uv;
vec2 uv4 = uv;
uv2.x += 0.25;
uv3.x += 0.5;
uv4.x += 0.5+fGlobalTime;
uv2*=0.5;
uv.y += (sin(uv.x+fGlobalTime/2)/3);
uv2.y += (cos(uv.x+fGlobalTime/10)/3);
uv3.y += (sin(uv.x+fGlobalTime/5)/3);
uv.x -= fGlobalTime*2;
uv2.x -= fGlobalTime/5;
uv3.x -= fGlobalTime/10;
uv4.y -= sin(uv4.x/5)*3;
vec4 fractal1 = texture( texNoise, uv );
vec4 wood = texture( texTex3, uv4 );
uv2.x += fractal1.x;
uv3.y += fractal1.x;
vec2 m;
m.x = atan(uv.x / uv.y) / 3.14;
m.y = 1 / length(uv) * .2;
vec2 m2;
m2.x = atan(uv2.x / uv2.y) / 3.14;
m2.y = 1 / length(uv2) * .2;
vec4 fractal2 = texture( texNoise, uv );
vec4 fractal3 = texture( texNoise, uv2 );
fractal2.r += sin(fGlobalTime);
fractal2.g += sin(fGlobalTime+0.5);
out_color = sin((fractal1*fractal2*fractal3*100)-2)*(wood*3)+0.3;
}
// 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 );

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 texNoise;
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 a(vec3 p)
{
return cos(p.x)+cos(p.y)+cos(p.z);
}
float map(vec3 p)
{
float d = a(p);
vec3 pp = p;
pp = mod(pp, vec3(1.))-.5;
d = max(d, -(length(pp)-.5));
pp = mod(pp, vec3(.5))-.25;
d = max(d, -(length(pp)-.25));
pp = mod(pp, vec3(.25))-.125;
d = max(d, (length(pp)-.125));
return d;
}
vec3 normal(vec3 p)
{
vec3 n;
vec2 eps = vec2(0.01, 0.);
n.x = map(p) - map(p-eps.xyy);
n.y = map(p) - map(p-eps.yxy);
n.z = map(p) - map(p-eps.yyx);
return normalize(n);
}
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv = uv*2.-1.;
uv.x *= v2Resolution.x/v2Resolution.y;
vec3 ro = vec3(0.,0.,fGlobalTime);
vec3 rd = normalize(vec3(uv, 1.));
vec3 p = ro;
float glow = 0.;
for(int i=0; i<64; i++)
{
float d = map(p);
p += rd *d ;
glow += 1./64.;
if(d<0.01)
break;
}
vec3 n = normal(p);
vec3 col = vec3(1.) * max(0., dot(n, normalize(vec3(0.,1.,-1.)))) * length(ro-p)*.05;
col += vec3(1.,.7,.1) * glow*2.;
out_color = vec4(col, 1.);
}

View File

@ -0,0 +1,80 @@
#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 texNoise;
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 moda (vec2 p, float per)
{
float angle = atan(p.y,p.x);
float l = length(p);
angle = mod(angle-per/2., per)-per/2.;
return vec2 (cos(angle), sin(angle))*l;
}
float sphe1 (vec3 p,float r)
{
p.y -= .8;
return length(p)-r;
}
float sphe2 (vec3 p, float r)
{
p.y -= .5;
r += sin(fGlobalTime)*0.1;
return length(p)-r;
}
float cylY (vec3 p, float r, float h)
{
p.xz = moda(p.xz, 2.*3.14/4);
p.x -= .25;
r += p.y*0.05;
p.xz += sin(p.y+fGlobalTime)*0.1;
return max(length(p.xz)-r, abs(p.y)-h);
}
float body (vec3 p)
{
return max(-sphe2(p, 0.5),sphe1(p,0.5));
}
float SDF (vec3 p)
{
float per = 4.;
p.xz = mod (p.xz-per/2., per)-per/2.;
return min(body(p), cylY(p,0.05,1.));
}
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 p = vec3 (0.01,0.01,-6.);
vec3 dir = normalize(vec3(uv,1.));
vec3 color = vec3 (0.);
for (int i=0; i<60; i++)
{
float d = SDF(p);
if (d<0.01)
{
break;
}
p += d*dir;
}
//color = vec3(exp(-distance(p, vec3(0.);
out_color = vec4 (p,1.);
}

147
2017-12-08/07-xt95.glsl Normal file
View File

@ -0,0 +1,147 @@
#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 texNoise;
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 bass, bassTime;
float fbm( vec2 p )
{
float a = texture(texNoise, p).r*.5;
a += texture(texNoise, p*2.).r*.25;
a += texture(texNoise, p*4.).r*.125*bass;
a += texture(texNoise, p*8.).r*.025;
return a;
}
float ocean( vec3 p)
{
return p.y+12.+fbm(p.xz*0.01+fGlobalTime*.01)*1.;
}
float map(vec3 p )
{
float d = p.y + fbm(p.xz*.005)*70.;
d = min(d, ocean(p));
return d;
}
vec3 raymarch( vec3 ro, vec3 rd)
{
vec3 p = ro;
for(int i=0; i<64; i++)
{
float d = map(p);
p += rd * d;
}
return p;
}
vec3 normal(vec3 p)
{
float d = map(p);
vec2 eps = vec2(0.01, 0.);
vec3 n;
n.x = d - map(p-eps.xyy);
n.y = d - map(p-eps.yxy);
n.z = d - map(p-eps.yyx);
return normalize(n);
}
vec3 sky(vec3 rd, vec3 ld)
{
vec3 col = vec3(0.);
col += texture(texNoise, rd.xz / rd.y*.05-fGlobalTime*.01).r*2.-1.;
col += (texture(texNoise, rd.xz / rd.y*.2+fGlobalTime*.25).r*2.-1.)*.5;
vec3 gradient = mix( vec3(1.), vec3(.5,.7,1.), clamp((rd.y+.3)*5., 0., 1.));
col = mix(gradient, col, clamp((rd.y)*5., 0., .2));
col += vec3(1.,.7,.1) * pow(dot(rd, ld), 300.);
return col;
}
float shadow(vec3 p, vec3 ld)
{
vec3 ps = raymarch(p+ld*.1, ld);
return length(p-ps)>10. ? 1. : 0.;
}
vec3 shade(vec3 ro, vec3 rd, vec3 p, vec3 n)
{
vec3 ld = normalize(vec3(0.1,1.,1.5));
vec3 col = vec3(0.);
vec3 dif = vec3(1.,.7,.1) * max(0., dot(n, ld));
vec3 amb = vec3(0.,0.,.1) * max(0., dot(n, vec3(0.,1.,0.)));
col = dif + amb;
float shad = shadow(p, ld);
col *= vec3(1.)*shad;
col = mix(col, sky(rd, normalize(vec3(0.1,1.,3.5))), vec3(1.)*min(1., length(ro-p)*.0025));
col = mix(col, vec3(1.), vec3(1.)*clamp(-pow(p.y,3.)*.0002,0.,1.));
return col;
}
const float pi = 3.141592653589;
void main(void)
{
bass = 0.;
bassTime = 0.;
for(int i=2; i<10; i++)
{
bass += texelFetch(texFFTSmoothed, i, 0).r/float(i);
bassTime += texelFetch(texFFTIntegrated, i, 0).r/float(i);
}
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(0., 5.,fGlobalTime + bassTime*30.);
vec3 rd = normalize( vec3( uv , 1. ) );
vec3 p = raymarch(ro,rd);
vec3 n = normal(p);
vec3 col = shade(ro,rd,p,n);
if(ocean(p)<.1)
{
ro = p;
rd = reflect(rd,n);
p = raymarch(ro+rd*.1,rd);
n = normal(p);
col = shade(ro,rd,p,n);
}
out_color = vec4(col, 1.);
}

35
2017-12-08/Readme.md Normal file
View File

@ -0,0 +1,35 @@
# Shader Showdown Paris #3
On December 8th, 2017 during the [Cookie Demoparty](http://cookie.paris/) at [Le Jardin d'Alice](https://www.lejardindalice.org/).
[Video on YouTube](https://youtu.be/ugs3-B3Tng0)
## Rounds
1. Eybor vs Flopine
2. Anton vs Theotime
3. Lamogui vs XT95
4. CoyHot vs Xtrium
5. Flopine vs Theotime
6. CoyHot vs XT95
7. Flopine vs XT95
## Tournament view
```
Eybor ----
} Flopine --
Flopine -- \
} Flopine -
Anton ---- / \
} Theotime - \
Theotime - \
} XT95
Lamogui -- /
} XT95 ----- /
XT95 ----- \ /
} XT95 ----
CoyHot --- /
} CoyHot ---
Xtrium ---
```

42
2017-12-08/extra-01.glsl Normal file
View File

@ -0,0 +1,42 @@
#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 texNoise;
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 = cos(atan(tan(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) / 666;
m.y = sin(tan(1 / length(uv) * .666));
float d = m.y;
float f = texture( texFFT, d ).r * 1;
m.x += sin( fGlobalTime ) * 0.1;
m.y += fGlobalTime * 0.25;
vec4 t = plas(m*3.14, fGlobalTime) * d ;
out_color = atan(sin(tan(f + t*3.14569898898989895466465))) ;
//out_color = f * 0.1 + fGlobalTime + uv.x;
}

36
2017-12-08/extra-02.glsl Normal file
View File

@ -0,0 +1,36 @@
#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 texNoise;
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);
uv = uv * length(uv);
uv.y += cos(uv.x * 500.) * 0.4 * texture(texFFT, 0.01).r;
vec3 color = mix(vec3(0.6, 0.4, 0.1), vec3(0.4, 0.9, 0.7), uv.x);
out_color = vec4(color, 0.0) + sin(uv.x * 100. + fGlobalTime * 20.0) + sin(uv.y * 80.0 + fGlobalTime * 5.);
}

View File

@ -0,0 +1,42 @@
texture texTFFT; sampler1D texFFT = sampler_state { Texture = <texTFFT>; };
// towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
texture texFFTSmoothedT; sampler1D texFFTSmoothed = sampler_state { Texture = <texFFTSmoothedT>; };
// this one has longer falloff and less harsh transients
texture texFFTIntegratedT; sampler1D texFFTIntegrated = sampler_state { Texture = <texFFTIntegratedT>; };
// this is continually increasing
texture rawtexChecker; sampler2D texChecker = sampler_state { Texture = <rawtexChecker>; };
texture rawtexNoise; sampler2D texNoise = sampler_state { Texture = <rawtexNoise>; };
texture rawtexTex1; sampler2D texTex1 = sampler_state { Texture = <rawtexTex1>; };
texture rawtexTex2; sampler2D texTex2 = sampler_state { Texture = <rawtexTex2>; };
texture rawtexTex3; sampler2D texTex3 = sampler_state { Texture = <rawtexTex3>; };
texture rawtexTex4; sampler2D texTex4 = sampler_state { Texture = <rawtexTex4>; };
float fGlobalTime; // in seconds
float2 v2Resolution; // viewport resolution (in pixels)
float4 plas( float2 v, float time )
{
float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );
return float4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );
}
float4 main( float2 TexCoord : TEXCOORD0 ) : COLOR0
{
float2 uv = TexCoord;
uv -= 0.5;
uv /= float2(v2Resolution.y / v2Resolution.x, 1);
float2 m;
m.x = atan(uv.x / uv.y) / 3.14;
m.y = 1 / length(uv) * .2;
float d = m.y;
float f = tex1D( texFFT, d ).r * 100;
m.x += sin( fGlobalTime ) * 0.1;
m.y += fGlobalTime * 0.25;
float4 t = plas( m * 3.14, fGlobalTime ) / d;
t = saturate( t );
float4 col = float4(((uv.x+0.5+sin(fGlobalTime+uv.y*10)/5 + sin(fGlobalTime+uv.y*2.234)/-3)*10)%1, uv.y, 1, 1);
return col;
}

50
2017-12-08/extra-04.glsl Normal file
View File

@ -0,0 +1,50 @@
#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 texNoise;
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 * 5.0 ) + cos( sin( time*0.5 + v.y ) * 2.0 );
return vec4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .2, 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/4);
m.y = 1 / length(uv) * .2;
float d = m.y * 4.0;
float f = texture( texFFT, d ).r * 100;
m.x += sin( fGlobalTime ) * 0.41;
m.y += fGlobalTime * 0.6;
vec4 t = plas( m * 3.14, fGlobalTime ) * d;
t = clamp( t, 0.0, 1.0 );
vec2 r = uv;
r.y = 4.0 /(r.x*50 + 0.3*r.y);
float aa = ( 2*mod(r.x,0.2) + 4*mod(r.y+fGlobalTime*0.1*sin(m.x*0.01+fGlobalTime*0.001),0.3) );
t = t* 0.2+1.0*aa;
out_color = f + t;
}

61
2017-12-08/extra-05.glsl Normal file
View File

@ -0,0 +1,61 @@
#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 texNoise;
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 sdist(p,s) (length(p)-s)
#define STEPS 50.
float map (vec3 pos) {
float scene = 1000.;
vec3 p = pos;
scene = min(scene, sdist(p, 1.));
return scene;
}
#define repeat(p,s) (mod(p,s)-s/2.)
void main(void)
{
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv.x *= v2Resolution.x/v2Resolution.y;
float shade = 1;
//uv = repeat(uv, .5);
uv.y -= mod(abs(uv.x/(0.2+ mod(fGlobalTime, 10))) *91 - uv.x*0.1, 1);
uv.x *= 0.7;
float heart = step(.4, length(uv));
shade = heart;
float a = atan(uv.y, uv.x);
float r = length(uv);
uv = vec2(a,r);
float v = 1.1;
out_color = vec4(1.-shade, 0, 0,1.);
out_color = mix(uv.y*vec4(0.457, 0.734, 0.276, 1), vec4(0.835, 0.457, 0.0345, 1), mix(vec4(1,1,1,1), vec4(0,0,0,0), out_color.r));
out_color *= vec4(1-(uv.x+0.5));
}