mirror of
https://github.com/CookieCollective/Live-Coding-Sources.git
synced 2025-02-08 14:03:22 +01:00
Add 2017-11-25
This commit is contained in:
parent
ba0b3c0876
commit
70b96b665b
91
2017-11-25/01-lamogui.glsl
Normal file
91
2017-11-25/01-lamogui.glsl
Normal file
@ -0,0 +1,91 @@
|
||||
#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
|
||||
|
||||
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 f = 0.0;
|
||||
for (int i = 0; i < 32.0; ++i)
|
||||
{
|
||||
f = max(f, texture(texFFTIntegrated, float(i)/1024.0).x);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
float b;
|
||||
|
||||
float bass2()
|
||||
{
|
||||
float f = 0.0;
|
||||
for (int i = 0; i < 32.0; ++i)
|
||||
{
|
||||
f = max(f, texture(texFFTIntegrated, float(i)/1024.0).x);
|
||||
}
|
||||
return f / (32.0 * 1024.0);
|
||||
}
|
||||
|
||||
float map(vec3 p)
|
||||
{
|
||||
float d = cos(p.x) + sin(p.y) + 0.1 * sin(25.0 * p.y + 0.1 * b) + cos(p.z);
|
||||
return min (d, length(p.xy + 0.05 * vec2(0.2 + cos(p.z), - 8.0 + sin(p.z)) - 0.05)) ;
|
||||
}
|
||||
|
||||
vec3 rm(vec3 ro, vec3 rd)
|
||||
{
|
||||
vec3 p = ro;
|
||||
for (int i = 0 ; i < 16; ++i)
|
||||
{
|
||||
p += map(p) * rd * 0.8;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
vec3 grad(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)
|
||||
));
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
b = bass();
|
||||
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.0, 2.0 * fGlobalTime + 10.0 * b);
|
||||
vec3 rd = normalize(vec3(uv, 0.7 - length(uv)));
|
||||
|
||||
vec3 p = rm(ro, rd);
|
||||
|
||||
float s = exp(-distance(ro, p) * 0.1);
|
||||
vec3 color = vec3(s);
|
||||
vec3 n = grad(p);
|
||||
color *= (n * 0.5 + 0.5).xzy;
|
||||
|
||||
vec3 p2 = rm(p + n * 0.1, reflect(rd, n));
|
||||
vec3 n2 = grad(p2);
|
||||
float s2 = exp(-distance(ro, p) * 0.1);
|
||||
vec3 color2 = exp(-distance(ro, p) * 0.1) * (n2 * 0.5 + 0.5);
|
||||
|
||||
color = mix(color, color2, 0.1);
|
||||
out_color = vec4(color, 1.0);
|
||||
}
|
112
2017-11-25/01-ponk.glsl
Normal file
112
2017-11-25/01-ponk.glsl
Normal file
@ -0,0 +1,112 @@
|
||||
#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 STEPS 50.
|
||||
#define PI 3.14159
|
||||
#define TAU (2.*PI)
|
||||
#define sdist(v,s) (length(v)-s)
|
||||
#define time fGlobalTime
|
||||
#define repeat(v,s) (mod(v,s)-s/2.)
|
||||
|
||||
mat2 rot (float a) {
|
||||
float c=cos(a),s=sin(a);
|
||||
return mat2(c,-s,s,c);
|
||||
}
|
||||
|
||||
|
||||
void amod (inout vec2 p, float count) {
|
||||
float an = TAU/count;
|
||||
float a = atan(p.y,p.x)+an/2.;
|
||||
a = mod(a,an)-an/2.;
|
||||
p = vec2(cos(a),sin(a))*length(p);
|
||||
}
|
||||
|
||||
float map (vec3 pos) {
|
||||
float scene = 1000.;
|
||||
pos.xz *= rot(length(pos)*.3);
|
||||
pos.xy *= rot(length(pos)*.2);
|
||||
pos.xz *= rot(time);
|
||||
pos.xy *= rot(time);
|
||||
vec3 p = pos;
|
||||
|
||||
p.xz *= rot(p.y*.5);
|
||||
amod(p.xz, 5.);
|
||||
p.x -= 1. + .5 * sin(p.y+time);
|
||||
p.y = repeat(p.y+time*2., 1.);
|
||||
scene = sdist(p, .1);
|
||||
scene = min(scene, max(sdist(p.yz, .01),p.x));
|
||||
scene = min(scene, sdist(p.xz, .01));
|
||||
p = pos;
|
||||
p.y = repeat(p.y - time, 2.);
|
||||
float wave = 1. * sin(p.y*5.+time);
|
||||
//p.x = repeat(p.x, 5.);
|
||||
scene = min(scene, max(sdist(p.xz, 1.), abs(p.y)-.01));
|
||||
amod(p.xz, 5.);
|
||||
p.x -= .5;
|
||||
|
||||
scene = max(scene, -sdist(p.xz, .2));
|
||||
p.x -= 1.;
|
||||
scene = min(scene, sdist(p.xy, .01));
|
||||
|
||||
scene = min(scene, sdist(p.xz, .02));
|
||||
|
||||
p = pos;
|
||||
amod(p.xz, 32.);
|
||||
p.x -= 2.;
|
||||
p.y = repeat(p.y, .5);
|
||||
p.x = repeat(p.x-time, 1.);
|
||||
scene = min(scene, sdist(p, .02));
|
||||
//scene = min(scene, sdist(p.xz, .01));
|
||||
p = pos;
|
||||
float pl = length(p)*2.-time*5.;
|
||||
float lod = 5.2;
|
||||
pl = floor(pl*lod)/lod;
|
||||
p.xy *= rot(pl);
|
||||
scene = min(scene, max(sdist(p.xz, 3.5), abs(p.y)-.001));
|
||||
|
||||
p = pos;
|
||||
amod(p.xz, 3.);
|
||||
p.x -= 2.;
|
||||
p.x = repeat(p.x+ time, .2);
|
||||
//scene = min(scene, sdist(p.xz, .001));
|
||||
return scene;
|
||||
|
||||
}
|
||||
|
||||
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 eye = vec3(0,0,-6);
|
||||
vec3 ray = normalize(vec3(uv, 1.));
|
||||
vec3 pos = eye;
|
||||
float shade = 0.;
|
||||
for (float i =0.; i <= 1.; i += 1./STEPS) {
|
||||
float dist = map(pos);
|
||||
if (dist < .001) {
|
||||
shade = 1.-i;
|
||||
break;
|
||||
}
|
||||
dist *= .9;
|
||||
pos += dist * ray;
|
||||
}
|
||||
vec4 color = vec4(1.);
|
||||
color *= shade;
|
||||
out_color = color;
|
||||
}
|
106
2017-11-25/02-anton.glsl
Normal file
106
2017-11-25/02-anton.glsl
Normal file
@ -0,0 +1,106 @@
|
||||
#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.)
|
||||
|
||||
float sdSphere(vec3 p,float r)
|
||||
{
|
||||
return length(p) -r;
|
||||
}
|
||||
|
||||
mat2 rot(float a)
|
||||
{
|
||||
float c = cos(a); float s = sin(a);
|
||||
return mat2(c,-s,s,c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float map(vec3 p)
|
||||
{
|
||||
|
||||
p.yz *= rot(.3);
|
||||
|
||||
float a = atan(p.z,p.x);
|
||||
|
||||
p.y += 1. + sin(fGlobalTime + length(p * .1) );
|
||||
|
||||
float plane = p.y + 1.;
|
||||
|
||||
|
||||
float d = length(p.xz);
|
||||
|
||||
|
||||
|
||||
|
||||
p.xz *= rot(fGlobalTime *.2+ d * .01);
|
||||
p.y += 1.5 * sin(d * 5 + fGlobalTime) * .1 +1.5;
|
||||
p.xz = rep(p.xz, 4.);
|
||||
|
||||
|
||||
float sp = sdSphere(p,1.);
|
||||
|
||||
|
||||
return min(plane,sp);
|
||||
}
|
||||
|
||||
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)
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
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.,-10.);
|
||||
vec3 rd = normalize(vec3(uv, 1.));
|
||||
vec3 cp = ro;
|
||||
|
||||
float id = 0.;
|
||||
for(float st = 0.; st < 1.; st += 1. / 128.)
|
||||
{
|
||||
float cd = map(cp);
|
||||
if(cd < .01)
|
||||
{
|
||||
id = 1. - st;
|
||||
break;
|
||||
}
|
||||
cp += rd * cd * .5;
|
||||
}
|
||||
|
||||
|
||||
vec3 norm = normal(cp);
|
||||
vec3 ld = normalize(cp - vec3(10 * sin(-fGlobalTime),10,10*cos(-fGlobalTime)));
|
||||
|
||||
float light = clamp(dot(norm,ld),0.,1.);
|
||||
|
||||
float f = id;
|
||||
vec4 base = vec4(.2,.14,.7,1.);
|
||||
|
||||
float l = light * id;
|
||||
out_color = vec4(mix(vec4(1.),base,1. - l)) ;
|
||||
}
|
71
2017-11-25/02-koltes.glsl
Normal file
71
2017-11-25/02-koltes.glsl
Normal file
@ -0,0 +1,71 @@
|
||||
#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
|
||||
|
||||
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
|
||||
|
||||
#define T fGlobalTime
|
||||
|
||||
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 C,S;
|
||||
#define rot(a) mat2(C=cos(a),S=sin(a),-S,C)
|
||||
#define h(x) fract(sin(x)*1e4)
|
||||
const float is3=1./sqrt(3.);
|
||||
mat2 sk=mat2(2*is3,is3,0.,1.)*10.,unsk=inverse(sk);
|
||||
struct M{
|
||||
float d;
|
||||
float f;
|
||||
};
|
||||
float rand(vec2 p){
|
||||
return h(dot(p,vec2(12,78)));
|
||||
}
|
||||
float map(vec3 q){
|
||||
float d=10e4;
|
||||
for(float f=0.;f<10.;++f){
|
||||
vec3 p=q;
|
||||
float ri=mod(f+T,10.),
|
||||
ro=-ri*0.01+.2;
|
||||
p.xy*=rot(T*.3+f);
|
||||
p.yz*=rot(T*.5+f+p.z*.2);
|
||||
p.xz*=rot(T*.7+f+p.x*.2);
|
||||
d=min(d,length(vec2(length(p.xz)-ri,p.y))-ro);
|
||||
}
|
||||
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.,-5.),
|
||||
rd=normalize(vec3(uv,1.)),
|
||||
mp=ro;
|
||||
float f,dmin=10.,dt=.2;
|
||||
for(f=0.;f<30.;f++){
|
||||
float d=map(mp);
|
||||
dmin=min(dmin,d);
|
||||
if(d<.01)break;
|
||||
mp+=rd*d;
|
||||
}
|
||||
float r=(dmin-.01)/(dt-.01);
|
||||
vec3 c=vec3(max(1.-f/30.,r*(1.-r)*4.));
|
||||
uv*=rot(T*.1);
|
||||
vec2 skuv=sk*uv;
|
||||
skuv.x+=T*2.+sin(T)*2.;
|
||||
vec2 iuv=floor(skuv),
|
||||
fuv=fract(skuv);
|
||||
iuv.y+=step(fuv.x,fuv.y)*10.;
|
||||
float rr=rand(iuv);
|
||||
c=mix(c,vec3(1),smoothstep(.8,.9,sin(T+rr*6.28358)));
|
||||
out_color = vec4(c,1.);
|
||||
}
|
82
2017-11-25/03-ponk.glsl
Normal file
82
2017-11-25/03-ponk.glsl
Normal file
@ -0,0 +1,82 @@
|
||||
#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 time fGlobalTime
|
||||
#define PI 3.14159
|
||||
#define TAU (2.*PI)
|
||||
|
||||
float rng (vec2 seed) { return fract(sin(dot(seed*.1,vec2(123,165)))*121513.); }
|
||||
|
||||
mat2 rot (float a) { float c=cos(a),s=sin(a); return mat2(c,-s,s,c); }
|
||||
|
||||
float amod(inout 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.;
|
||||
p = vec2(cos(a),sin(a))*length(p);
|
||||
return c;
|
||||
}
|
||||
|
||||
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.xy *= rot(time+length(uv));
|
||||
vec2 uvv = uv;
|
||||
float index = amod(uv, 8.);
|
||||
|
||||
uv.y = mix(uv.y, -uv.y, mod(index, 2.));
|
||||
|
||||
|
||||
float star = 0.;
|
||||
float circle = 0.;
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
|
||||
vec4 fft = texture(texFFT, i/100.);
|
||||
vec2 p = uv;
|
||||
float a = rng(vec2(i))*TAU;
|
||||
a += time;
|
||||
float radius = .1;
|
||||
float r = mod(time*.1+i*.1, 1.);
|
||||
radius *= clamp(r,0.,1.);
|
||||
//radius *= smoothstep(0., .2, length(p));
|
||||
p.xy += vec2(cos(a),sin(a))*r;
|
||||
p.x *= .8;
|
||||
p.y += -sin(abs(p.x*1.5))*.5;
|
||||
//p = normalize(p)*mod(length(p)- time*.1 + i * .2,1.);
|
||||
float c = 1.-smoothstep(radius*.99,radius, length(p));
|
||||
c *= 1.-clamp(length(p)*8.,0.,1.);
|
||||
circle += c;
|
||||
a = rng(vec2(i+3.))*TAU;
|
||||
r = i*.1;
|
||||
p = uvv;
|
||||
//p.xy *= rot(time+i);
|
||||
r = mod(time*.3+r, 1.);
|
||||
float thin = .01 * r;
|
||||
p.xy += vec2(cos(a),sin(a)) * r;
|
||||
float x = thin/clamp(length(p.x),0.,1.);
|
||||
float y = thin/clamp(length(p.y),0.,1.);
|
||||
star += x*y*(.01/clamp(length(p),0.,1.));
|
||||
//circle += .01/length(p);
|
||||
|
||||
}
|
||||
vec4 color = vec4(circle,0,0,1);
|
||||
color += star;
|
||||
out_color = color;
|
||||
}
|
49
2017-11-25/03-remi.glsl
Normal file
49
2017-11-25/03-remi.glsl
Normal file
@ -0,0 +1,49 @@
|
||||
#version 410 core
|
||||
|
||||
uniform float fGlobalTime; // in seconds
|
||||
uniform vec2 v2Resolution; // viewport resolution (in pixels)
|
||||
|
||||
#define T fGlobalTime
|
||||
|
||||
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
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
|
||||
vec2 st = uv;
|
||||
vec2 brUv = uv;
|
||||
uv -= 0.5;
|
||||
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
|
||||
|
||||
uv *= 2.;
|
||||
uv.x += sin(T*1.5);
|
||||
uv.y = uv.y*sin(T)*5.;
|
||||
|
||||
vec4 noise = texture(texNoise, uv);
|
||||
// noise *= 0.5;
|
||||
// noise += 0.5;
|
||||
|
||||
st.y = st.y + noise.x * 0.05;
|
||||
|
||||
vec4 pattern = texture(texTex4, st);
|
||||
|
||||
pattern.r = pattern.g;
|
||||
st.y = st.y+(pattern.b * sin(T*2.)*.09);
|
||||
pattern = texture(texTex4, st);
|
||||
st *= cos(T)*5.;
|
||||
|
||||
vec4 color = pattern-(noise*0.5);
|
||||
vec4 bricks = texture(texTex1, brUv);
|
||||
color.r += bricks.r;
|
||||
out_color = color;
|
||||
}
|
67
2017-11-25/04-anton.glsl
Normal file
67
2017-11-25/04-anton.glsl
Normal file
@ -0,0 +1,67 @@
|
||||
#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 fbm(vec2 p)
|
||||
{
|
||||
float a = .25;
|
||||
|
||||
float time = fGlobalTime * .1;
|
||||
|
||||
float c = cos(a); float s = sin(a);
|
||||
mat2 m = mat2(c,-s,s,c);
|
||||
float acc = 1.;
|
||||
float f = texture(texNoise,p / acc + time).r * acc; p *=m; acc *= .99;
|
||||
f += texture(texNoise,p / acc ).r * acc; p *=m * .1235 + time; acc *= .9;
|
||||
f += texture(texNoise,p / acc ).r * acc; p *=m * .2369 + time; acc *= .09;
|
||||
f += texture(texNoise,p / acc ).r * acc; p *=m * 125. + time; acc *= .09;
|
||||
texture(texNoise,p).r; p *=m;
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 f = 0.;
|
||||
|
||||
float a = .1 + length(uv * .25);
|
||||
float c = cos(a); float s = sin(a);
|
||||
uv *= mat2(c,-s,s,c);
|
||||
|
||||
float amp = sin(length(uv) * 10.- fGlobalTime) *.5 +.5;
|
||||
amp = amp * .4 + .7;
|
||||
//f = 1. - length(uv);
|
||||
|
||||
float st = sin(fGlobalTime) * .5 + .5;
|
||||
|
||||
st = st * .4 + .5;
|
||||
|
||||
f = 1. - smoothstep(fbm(uv), st - .05,st + .05);
|
||||
|
||||
|
||||
vec3 col = .45 * vec3(sin(f *.25) * .4 + .4, cos(f*1.1) * .5 + .3, sin(f * 4) * .5 + .7);
|
||||
|
||||
|
||||
|
||||
|
||||
out_color = vec4(col,0.) * amp;
|
||||
// out_color = texture(texTex1, vec2(fbm(uv),fbm(uv.yx)));
|
||||
}
|
98
2017-11-25/04-lamogui.glsl
Normal file
98
2017-11-25/04-lamogui.glsl
Normal file
@ -0,0 +1,98 @@
|
||||
#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 f = 0.0;
|
||||
for (int i = 0 ; i < 64; ++i)
|
||||
{
|
||||
f += texture(texFFTIntegrated, float(i)/1024.0).x;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
float bass2()
|
||||
{
|
||||
float f = 0.0;
|
||||
for (int i = 0 ; i < 32; ++i)
|
||||
{
|
||||
f += texture(texFFT, float(i)/1024.0).x;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
int id = 0;
|
||||
|
||||
float b = 0.0;
|
||||
float map(vec3 p)
|
||||
{
|
||||
vec3 u = vec3(0.0, 2.0, 2.0 + fGlobalTime);
|
||||
vec3 o = p - u;
|
||||
vec2 t = vec2(atan(p.y, p.x), asin(p.z)) + 0.05 * b;
|
||||
float v = texture(texNoise, t).x;
|
||||
float d = length(p - u) - 0.5 + 0.6 * v;
|
||||
float d2 = cos(p.x) + sin(p.y) +cos(p.z) + 0.2 * bass2() * cos(p.y * 20.0);
|
||||
if (d2 < d)
|
||||
id = 1;
|
||||
return min(d,d2);
|
||||
}
|
||||
|
||||
float occ = 1.0;
|
||||
|
||||
vec3 rm(vec3 ro, vec3 rd)
|
||||
{
|
||||
vec3 p = ro;
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
float d = map(p);
|
||||
if (abs(d) < 0.01)
|
||||
{
|
||||
occ = i / 64.0;
|
||||
break;
|
||||
}
|
||||
p += rd * d * 0.8;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
b = bass();
|
||||
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, 2.0, fGlobalTime);
|
||||
vec3 rd = normalize(vec3(uv, 1.0));
|
||||
|
||||
vec3 p = rm(ro, rd);
|
||||
|
||||
|
||||
vec3 color = vec3(exp(-distance(ro, p) * 0.1));
|
||||
|
||||
vec3 u = vec3(0.0, 2.0, 200.0 * b);
|
||||
vec3 o = p - u;
|
||||
vec2 t = vec2(atan(p.y, p.x), asin(p.z)) + 0.1 * b;
|
||||
vec3 vcolor = texture(texChecker, t).rgb;
|
||||
vec3 v2color = texture(texTex4, t).rgb;
|
||||
//if (id == 1)
|
||||
// color *= vcolor * (1.0 - occ);
|
||||
// else
|
||||
color *= (vcolor * 0.7 + 0.5 * v2color) * (1.0 - occ);
|
||||
|
||||
out_color = vec4(color, 1.0);
|
||||
}
|
18
2017-11-25/Readme.md
Normal file
18
2017-11-25/Readme.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Shader Showdown Paris #3
|
||||
|
||||
On November 25th, 2017 at [Nogozon](https://www.facebook.com/nogozon/).
|
||||
|
||||
[Video on YouTube](https://youtu.be/55ayUl_07-E)
|
||||
|
||||
## Rounds
|
||||
|
||||
1. Lamogui vs Ponk
|
||||
2. Anton vs Koltes
|
||||
3. Ponk vs Remi
|
||||
4. Anton vs Lamogui
|
||||
|
||||
## Extras
|
||||
|
||||
- Flopine
|
||||
- Shader exquis #1
|
||||
- Shader exquis #2
|
97
2017-11-25/extra-flopine.glsl
Normal file
97
2017-11-25/extra-flopine.glsl
Normal 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
|
||||
|
||||
mat2 rot (float angle)
|
||||
{ float c = cos(angle);
|
||||
float s = sin (angle);
|
||||
return mat2 (c,-s,s,c);
|
||||
}
|
||||
|
||||
float sphe (vec3 pos, float r)
|
||||
{
|
||||
return length (pos) - r;
|
||||
}
|
||||
|
||||
float cylinder (vec2 pos, float r)
|
||||
{
|
||||
return length (pos) - r;
|
||||
}
|
||||
|
||||
float box (vec3 p, vec3 c)
|
||||
{
|
||||
vec3 d=abs(p) - c;
|
||||
return min(max(d.x,max(d.y,d.z)),0.0)+length(max(d,0.));
|
||||
}
|
||||
|
||||
vec2 moda (vec2 p)
|
||||
{
|
||||
float angle = atan(p.y,p.x);
|
||||
float l = length(p);
|
||||
float period = 2.*3.1459/3.;
|
||||
|
||||
angle = mod(angle-period/2., period)-period/2.;
|
||||
return vec2(cos(angle)*l,sin(angle)*l);
|
||||
}
|
||||
|
||||
|
||||
float map (vec3 p)
|
||||
{
|
||||
float period = 2.;
|
||||
p.xz *= rot(sin(fGlobalTime));
|
||||
|
||||
p.yz = moda(p.yz);
|
||||
p = mod(p-period/2., p)-period/2.;
|
||||
return max(-sphe(p,1.),box(p,vec3(0.8)));
|
||||
//return box(p,vec3 (0.8));
|
||||
}
|
||||
|
||||
|
||||
vec3 nor (vec3 p)
|
||||
{
|
||||
vec2 eps = vec2(0.01,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)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
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.001,0.2,-20.);
|
||||
vec3 dir = normalize(vec3(uv*.5,1.));
|
||||
vec3 l = normalize(vec3(0.,0.,-3.));
|
||||
vec3 color = vec3(0.);
|
||||
|
||||
|
||||
for (int i = 0; i<80;i++)
|
||||
{
|
||||
float d = map(pos);
|
||||
if (d<0.01)
|
||||
{vec3 norm = nor(pos);
|
||||
color = vec3(dot(norm,l));
|
||||
break;
|
||||
}
|
||||
d *= 0.5;
|
||||
pos += d*dir;
|
||||
}
|
||||
out_color = vec4(color,1.);
|
||||
}
|
115
2017-11-25/extra-shex-1.glsl
Normal file
115
2017-11-25/extra-shex-1.glsl
Normal file
@ -0,0 +1,115 @@
|
||||
#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 texNogozon;
|
||||
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 rep(float p, float r)
|
||||
{
|
||||
float hr = r * .5;
|
||||
return mod(p + hr,r) - hr;
|
||||
}
|
||||
|
||||
mat2 rot(float a)
|
||||
{
|
||||
float c = cos(a); float s = sin(a);
|
||||
return mat2(c,-s,s,c);
|
||||
}
|
||||
|
||||
#define PI 3.14
|
||||
|
||||
float map(vec3 pos)
|
||||
{
|
||||
|
||||
pos.xy *= rot(.05 * pos.z);
|
||||
|
||||
pos += 1.5 ;
|
||||
|
||||
float t = fGlobalTime;
|
||||
|
||||
float ft = floor(t);
|
||||
float mt = t - ft;
|
||||
|
||||
t = ft + sin( mt * PI - PI/2.) * .5 + .5;
|
||||
|
||||
float re = 3.;
|
||||
|
||||
pos.xy *= rot(fGlobalTime * .3);
|
||||
pos.yz *= rot(fGlobalTime * .5);
|
||||
|
||||
//pos.z += t * re;
|
||||
pos.z += fGlobalTime * 4.;
|
||||
|
||||
pos.x = rep(pos.x , re);
|
||||
pos.y = rep(pos.y , re);
|
||||
pos.z = rep(pos.z , re);
|
||||
|
||||
return min(min(length(pos.xy), length(pos.yz)),length(pos.xz))-.25;
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
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,-10);
|
||||
vec3 rd = normalize(vec3(uv,1));
|
||||
vec3 cp = ro;
|
||||
|
||||
float id = 0.;
|
||||
|
||||
for(float st = 0.; st < 1.; st += 1. / 128.)
|
||||
{
|
||||
float cd = map(cp);
|
||||
if(cd < .01)
|
||||
{
|
||||
id = 1. - st;
|
||||
break;
|
||||
}
|
||||
|
||||
cp += rd * cd * .5;
|
||||
}
|
||||
|
||||
float f = id;
|
||||
|
||||
vec3 ld = normalize(cp - vec3(0));
|
||||
|
||||
vec3 norm = normal(cp);
|
||||
|
||||
out_color = vec4(f * clamp(dot(norm, ld),0.,1.) * 1.5);
|
||||
out_color *= 4.;
|
||||
out_color = floor(out_color);
|
||||
out_color /= 4.;
|
||||
}
|
140
2017-11-25/extra-shex-2.glsl
Normal file
140
2017-11-25/extra-shex-2.glsl
Normal file
@ -0,0 +1,140 @@
|
||||
#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 texNogozon;
|
||||
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 rep(float p, float r)
|
||||
{
|
||||
float hr = r * .5;
|
||||
return mod(p + hr,r) - hr;
|
||||
}
|
||||
|
||||
mat2 rot(float a)
|
||||
{
|
||||
float c = cos(a); float s = sin(a);
|
||||
return mat2(c,-s,s,c);
|
||||
}
|
||||
|
||||
#define PI 3.14
|
||||
|
||||
float map(vec3 pos)
|
||||
{
|
||||
float phi = asin(pos.z) + 1.0 * fGlobalTime;
|
||||
float theta = atan(pos.y, pos.x);
|
||||
float v = texture(texNoise, vec2(theta, phi)).x;
|
||||
return length(pos /*+ vec3(0.0, 0.05 * cos(10.0 * fGlobalTime + 50.0 * pos.y), 0.0)*/) - (0.5 + v * 0.1);
|
||||
|
||||
/*
|
||||
pos.xy *= rot(.05 * pos.z);
|
||||
|
||||
pos += 1.5 ;
|
||||
|
||||
float t = fGlobalTime;
|
||||
|
||||
float ft = floor(t);
|
||||
float mt = t - ft;
|
||||
|
||||
t = ft + sin( mt * PI - PI/2.) * .5 + .5;
|
||||
|
||||
float re = 3.;
|
||||
|
||||
pos.xy *= rot(fGlobalTime * .3);
|
||||
pos.yz *= rot(fGlobalTime * .5);
|
||||
|
||||
//pos.z += t * re;
|
||||
pos.z += fGlobalTime * 4.;
|
||||
|
||||
pos.x = rep(pos.x , re);
|
||||
pos.y = rep(pos.y , re);
|
||||
pos.z = rep(pos.z , re);
|
||||
|
||||
return min(min(length(pos.xy), length(pos.yz)),length(pos.xz))-.25;*/
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
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,-2);
|
||||
vec3 rd = normalize(vec3(uv,1));
|
||||
vec3 p = ro;
|
||||
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
float d = map(p);
|
||||
if (abs(d) < 0.01)
|
||||
{
|
||||
break;
|
||||
}
|
||||
p = p + rd * d;
|
||||
}
|
||||
|
||||
vec3 color = vec3(exp(-distance(ro, p) * 0.7));
|
||||
float pi2 = 0.5 * 3.14159;
|
||||
float phi = asin(p.z) / pi2 + 1.0 * fGlobalTime;
|
||||
float theta = atan(p.y, p.x) / pi2;
|
||||
vec3 vcolor = texture(texTex2, vec2(theta, phi)).rgb;
|
||||
out_color = vec4(vcolor, 1);
|
||||
color += vcolor;
|
||||
|
||||
/*
|
||||
float id = 0.;
|
||||
|
||||
|
||||
for(float st = 0.; st < 1.; st += 1. / 128.)
|
||||
{
|
||||
float cd = map(cp);
|
||||
if(cd < .01)
|
||||
{
|
||||
id = 1. - st;
|
||||
break;
|
||||
}
|
||||
|
||||
cp += rd * cd * .5;
|
||||
}
|
||||
|
||||
float f = id;
|
||||
|
||||
vec3 ld = normalize(cp - vec3(0));
|
||||
|
||||
vec3 norm = normal(cp);
|
||||
|
||||
out_color = vec4(f * clamp(dot(norm, ld),0.,1.) * 1.5);
|
||||
out_color *= 4.;
|
||||
out_color = floor(out_color);
|
||||
out_color /= 4.;*/
|
||||
}
|
Loading…
Reference in New Issue
Block a user