forked from extern/Live-Coding-Sources
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
7f28e92aec |
@ -1,6 +1,6 @@
|
||||
# Performances
|
||||
|
||||
On March 15th 2023 on [La fabrique à cookie 05](https://fb.me/e/3sl7Kb5me).
|
||||
On March 15th 2023 on [La fabrique à cookie 06](https://fb.me/e/3sl7Kb5me).
|
||||
|
||||
## Shaders
|
||||
|
||||
|
295
2023-03-15_FabriqueACookie06/leon.frag
Normal file
295
2023-03-15_FabriqueACookie06/leon.frag
Normal file
@ -0,0 +1,295 @@
|
||||
/*{ "camera": true,
|
||||
"audio":true }*/
|
||||
uniform sampler2D camera;
|
||||
|
||||
#ifndef TOOLS_INCLUDE
|
||||
#define TOOLS_INCLUDE
|
||||
|
||||
precision highp float;
|
||||
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
uniform sampler2D spectrum;
|
||||
uniform sampler2D midi;
|
||||
|
||||
uniform sampler2D greyNoise;
|
||||
|
||||
float mtime; // modulated time
|
||||
|
||||
#define FFTI(a) time
|
||||
|
||||
#define sat(a) clamp(a, 0., 1.)
|
||||
#define FFT(a) texture2D(spectrum, vec2(a, 0.)).x
|
||||
|
||||
#define EPS vec2(0.01, 0.)
|
||||
#define AKAI_KNOB(a) (texture2D(midi, vec2(176. / 256., (0.+min(max(float(a), 0.), 7.)) / 128.)).x)
|
||||
|
||||
#define MIDI_KNOB(a) (texture2D(midi, vec2(176. / 256., (16.+min(max(float(a), 0.), 7.)) / 128.)).x)
|
||||
#define MIDI_FADER(a) (texture2D(midi, vec2(176. / 256., (0.+min(max(float(a), 0.), 7.)) / 128.)).x)
|
||||
|
||||
#define MIDI_BTN_S(a) sat(texture2D(midi, vec2(176. / 256., (32.+min(max(float(a), 0.), 7.)) / 128.)).x*10.)
|
||||
#define MIDI_BTN_M(a) sat(texture2D(midi, vec2(176. / 256., (48.+min(max(float(a), 0.), 7.)) / 128.)).x*10.)
|
||||
#define MIDI_BTN_R(a) sat(texture2D(midi, vec2(176. / 256., (64.+min(max(float(a), 0.), 7.)) / 128.)).x*10.)
|
||||
|
||||
#define FFTlow (FFT(0.1) * MIDI_KNOB(0))
|
||||
#define FFTmid (FFT(0.5) * MIDI_KNOB(1))
|
||||
#define FFThigh (FFT(0.7) * MIDI_KNOB(2))
|
||||
#define PI 3.14159265
|
||||
#define TAU (PI*2.0)
|
||||
float hash11(float seed)
|
||||
{
|
||||
return fract(sin(seed*123.456)*123.456);
|
||||
}
|
||||
|
||||
float _cube(vec3 p, vec3 s)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
return max(l.x, max(l.y, l.z));
|
||||
}
|
||||
float _cucube(vec3 p, vec3 s, vec3 th)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
float cube = max(max(l.x, l.y), l.z);
|
||||
l = abs(l)-th;
|
||||
float x = max(l.y, l.z);
|
||||
float y = max(l.x, l.z);
|
||||
float z = max(l.x, l.y);
|
||||
|
||||
return max(min(min(x, y), z), cube);
|
||||
}
|
||||
float _seed;
|
||||
|
||||
float rand()
|
||||
{
|
||||
_seed++;
|
||||
return hash11(_seed);
|
||||
}
|
||||
|
||||
mat2 r2d(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
|
||||
|
||||
vec3 getCam(vec3 rd, vec2 uv)
|
||||
{
|
||||
vec3 r = normalize(cross(rd, vec3(0.,1.,0.)));
|
||||
vec3 u = normalize(cross(rd, r));
|
||||
return normalize(rd+(r*uv.x+u*uv.y)*2.);
|
||||
}
|
||||
|
||||
float lenny(vec2 v)
|
||||
{
|
||||
return abs(v.x)+abs(v.y);
|
||||
}
|
||||
float _sqr(vec2 p, vec2 s)
|
||||
{
|
||||
vec2 l = abs(p)-s;
|
||||
return max(l.x, l.y);
|
||||
}
|
||||
float _cir(vec2 uv, float sz)
|
||||
{
|
||||
return length(uv)-sz;
|
||||
}
|
||||
|
||||
float _loz(vec2 uv,float sz)
|
||||
{
|
||||
return lenny(uv)-sz;
|
||||
}
|
||||
vec2 _min(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x < b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
vec2 _max(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x > b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
// To replace missing behavior in veda
|
||||
vec4 textureRepeat(sampler2D sampler, vec2 uv)
|
||||
{
|
||||
return texture2D(sampler, mod(uv, vec2(1.)));
|
||||
}
|
||||
|
||||
#endif // !TOOLS_INCLUDE
|
||||
|
||||
|
||||
|
||||
vec2 map(vec3 p)
|
||||
{
|
||||
float pix = .2;
|
||||
p = floor(p/pix)*pix;
|
||||
vec2 acc = vec2(10000., -1.);
|
||||
|
||||
//acc = _min(acc, vec2(length(p)-1., 0.));
|
||||
vec3 pc = p;
|
||||
pc.xz *= r2d(time*.1+p.y*.005);
|
||||
vec2 repc=vec2(40.5);
|
||||
pc.xz = mod(pc.xz+repc*.5,repc)-repc*.5;
|
||||
|
||||
float col = length(pc.xz)-.5;
|
||||
col = max(col, _sqr(p.xz, vec2(70.)));
|
||||
acc = _min(acc, vec2(col, 1.));
|
||||
|
||||
vec3 pp = p;
|
||||
pp.xy *= r2d(sin(pp.z+time));
|
||||
float an = atan(pp.y, pp.x);
|
||||
float rep = PI*2./3.;
|
||||
float sector = mod(an+rep*.5,rep)-rep*.5;
|
||||
pp.xy = vec2(sin(sector), cos(sector))*length(p.xy);
|
||||
float pillar = _sqr(pp.xy-vec2(0.,.5+FFT(sin(pp.z)*.25)), vec2(.07));
|
||||
acc = _min(acc, vec2(pillar, 2.));
|
||||
|
||||
vec3 ps = pc;
|
||||
// ps.xy *= r2d()
|
||||
float repa = 1.5;
|
||||
float ida = floor((ps.y+repa*.5)/repa);
|
||||
ps.y = mod(ps.y+repa*.5,repa)-repa*.5;
|
||||
ps.xz *= r2d(ida+sin(time*.5));
|
||||
float sz = 1.+.3*sin(ida*2.+time*2.)
|
||||
+.25*sin(ida*2.+time*4.)
|
||||
+FFT(abs(ida*.1)*.5);
|
||||
float sq = _sqr(ps.xz, vec2(sz));
|
||||
sq = max(abs(sq)-.05, abs(ps.y)-.4);
|
||||
acc = _min(acc, vec2(sq, 3.));
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
||||
vec3 accCol;
|
||||
vec3 trace(vec3 ro, vec3 rd)
|
||||
{
|
||||
accCol = vec3(0.);
|
||||
vec3 p = ro;
|
||||
for (int i = 0; i < 100; ++i)
|
||||
{
|
||||
vec2 res = map(p);
|
||||
if (res.x < 0.01)
|
||||
return vec3(res.x, distance(p, ro), res.y);
|
||||
accCol += sat(sin(p))*(1.-sat(res.x/1.5))*.1;
|
||||
p+= rd*res.x;
|
||||
}
|
||||
return vec3(-1.);
|
||||
}
|
||||
|
||||
vec3 getNorm(vec3 p, float d)
|
||||
{
|
||||
vec2 e = vec2(0.01, 0.);
|
||||
return normalize(vec3(d) - vec3(map(p-e.xyy).x, map(p-e.yxy).x, map(p-e.yyx).x));
|
||||
}
|
||||
vec3 getMat(vec3 p, vec3 n, vec3 rd, vec3 res)
|
||||
{
|
||||
vec3 col = n*.5+.5;
|
||||
|
||||
if (res.z == 1.)
|
||||
{
|
||||
vec3 a = vec3(1.,.1,.2)*1.5;
|
||||
vec3 b = vec3(1.,.1,.2)*3.5;
|
||||
col = mix(a, b, (sin(p.y+time*13.)));
|
||||
col.xy *= r2d(p.x+time);
|
||||
col = abs(col);
|
||||
}
|
||||
if (res.z == 2.)
|
||||
{
|
||||
col = vec3(1.)*(1.-sat(res.y/10.));
|
||||
}
|
||||
if (res.z == 3.)
|
||||
{
|
||||
col = vec3(0.1);
|
||||
}
|
||||
return col;
|
||||
}
|
||||
vec3 rdr(vec2 uv)
|
||||
{
|
||||
uv *= r2d(.5+time*.1);
|
||||
vec3 ro = vec3(0, 0., -3.);
|
||||
vec3 ta = vec3(0.,6.*sin(time*.05),0.);
|
||||
vec3 rd = normalize(ta-ro);
|
||||
rd = getCam(rd, uv);
|
||||
vec3 col = vec3(0.);
|
||||
uv.x -= sign(uv.x)*abs(uv.y*.5);
|
||||
col = vec3(1.)*FFT(abs(uv.x)*2.)*1.;
|
||||
|
||||
vec3 res = trace(ro, rd);
|
||||
vec3 acc = accCol;
|
||||
if (res.y > 0.)
|
||||
{
|
||||
vec3 p = ro + rd*res.y;
|
||||
vec3 n = getNorm(p, res.x);
|
||||
col = getMat(p, n, rd, res);
|
||||
if (res.z == 3.)
|
||||
{
|
||||
vec3 refl = normalize(reflect(rd, n)
|
||||
+(vec3(rand(), rand(), rand())-.5)*.0);
|
||||
vec3 resrefl = trace(p+n*0.01, refl);
|
||||
if (resrefl.y > 0.)
|
||||
{
|
||||
vec3 prefl = p+n*0.01+refl*resrefl.y;
|
||||
vec3 nrefl = getNorm(prefl, resrefl.x);
|
||||
col += getMat(prefl, nrefl, refl, resrefl);
|
||||
}
|
||||
}
|
||||
}
|
||||
col += acc;
|
||||
return col;
|
||||
}
|
||||
|
||||
#define repeat(p,r) (mod(p,r)-r/2.)
|
||||
float sdf(vec3 p)
|
||||
{
|
||||
vec3 q = p;
|
||||
// p.z -= time * 2.;
|
||||
//p.z = repeat(p.z, 9.);
|
||||
float t = time*4.+p.z*.4;
|
||||
t = pow(fract(t), .1) + floor(t);
|
||||
p.xz *= r2d(t);
|
||||
p.yz *= r2d(t);
|
||||
float dist = 100.;
|
||||
const float count = 8.;
|
||||
float a = 1.;
|
||||
float r = .3+.0*abs(sin(time*5.));
|
||||
// r = fract(time*1.+p.z)*.3;
|
||||
float s = .2+.1*abs(sin(time*10.));
|
||||
for (float i = 0.; i < count; ++i)
|
||||
{
|
||||
p.x = abs(p.x)-r*a;
|
||||
p.xy *= r2d(t/a);
|
||||
p.xz *= r2d(t/a);
|
||||
dist = min(dist, length(p)-s*a);
|
||||
// dist = min(dist, abs(max(p.x,max(p.y,p.z)))-.1*a);
|
||||
a/=1.4;
|
||||
}
|
||||
//dist = max((dist), -(length(q)-0.3));
|
||||
//dist = max(abs(dist)-.01, q.z);
|
||||
return dist;
|
||||
}
|
||||
void main() {
|
||||
vec2 uv = (gl_FragCoord.xy-.5*resolution.xy) / resolution.xx;
|
||||
//_seed = time+length(uv)+uv.x*10.+hash11(uv.y);
|
||||
//uv += (vec2(rand(), rand())-.5)*.0;
|
||||
|
||||
vec3 pos = vec3(0,0,3);
|
||||
vec3 ray = normalize(vec3(uv,-.5));
|
||||
const float count = 30.;
|
||||
float shade = 0.;
|
||||
for (float i = count; i > 0.; --i)
|
||||
{
|
||||
float dist = sdf(pos);
|
||||
if (dist<.001)
|
||||
{
|
||||
shade = i/count;
|
||||
break;
|
||||
}
|
||||
pos += ray * dist;
|
||||
}
|
||||
// uv = abs(uv);
|
||||
vec3 col = vec3(shade);
|
||||
// col = pow(col, vec3(2.2));
|
||||
//col += pow(rdr(uv+(vec2(rand(), rand())-.5)*.2),vec3(2.))*.1;
|
||||
//col = texture2D(camera, uv*10.).xyz;
|
||||
//vec3 col = vec3(0.,0.,.5);
|
||||
//col += rand()*.1;
|
||||
//col *= 1.-sat((length(uv)-.2)*3.);
|
||||
col = 0.5 + 0.5 * cos(vec3(1,2,3)*4. + pos.z + shade * 1.);
|
||||
gl_FragColor = vec4(col*shade, 1.0);
|
||||
}
|
347
2023-03-15_FabriqueACookie06/nusan.frag
Normal file
347
2023-03-15_FabriqueACookie06/nusan.frag
Normal file
@ -0,0 +1,347 @@
|
||||
/*{ "camera": true,
|
||||
"audio":true }*/
|
||||
uniform sampler2D camera;
|
||||
|
||||
#ifndef TOOLS_INCLUDE
|
||||
#define TOOLS_INCLUDE
|
||||
|
||||
precision highp float;
|
||||
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
uniform sampler2D spectrum;
|
||||
uniform sampler2D midi;
|
||||
|
||||
uniform sampler2D greyNoise;
|
||||
|
||||
float mtime; // modulated time
|
||||
|
||||
#define FFTI(a) time
|
||||
|
||||
#define sat(a) clamp(a, 0., 1.)
|
||||
#define FFT(a) texture2D(spectrum, vec2(a, 0.)).x
|
||||
|
||||
#define EPS vec2(0.01, 0.)
|
||||
#define AKAI_KNOB(a) (texture2D(midi, vec2(176. / 256., (0.+min(max(float(a), 0.), 7.)) / 128.)).x)
|
||||
|
||||
#define MIDI_KNOB(a) (texture2D(midi, vec2(176. / 256., (16.+min(max(float(a), 0.), 7.)) / 128.)).x)
|
||||
#define MIDI_FADER(a) (texture2D(midi, vec2(176. / 256., (0.+min(max(float(a), 0.), 7.)) / 128.)).x)
|
||||
|
||||
#define MIDI_BTN_S(a) sat(texture2D(midi, vec2(176. / 256., (32.+min(max(float(a), 0.), 7.)) / 128.)).x*10.)
|
||||
#define MIDI_BTN_M(a) sat(texture2D(midi, vec2(176. / 256., (48.+min(max(float(a), 0.), 7.)) / 128.)).x*10.)
|
||||
#define MIDI_BTN_R(a) sat(texture2D(midi, vec2(176. / 256., (64.+min(max(float(a), 0.), 7.)) / 128.)).x*10.)
|
||||
|
||||
#define FFTlow (FFT(0.1) * MIDI_KNOB(0))
|
||||
#define FFTmid (FFT(0.5) * MIDI_KNOB(1))
|
||||
#define FFThigh (FFT(0.7) * MIDI_KNOB(2))
|
||||
#define PI 3.14159265
|
||||
#define TAU (PI*2.0)
|
||||
float hash11(float seed)
|
||||
{
|
||||
return fract(sin(seed*123.456)*123.456);
|
||||
}
|
||||
|
||||
float _cube(vec3 p, vec3 s)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
return max(l.x, max(l.y, l.z));
|
||||
}
|
||||
float _cucube(vec3 p, vec3 s, vec3 th)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
float cube = max(max(l.x, l.y), l.z);
|
||||
l = abs(l)-th;
|
||||
float x = max(l.y, l.z);
|
||||
float y = max(l.x, l.z);
|
||||
float z = max(l.x, l.y);
|
||||
|
||||
return max(min(min(x, y), z), cube);
|
||||
}
|
||||
float _seed;
|
||||
|
||||
float rand()
|
||||
{
|
||||
_seed++;
|
||||
return hash11(_seed);
|
||||
}
|
||||
|
||||
mat2 r2d(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
|
||||
|
||||
vec3 getCam(vec3 rd, vec2 uv)
|
||||
{
|
||||
vec3 r = normalize(cross(rd, vec3(0.,1.,0.)));
|
||||
vec3 u = normalize(cross(rd, r));
|
||||
return normalize(rd+(r*uv.x+u*uv.y)*2.);
|
||||
}
|
||||
|
||||
float lenny(vec2 v)
|
||||
{
|
||||
return abs(v.x)+abs(v.y);
|
||||
}
|
||||
float _sqr(vec2 p, vec2 s)
|
||||
{
|
||||
vec2 l = abs(p)-s;
|
||||
return max(l.x, l.y);
|
||||
}
|
||||
float _cir(vec2 uv, float sz)
|
||||
{
|
||||
return length(uv)-sz;
|
||||
}
|
||||
|
||||
float _loz(vec2 uv,float sz)
|
||||
{
|
||||
return lenny(uv)-sz;
|
||||
}
|
||||
vec2 _min(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x < b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
vec2 _max(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x > b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
// To replace missing behavior in veda
|
||||
vec4 textureRepeat(sampler2D sampler, vec2 uv)
|
||||
{
|
||||
return texture2D(sampler, mod(uv, vec2(1.)));
|
||||
}
|
||||
|
||||
#endif // !TOOLS_INCLUDE
|
||||
|
||||
|
||||
|
||||
vec2 map(vec3 p)
|
||||
{
|
||||
float pix = .2;
|
||||
p = floor(p/pix)*pix;
|
||||
vec2 acc = vec2(10000., -1.);
|
||||
|
||||
//acc = _min(acc, vec2(length(p)-1., 0.));
|
||||
vec3 pc = p;
|
||||
pc.xz *= r2d(time*.1+p.y*.005);
|
||||
vec2 repc=vec2(40.5);
|
||||
pc.xz = mod(pc.xz+repc*.5,repc)-repc*.5;
|
||||
|
||||
float col = length(pc.xz)-.5;
|
||||
col = max(col, _sqr(p.xz, vec2(70.)));
|
||||
acc = _min(acc, vec2(col, 1.));
|
||||
|
||||
vec3 pp = p;
|
||||
pp.xy *= r2d(sin(pp.z+time));
|
||||
float an = atan(pp.y, pp.x);
|
||||
float rep = PI*2./3.;
|
||||
float sector = mod(an+rep*.5,rep)-rep*.5;
|
||||
pp.xy = vec2(sin(sector), cos(sector))*length(p.xy);
|
||||
float pillar = _sqr(pp.xy-vec2(0.,.5+FFT(sin(pp.z)*.25)), vec2(.07));
|
||||
acc = _min(acc, vec2(pillar, 2.));
|
||||
|
||||
vec3 ps = pc;
|
||||
// ps.xy *= r2d()
|
||||
float repa = 1.5;
|
||||
float ida = floor((ps.y+repa*.5)/repa);
|
||||
ps.y = mod(ps.y+repa*.5,repa)-repa*.5;
|
||||
ps.xz *= r2d(ida+sin(time*.5));
|
||||
float sz = 1.+.3*sin(ida*2.+time*2.)
|
||||
+.25*sin(ida*2.+time*4.)
|
||||
+FFT(abs(ida*.1)*.5);
|
||||
float sq = _sqr(ps.xz, vec2(sz));
|
||||
sq = max(abs(sq)-.05, abs(ps.y)-.4);
|
||||
acc = _min(acc, vec2(sq, 3.));
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
||||
vec3 accCol;
|
||||
vec3 trace(vec3 ro, vec3 rd)
|
||||
{
|
||||
accCol = vec3(0.);
|
||||
vec3 p = ro;
|
||||
for (int i = 0; i < 100; ++i)
|
||||
{
|
||||
vec2 res = map(p);
|
||||
if (res.x < 0.01)
|
||||
return vec3(res.x, distance(p, ro), res.y);
|
||||
accCol += sat(sin(p))*(1.-sat(res.x/1.5))*.1;
|
||||
p+= rd*res.x;
|
||||
}
|
||||
return vec3(-1.);
|
||||
}
|
||||
|
||||
vec3 getNorm(vec3 p, float d)
|
||||
{
|
||||
vec2 e = vec2(0.01, 0.);
|
||||
return normalize(vec3(d) - vec3(map(p-e.xyy).x, map(p-e.yxy).x, map(p-e.yyx).x));
|
||||
}
|
||||
vec3 getMat(vec3 p, vec3 n, vec3 rd, vec3 res)
|
||||
{
|
||||
vec3 col = n*.5+.5;
|
||||
|
||||
if (res.z == 1.)
|
||||
{
|
||||
vec3 a = vec3(1.,.1,.2)*1.5;
|
||||
vec3 b = vec3(1.,.1,.2)*3.5;
|
||||
col = mix(a, b, (sin(p.y+time*13.)));
|
||||
col.xy *= r2d(p.x+time);
|
||||
col = abs(col);
|
||||
}
|
||||
if (res.z == 2.)
|
||||
{
|
||||
col = vec3(1.)*(1.-sat(res.y/10.));
|
||||
}
|
||||
if (res.z == 3.)
|
||||
{
|
||||
col = vec3(0.1);
|
||||
}
|
||||
return col;
|
||||
}
|
||||
vec3 rdr(vec2 uv)
|
||||
{
|
||||
uv *= r2d(.5+time*.1);
|
||||
vec3 ro = vec3(0, 0., -3.);
|
||||
vec3 ta = vec3(0.,6.*sin(time*.05),0.);
|
||||
vec3 rd = normalize(ta-ro);
|
||||
rd = getCam(rd, uv);
|
||||
vec3 col = vec3(0.);
|
||||
uv.x -= sign(uv.x)*abs(uv.y*.5);
|
||||
col = vec3(1.)*FFT(abs(uv.x)*2.)*1.;
|
||||
|
||||
vec3 res = trace(ro, rd);
|
||||
vec3 acc = accCol;
|
||||
if (res.y > 0.)
|
||||
{
|
||||
vec3 p = ro + rd*res.y;
|
||||
vec3 n = getNorm(p, res.x);
|
||||
col = getMat(p, n, rd, res);
|
||||
if (res.z == 3.)
|
||||
{
|
||||
vec3 refl = normalize(reflect(rd, n)
|
||||
+(vec3(rand(), rand(), rand())-.5)*.0);
|
||||
vec3 resrefl = trace(p+n*0.01, refl);
|
||||
if (resrefl.y > 0.)
|
||||
{
|
||||
vec3 prefl = p+n*0.01+refl*resrefl.y;
|
||||
vec3 nrefl = getNorm(prefl, resrefl.x);
|
||||
col += getMat(prefl, nrefl, refl, resrefl);
|
||||
}
|
||||
}
|
||||
}
|
||||
col += acc;
|
||||
return col;
|
||||
}
|
||||
|
||||
#define repeat(p,r) (mod(p,r)-r/2.)
|
||||
float sdf(vec3 p)
|
||||
{
|
||||
vec3 q = p;
|
||||
// p.z -= time * 2.;
|
||||
//p.z = repeat(p.z, 9.);
|
||||
float t = time*4.+p.z*.4;
|
||||
t = pow(fract(t), .1) + floor(t);
|
||||
p.xz *= r2d(t);
|
||||
p.yz *= r2d(t);
|
||||
float dist = 100.;
|
||||
const float count = 8.;
|
||||
float a = 1.;
|
||||
float r = .3+.0*abs(sin(time*5.));
|
||||
// r = fract(time*1.+p.z)*.3;
|
||||
float s = .2+.1*abs(sin(time*10.));
|
||||
for (float i = 0.; i < count; ++i)
|
||||
{
|
||||
p.x = abs(p.x)-r*a;
|
||||
p.xy *= r2d(t/a);
|
||||
p.xz *= r2d(t/a);
|
||||
dist = min(dist, length(p)-s*a);
|
||||
// dist = min(dist, abs(max(p.x,max(p.y,p.z)))-.1*a);
|
||||
a/=1.4;
|
||||
}
|
||||
//dist = max((dist), -(length(q)-0.3));
|
||||
//dist = max(abs(dist)-.01, q.z);
|
||||
return dist;
|
||||
}
|
||||
|
||||
float rnd(float t) {
|
||||
return fract(sin(t*199.384)*384.283);
|
||||
}
|
||||
|
||||
float curve(float t, float d) {
|
||||
t/=d;
|
||||
return mix(rnd(floor(t)),rnd(floor(t)+1.0),pow(smoothstep(0.0,1.0,fract(t)),10.0));
|
||||
}
|
||||
|
||||
float curve2(float t, float d) {
|
||||
t/=d;
|
||||
return mix(floor(t)+rnd(floor(t)),floor(t)+1.0+rnd(floor(t)+1.0),pow(smoothstep(0.0,1.0,fract(t)),10.0));
|
||||
}
|
||||
|
||||
float fac=1.0;
|
||||
|
||||
float moo(vec3 p) {
|
||||
|
||||
|
||||
|
||||
p.xy *= r2d(time*fac + p.z*0.03 + sin(-p.z*0.03+time*fac*2.0));
|
||||
|
||||
p.xy = abs(p.xy)-7.4 - sin(time*0.3*fac)*4.0;
|
||||
p.xy *= r2d(curve(time*fac, 0.4));
|
||||
p.xy = abs(p.xy)-0.7-sin(time*fac)*0.3-curve(time*fac+p.z*0.2, 1.0);
|
||||
|
||||
float s=max(0.2, sin(p.z*0.2+time*fac));
|
||||
float d=length(p.xy)-s;
|
||||
p.z=repeat(p.z, 1.2);
|
||||
d=min(d, _cube(p, vec3(0.4)));
|
||||
return d;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = (gl_FragCoord.xy-.5*resolution.xy) / resolution.xx;
|
||||
//_seed = time+length(uv)+uv.x*10.+hash11(uv.y);
|
||||
//uv += (vec2(rand(), rand())-.5)*.0;
|
||||
|
||||
uv.xy *= r2d(time*0.1+sin(curve2(time, 0.5))*0.2);
|
||||
//fac = (rnd(floor(time/4.0))-0.5)*1.6;
|
||||
fac = 0.6;
|
||||
|
||||
uv *= 1.0 + 0.9 * length(uv) * curve(time, 0.1);
|
||||
|
||||
uv.x += (curve(time, 1.7)-0.5)*0.6;
|
||||
|
||||
uv.y -= curve(time*fac-abs(uv.x)*0.1, 0.1)*0.1;
|
||||
|
||||
uv.x = abs(uv.x);
|
||||
|
||||
uv.y += rnd(floor(uv.x*10.0-floor(time)))*0.2*curve(time*fac, 0.4);
|
||||
|
||||
vec3 col=vec3(0);
|
||||
vec3 s=vec3(0,0,-10);
|
||||
vec3 p=s;
|
||||
vec3 r=normalize(vec3(uv, 1));
|
||||
|
||||
float d=10000.0;
|
||||
for(float i=0.0; i<100.0; ++i) {
|
||||
d=moo(p);
|
||||
if(abs(d)<0.001) {
|
||||
col += moo(p-r);
|
||||
break;
|
||||
}
|
||||
if(d>100.0) break;
|
||||
p+=r*d;
|
||||
float d2=length(abs(p.xy)-4.0*sin(time));
|
||||
col += abs(sin(vec3(0.1,0.3,0.5)+vec3(0.4,0.2,0.6)*curve2(time*fac*3.0+p.z*0.005, 0.3)))*0.04/(0.04+abs(d2));
|
||||
}
|
||||
|
||||
float t=time*0.3*fac;
|
||||
uv *= 1.0+0.001*d;
|
||||
uv.x = floor(uv.x*10.0 + floor(uv.y*4.0+t))/10.0;
|
||||
|
||||
col += 0.1*sin(time*fac * vec3(0.2,0.3,0.5) + d*0.1 +curve(uv.x + t,0.5)*4.0);
|
||||
|
||||
col = smoothstep(0.0,1.0,col);
|
||||
col = pow(col, vec3(0.4545));
|
||||
|
||||
gl_FragColor = vec4(col, 1.0);
|
||||
}
|
250
2023-03-15_FabriqueACookie06/z0rg.frag
Normal file
250
2023-03-15_FabriqueACookie06/z0rg.frag
Normal file
@ -0,0 +1,250 @@
|
||||
/*{ "camera": true,
|
||||
"audio":true }*/
|
||||
uniform sampler2D camera;
|
||||
|
||||
#ifndef TOOLS_INCLUDE
|
||||
#define TOOLS_INCLUDE
|
||||
|
||||
precision highp float;
|
||||
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
uniform sampler2D spectrum;
|
||||
uniform sampler2D midi;
|
||||
|
||||
uniform sampler2D greyNoise;
|
||||
|
||||
float mtime; // modulated time
|
||||
|
||||
#define FFTI(a) time
|
||||
|
||||
#define sat(a) clamp(a, 0., 1.)
|
||||
#define FFT(a) texture2D(spectrum, vec2(a, 0.)).x
|
||||
|
||||
#define EPS vec2(0.01, 0.)
|
||||
#define AKAI_KNOB(a) (texture2D(midi, vec2(176. / 256., (0.+min(max(float(a), 0.), 7.)) / 128.)).x)
|
||||
|
||||
#define MIDI_KNOB(a) (texture2D(midi, vec2(176. / 256., (16.+min(max(float(a), 0.), 7.)) / 128.)).x)
|
||||
#define MIDI_FADER(a) (texture2D(midi, vec2(176. / 256., (0.+min(max(float(a), 0.), 7.)) / 128.)).x)
|
||||
|
||||
#define MIDI_BTN_S(a) sat(texture2D(midi, vec2(176. / 256., (32.+min(max(float(a), 0.), 7.)) / 128.)).x*10.)
|
||||
#define MIDI_BTN_M(a) sat(texture2D(midi, vec2(176. / 256., (48.+min(max(float(a), 0.), 7.)) / 128.)).x*10.)
|
||||
#define MIDI_BTN_R(a) sat(texture2D(midi, vec2(176. / 256., (64.+min(max(float(a), 0.), 7.)) / 128.)).x*10.)
|
||||
|
||||
#define FFTlow (FFT(0.1) * MIDI_KNOB(0))
|
||||
#define FFTmid (FFT(0.5) * MIDI_KNOB(1))
|
||||
#define FFThigh (FFT(0.7) * MIDI_KNOB(2))
|
||||
#define PI 3.14159265
|
||||
#define TAU (PI*2.0)
|
||||
float hash11(float seed)
|
||||
{
|
||||
return fract(sin(seed*123.456)*123.456);
|
||||
}
|
||||
|
||||
float _cube(vec3 p, vec3 s)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
return max(l.x, max(l.y, l.z));
|
||||
}
|
||||
float _cucube(vec3 p, vec3 s, vec3 th)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
float cube = max(max(l.x, l.y), l.z);
|
||||
l = abs(l)-th;
|
||||
float x = max(l.y, l.z);
|
||||
float y = max(l.x, l.z);
|
||||
float z = max(l.x, l.y);
|
||||
|
||||
return max(min(min(x, y), z), cube);
|
||||
}
|
||||
float _seed;
|
||||
|
||||
float rand()
|
||||
{
|
||||
_seed++;
|
||||
return hash11(_seed);
|
||||
}
|
||||
|
||||
mat2 r2d(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
|
||||
|
||||
vec3 getCam(vec3 rd, vec2 uv)
|
||||
{
|
||||
vec3 r = normalize(cross(rd, vec3(0.,1.,0.)));
|
||||
vec3 u = normalize(cross(rd, r));
|
||||
return normalize(rd+(r*uv.x+u*uv.y)*2.);
|
||||
}
|
||||
|
||||
float lenny(vec2 v)
|
||||
{
|
||||
return abs(v.x)+abs(v.y);
|
||||
}
|
||||
float _sqr(vec2 p, vec2 s)
|
||||
{
|
||||
vec2 l = abs(p)-s;
|
||||
return max(l.x, l.y);
|
||||
}
|
||||
float _cir(vec2 uv, float sz)
|
||||
{
|
||||
return length(uv)-sz;
|
||||
}
|
||||
|
||||
float _loz(vec2 uv,float sz)
|
||||
{
|
||||
return lenny(uv)-sz;
|
||||
}
|
||||
vec2 _min(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x < b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
vec2 _max(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x > b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
// To replace missing behavior in veda
|
||||
vec4 textureRepeat(sampler2D sampler, vec2 uv)
|
||||
{
|
||||
return texture2D(sampler, mod(uv, vec2(1.)));
|
||||
}
|
||||
|
||||
#endif // !TOOLS_INCLUDE
|
||||
|
||||
|
||||
|
||||
vec2 map(vec3 p)
|
||||
{
|
||||
float pix = .2;
|
||||
p = floor(p/pix)*pix;
|
||||
vec2 acc = vec2(10000., -1.);
|
||||
|
||||
//acc = _min(acc, vec2(length(p)-1., 0.));
|
||||
vec3 pc = p;
|
||||
pc.xz *= r2d(time*.1+p.y*.005);
|
||||
vec2 repc=vec2(40.5);
|
||||
pc.xz = mod(pc.xz+repc*.5,repc)-repc*.5;
|
||||
|
||||
float col = length(pc.xz)-.5;
|
||||
col = max(col, _sqr(p.xz, vec2(70.)));
|
||||
acc = _min(acc, vec2(col, 1.));
|
||||
|
||||
vec3 pp = p;
|
||||
pp.xy *= r2d(sin(pp.z+time));
|
||||
float an = atan(pp.y, pp.x);
|
||||
float rep = PI*2./3.;
|
||||
float sector = mod(an+rep*.5,rep)-rep*.5;
|
||||
pp.xy = vec2(sin(sector), cos(sector))*length(p.xy);
|
||||
float pillar = _sqr(pp.xy-vec2(0.,.5+FFT(sin(pp.z)*.25)), vec2(.07));
|
||||
acc = _min(acc, vec2(pillar, 2.));
|
||||
|
||||
vec3 ps = pc;
|
||||
// ps.xy *= r2d()
|
||||
float repa = 1.5;
|
||||
float ida = floor((ps.y+repa*.5)/repa);
|
||||
ps.y = mod(ps.y+repa*.5,repa)-repa*.5;
|
||||
ps.xz *= r2d(ida+sin(time*.5));
|
||||
float sz = 1.+.3*sin(ida*2.+time*2.)
|
||||
+.25*sin(ida*2.+time*4.)
|
||||
+FFT(abs(ida*.1)*.5);
|
||||
float sq = _sqr(ps.xz, vec2(sz));
|
||||
sq = max(abs(sq)-.05, abs(ps.y)-.4);
|
||||
acc = _min(acc, vec2(sq, 3.));
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
||||
vec3 accCol;
|
||||
vec3 trace(vec3 ro, vec3 rd)
|
||||
{
|
||||
accCol = vec3(0.);
|
||||
vec3 p = ro;
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
vec2 res = map(p);
|
||||
if (res.x < 0.01)
|
||||
return vec3(res.x, distance(p, ro), res.y);
|
||||
accCol += sat(sin(p))*(1.-sat(res.x/1.5))*.1;
|
||||
p+= rd*res.x;
|
||||
}
|
||||
return vec3(-1.);
|
||||
}
|
||||
|
||||
vec3 getNorm(vec3 p, float d)
|
||||
{
|
||||
vec2 e = vec2(0.01, 0.);
|
||||
return normalize(vec3(d) - vec3(map(p-e.xyy).x, map(p-e.yxy).x, map(p-e.yyx).x));
|
||||
}
|
||||
vec3 getMat(vec3 p, vec3 n, vec3 rd, vec3 res)
|
||||
{
|
||||
vec3 col = n*.5+.5;
|
||||
|
||||
if (res.z == 1.)
|
||||
{
|
||||
vec3 a = vec3(1.,.1,.2)*1.5;
|
||||
vec3 b = vec3(1.,.1,.2)*3.5;
|
||||
col = mix(a, b, (sin(p.y+time*13.)));
|
||||
col.xy *= r2d(p.x+time);
|
||||
col = abs(col);
|
||||
}
|
||||
if (res.z == 2.)
|
||||
{
|
||||
col = vec3(1.)*(1.-sat(res.y/10.));
|
||||
}
|
||||
if (res.z == 3.)
|
||||
{
|
||||
col = vec3(0.1);
|
||||
}
|
||||
return col;
|
||||
}
|
||||
vec3 rdr(vec2 uv)
|
||||
{
|
||||
uv *= r2d(.5+time*.1);
|
||||
vec3 ro = vec3(0, 0., -3.);
|
||||
vec3 ta = vec3(0.,6.*sin(time*.05),0.);
|
||||
vec3 rd = normalize(ta-ro);
|
||||
rd = getCam(rd, uv);
|
||||
vec3 col = vec3(0.);
|
||||
uv.x -= sign(uv.x)*abs(uv.y*.5);
|
||||
col = vec3(1.)*FFT(abs(uv.x)*2.)*1.;
|
||||
|
||||
vec3 res = trace(ro, rd);
|
||||
vec3 acc = accCol;
|
||||
if (res.y > 0.)
|
||||
{
|
||||
vec3 p = ro + rd*res.y;
|
||||
vec3 n = getNorm(p, res.x);
|
||||
col = getMat(p, n, rd, res);
|
||||
if (res.z == 3.)
|
||||
{
|
||||
vec3 refl = normalize(reflect(rd, n)
|
||||
+(vec3(rand(), rand(), rand())-.5)*.0);
|
||||
vec3 resrefl = trace(p+n*0.01, refl);
|
||||
if (resrefl.y > 0.)
|
||||
{
|
||||
vec3 prefl = p+n*0.01+refl*resrefl.y;
|
||||
vec3 nrefl = getNorm(prefl, resrefl.x);
|
||||
col += getMat(prefl, nrefl, refl, resrefl);
|
||||
}
|
||||
}
|
||||
}
|
||||
col += acc;
|
||||
return col;
|
||||
}
|
||||
void main() {
|
||||
vec2 uv = (gl_FragCoord.xy-.5*resolution.xy) / resolution.xx;
|
||||
_seed = time+length(uv)+uv.x*10.+hash11(uv.y);
|
||||
uv += (vec2(rand(), rand())-.5)*.0;
|
||||
|
||||
// uv = abs(uv);
|
||||
vec3 col = rdr(uv);
|
||||
col = pow(col, vec3(2.2));
|
||||
//col += pow(rdr(uv+(vec2(rand(), rand())-.5)*.2),vec3(2.))*.1;
|
||||
//col = texture2D(camera, uv*10.).xyz;
|
||||
//vec3 col = vec3(0.,0.,.5);
|
||||
//col += rand()*.1;
|
||||
col *= 1.-sat((length(uv)-.2)*3.);
|
||||
gl_FragColor = vec4(col, 1.0);
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 470 KiB |
5
2023-04-26_FabriqueACookie07/RandomPeople/Desktop.ini
Normal file
5
2023-04-26_FabriqueACookie07/RandomPeople/Desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
ConfirmFileOp=0
|
||||
NoSharing=0
|
||||
IconFile=Ableton Project Info\AProject.ico
|
||||
IconIndex=0
|
Binary file not shown.
25
2023-04-26_FabriqueACookie07/Readme.md
Normal file
25
2023-04-26_FabriqueACookie07/Readme.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Performances
|
||||
|
||||
On April 26th 2023 on [La fabrique à cookie 07](https://fb.me/e/2N1imAmud).
|
||||
|
||||
## Shaders
|
||||
|
||||
NuSan
|
||||

|
||||
Flopine
|
||||

|
||||
Unknown modification on z0rg shader - alt144
|
||||

|
||||
z0rg
|
||||

|
||||
|
||||
## Audi
|
||||
|
||||
Unknown people making ableton
|
||||
Folder : RandomPeople
|
||||
|
||||
## Software
|
||||
- [Atom](https://github.com/atom/atom)
|
||||
- [Veda](https://github.com/fand/veda)
|
||||
- [Ableton](https://www.ableton.com/)
|
||||
|
309
2023-04-26_FabriqueACookie07/alt144.frag
Normal file
309
2023-04-26_FabriqueACookie07/alt144.frag
Normal file
@ -0,0 +1,309 @@
|
||||
/*{ "camera": true,
|
||||
"audio":true }*/
|
||||
uniform sampler2D camera;
|
||||
|
||||
#ifndef TOOLS_INCLUDE
|
||||
#define TOOLS_INCLUDE
|
||||
|
||||
precision highp float;
|
||||
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
uniform sampler2D spectrum;
|
||||
uniform sampler2D midi;
|
||||
|
||||
uniform sampler2D backbuffer;
|
||||
|
||||
uniform sampler2D greyNoise;
|
||||
|
||||
float mtime; // modulated time
|
||||
|
||||
#define FFTI(a) time
|
||||
|
||||
#define sat(a) clamp(a, 0., 1.)
|
||||
#define FFT(a) texture2D(spectrum, vec2(a, 0.)).x
|
||||
|
||||
#define EPS vec2(0.01, 0.)
|
||||
|
||||
#define FFTlow (FFT(0.1) * MIDI_KNOB(0))
|
||||
#define FFTmid (FFT(0.5) * MIDI_KNOB(1))
|
||||
#define FFThigh (FFT(0.7) * MIDI_KNOB(2))
|
||||
#define PI 3.14159265
|
||||
#define TAU (PI*2.0)
|
||||
float hash11(float seed)
|
||||
{
|
||||
return fract(sin(seed*123.456)*123.456);
|
||||
}
|
||||
|
||||
float _cube(vec3 p, vec3 s)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
return max(l.x, max(l.y, l.z));
|
||||
}
|
||||
float _cucube(vec3 p, vec3 s, vec3 th)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
float cube = max(max(l.x, l.y), l.z);
|
||||
l = abs(l)-th;
|
||||
float x = max(l.y, l.z);
|
||||
float y = max(l.x, l.z);
|
||||
float z = max(l.x, l.y);
|
||||
|
||||
return max(min(min(x, y), z), cube);
|
||||
}
|
||||
float _seed;
|
||||
|
||||
float rand()
|
||||
{
|
||||
_seed++;
|
||||
return hash11(_seed);
|
||||
}
|
||||
|
||||
mat2 r2d(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
|
||||
|
||||
vec3 getCam(vec3 rd, vec2 uv)
|
||||
{
|
||||
vec3 r = normalize(cross(rd, vec3(0.,1.,0.)));
|
||||
vec3 u = normalize(cross(rd, r));
|
||||
return normalize(rd+(r*uv.x+u*uv.y)*2.);
|
||||
}
|
||||
|
||||
float lenny(vec2 v)
|
||||
{
|
||||
return abs(v.x)+abs(v.y);
|
||||
}
|
||||
float _sqr(vec2 p, vec2 s)
|
||||
{
|
||||
vec2 l = abs(p)-s;
|
||||
return max(l.x, l.y);
|
||||
}
|
||||
float _cir(vec2 uv, float sz)
|
||||
{
|
||||
return length(uv)-sz;
|
||||
}
|
||||
|
||||
float _loz(vec2 uv,float sz)
|
||||
{
|
||||
return lenny(uv)-sz;
|
||||
}
|
||||
vec2 _min(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x < b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
vec2 _max(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x > b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
// To replace missing behavior in veda
|
||||
vec4 textureRepeat(sampler2D sampler, vec2 uv)
|
||||
{
|
||||
return texture2D(sampler, mod(uv, vec2(1.)));
|
||||
}
|
||||
|
||||
#endif // !TOOLS_INCLUDE
|
||||
|
||||
|
||||
|
||||
vec2 map(vec3 p)
|
||||
{
|
||||
vec2 acc = vec2(10000., -1.);
|
||||
|
||||
p.xy *= r2d(sin(time*.3)*.5);
|
||||
|
||||
vec3 pt = p+vec3(0., 0., time);
|
||||
vec3 opt = pt;
|
||||
vec3 repl = vec3(5.,5.,10.);
|
||||
pt = mod(pt+repl*.5,repl)-repl*.5;
|
||||
float tube = length(pt.xy)-.1;
|
||||
tube = max(tube, sin(pt.z+time*70.));
|
||||
tube = max(tube, -(length(opt.xy)-25.));
|
||||
acc = _min(acc, vec2(tube, 2.));
|
||||
|
||||
|
||||
vec3 pc = p+vec3(sin(time)*vec3(1.,2.,3.))+vec3(0.,0.,time*100.);
|
||||
vec3 repc = vec3(20.);
|
||||
vec3 idc = floor((pc+repc*.5)/repc);
|
||||
pc = mod(pc+repc*.5,repc)-repc*.5;
|
||||
pc.xy *= r2d(pc.z);
|
||||
|
||||
float cucu = _cucube(pc, vec3(1.), vec3(.01));
|
||||
// oui ma variable s'appelle cucu et alors ?
|
||||
cucu = length(pc.xz)-.5;
|
||||
cucu = max(cucu, -(length(pc.xz)-2.));
|
||||
acc = _min(acc, vec2(cucu, 2.));
|
||||
|
||||
p += vec3(sin(time), -3.+cos(time*.33), 0.);
|
||||
vec3 pu = p;
|
||||
pu.y = abs(pu.y);
|
||||
pu.y += 2.2;
|
||||
float ufo = length(pu)-3.;
|
||||
acc = _min(acc, vec2(ufo, 0.));
|
||||
|
||||
float glass = length(p-vec3(0.,-.5,0.))-.7;
|
||||
acc = _min(acc, vec2(glass, 1.));
|
||||
|
||||
vec3 pl = p-vec3(0.,-.3,0.);
|
||||
float an = atan(pl.z, pl.x)+time;
|
||||
float repa = PI*2./12.;
|
||||
|
||||
float sector = mod(an+repa*.5,repa)-repa*.5;
|
||||
pl.xz = vec2(sin(sector), cos(sector))*length(pl.xz);
|
||||
float light = length(pl-vec3(0.,0.,1.8))-.2;
|
||||
acc = _min(acc, vec2(light, 2.));
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
||||
vec3 accCol;
|
||||
vec3 trace(vec3 ro, vec3 rd)
|
||||
{
|
||||
accCol = vec3(0.);
|
||||
vec3 p = ro;
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
vec2 res = map(p);
|
||||
if (res.x < 0.01)
|
||||
return vec3(res.x, distance(p, ro), res.y);
|
||||
accCol += vec3(.5,.2,.9)*(1.-sat(res.x/2.5))*.05;
|
||||
accCol += mix(0.0, 0.01, pow(fract((time + 0.05 * sin(0.5 * time)) * 4.0), 0.5));
|
||||
p+= rd*res.x;
|
||||
}
|
||||
return vec3(-1.);
|
||||
}
|
||||
|
||||
vec3 getNorm(vec3 p, float d)
|
||||
{
|
||||
vec2 e = vec2(0.01, 0.);
|
||||
return normalize(vec3(d) - vec3(map(p-e.xyy).x, map(p-e.yxy).x, map(p-e.yyx).x));
|
||||
}
|
||||
vec3 getMat(vec3 p, vec3 n, vec3 rd, vec3 res)
|
||||
{
|
||||
vec3 col = n*.5+.5;
|
||||
|
||||
if (res.z == 1.)
|
||||
{
|
||||
vec3 a = vec3(1.,.1,.2)*1.5;
|
||||
vec3 b = vec3(1.,.1,.2)*3.5;
|
||||
col = mix(a, b, (sin(p.y+time*13.)));
|
||||
col.xy *= r2d(p.x+time);
|
||||
col = abs(col);
|
||||
col *= .5;
|
||||
}
|
||||
if (res.z == 2.)
|
||||
{
|
||||
col = vec3(1.);
|
||||
}
|
||||
if (res.z == 3.)
|
||||
{
|
||||
col = vec3(0.1);
|
||||
}
|
||||
return col;
|
||||
}
|
||||
|
||||
vec3 rdrenv(vec3 rd)
|
||||
{
|
||||
float an2 = atan(rd.y, rd.x);
|
||||
float repb = PI*2./12.;
|
||||
float sector = mod(an2+repb*.5,repb)-repb*.5;
|
||||
rd.xy = vec2(sin(sector), cos(sector))*length(rd.xy);
|
||||
|
||||
|
||||
rd *= .5;
|
||||
float an = atan(rd.y, rd.x);
|
||||
vec3 col = vec3(1.)*FFT(abs(rd.x*length(rd.xy))*2.)*1.;
|
||||
col += .2*vec3(1.)*sin(an*100.)*sat(sin(length(rd.xy)*100.-time*30.));
|
||||
|
||||
return .1*col * vec3(sin(time)*.3+.7, .5,length(rd.xy))*(1.-sat(length(rd.xy)*1.5));
|
||||
}
|
||||
|
||||
vec3 rdr(vec2 uv)
|
||||
{
|
||||
float rr = 0.0;
|
||||
float aa = atan(uv.y, uv.x);
|
||||
if (length(uv + mix(-0.5, 0.1, (pow(fract(2.0 * time), 0.5)) + mix(-0.5, 0.1, pow(fract(20.0 * time), 0.5)) * 0.1) * sin(10.0 * aa)) < 0.3) {
|
||||
uv.y *= -1.0;
|
||||
rr = 1.0;
|
||||
}
|
||||
|
||||
uv *= r2d(time*.13);
|
||||
vec3 ro = vec3(2, 0., -10.);
|
||||
vec3 ta = vec3(0.,0.,0.);
|
||||
vec3 rd = normalize(ta-ro);
|
||||
rd = getCam(rd, uv);
|
||||
vec3 col = vec3(0.);
|
||||
|
||||
|
||||
uv.x -= sign(uv.x)*abs(uv.y*.5);
|
||||
float th = 0.1 * pow(fract(1.0 - time), 0.5) * sin(40.0 * length(uv)) * sin(time) * 1.1;
|
||||
float c = cos(th);
|
||||
float s = sin(th);
|
||||
rd.xy = mat2(c, s, -s, c) * rd.xy;
|
||||
col = rdrenv(rd);
|
||||
|
||||
vec3 res = trace(ro, rd);
|
||||
vec3 acc = accCol;
|
||||
if (res.y > 0.)
|
||||
{
|
||||
vec3 p = ro + rd*res.y;
|
||||
vec3 n = getNorm(p, res.x);
|
||||
col = getMat(p, n, rd, res);
|
||||
if (res.z == 3.)
|
||||
{
|
||||
vec3 refl = normalize(reflect(rd, n)
|
||||
+(vec3(rand(), rand(), rand())-.5)*.0);
|
||||
vec3 resrefl = trace(p+n*0.01, refl);
|
||||
if (resrefl.y > 0.)
|
||||
{
|
||||
vec3 prefl = p+n*0.01+refl*resrefl.y;
|
||||
vec3 nrefl = getNorm(prefl, resrefl.x);
|
||||
col += getMat(prefl, nrefl, refl, resrefl);
|
||||
vec3 refl = normalize(reflect(rd, n));
|
||||
if (res.z == 1.)
|
||||
col += rdrenv(refl);
|
||||
}
|
||||
}
|
||||
}
|
||||
col += accCol*FFT(.1)*5.;
|
||||
|
||||
float ff = pow(fract(2.0 * time + 1.0), 0.5) * 0.1;
|
||||
vec3 col2 = mix(col, col * 0.0, ff);
|
||||
col = mix(col2, vec3(0.4, 0.5, 1.0), rr);
|
||||
return col;
|
||||
}
|
||||
vec3 dunno(vec2 uv, vec3 col)
|
||||
{
|
||||
uv *= r2d(sin(length(uv)*3.+time*.2));
|
||||
float an = atan(uv.y, uv.x);
|
||||
float repa = PI*2./12.;
|
||||
float id = floor((an+repa*.5)/repa);
|
||||
float sector = mod(an+repa*.5,repa)-repa*.5;
|
||||
uv = vec2(sin(sector), cos(sector))*length(uv);
|
||||
vec2 nuv = uv-vec2(0.,.5+.1*sin(time*.5+id));
|
||||
float body = _sqr(nuv, vec2(.05,.2));
|
||||
nuv.x = abs(nuv.x);
|
||||
float eye = length((nuv-vec2(.02, -0.15))/vec2(1.,abs(sin(time*4.+id))))-.01;
|
||||
|
||||
col = mix(col, vec3(0.), 1.-sat(body*400.));
|
||||
col = mix(col, vec3(0.,1.,1.), 1.-sat(eye*400.));
|
||||
return col;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 ouv = gl_FragCoord.xy / resolution.xy;
|
||||
vec2 uv = (gl_FragCoord.xy-.5*resolution.xy) / resolution.xx;
|
||||
_seed = time+length(uv)+uv.x*10.+hash11(uv.y);
|
||||
uv += (vec2(rand(), rand())-.5)*.05*sat(length(uv)-.15);
|
||||
vec3 col = rdr(uv);
|
||||
col = dunno(uv, col);
|
||||
col *= (1.-sat(length(uv)*2.));
|
||||
col *= 2.;
|
||||
// col *= 1.-sat((abs(uv.x)-.0)*100.);
|
||||
col = mix(col, texture2D(backbuffer, ouv).xyz, 0.5);
|
||||
gl_FragColor = vec4(col, 1.0);
|
||||
}
|
BIN
2023-04-26_FabriqueACookie07/alt144.png
Normal file
BIN
2023-04-26_FabriqueACookie07/alt144.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 MiB |
114
2023-04-26_FabriqueACookie07/flopine.glsl
Normal file
114
2023-04-26_FabriqueACookie07/flopine.glsl
Normal file
@ -0,0 +1,114 @@
|
||||
#version 410 core
|
||||
|
||||
uniform float fGlobalTime; // in seconds
|
||||
uniform vec2 v2Resolution; // viewport resolution (in pixels)
|
||||
uniform float fFrameTime; // duration of the last frame, in seconds
|
||||
|
||||
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 texPreviousFrame; // screenshot of the previous frame
|
||||
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 hr vec2(1.,sqrt(3.))
|
||||
|
||||
#define cyl(p,r,h) max(length(p.xy)-r, abs(p.z)-h)
|
||||
#define PI acos(-1.)
|
||||
#define TAU (2.*PI)
|
||||
#define rot(a) mat2(cos(a),sin(a),-sin(a),cos(a))
|
||||
|
||||
#define time fGlobalTime
|
||||
|
||||
#define hash21(x) fract(sin(dot(x,vec2(234.1, 381.5)))*1364.45)
|
||||
|
||||
#define pal(t,c) (vec3(.5)+vec3(.5)*cos(TAU*(c*t+vec3(0.1, .36, .64))))
|
||||
|
||||
#define hex(p) max(abs(p.x),dot(abs(p),normalize(hr)))
|
||||
|
||||
#define swi floor(sin(time*PI)+1.)
|
||||
|
||||
|
||||
vec4 hexgrid (vec2 uv)
|
||||
{
|
||||
vec2 ga = mod(uv,hr)-hr*.5, gb=mod(uv-hr*.5,hr)-hr*.5, guv=(length(ga)<length(gb))?ga:gb,
|
||||
gid = uv-guv;
|
||||
return vec4(guv,gid);
|
||||
}
|
||||
|
||||
void moda(inout vec2 p, float rep)
|
||||
{
|
||||
float per = TAU/rep;
|
||||
float a = atan(p.y,p.x);
|
||||
a = mod(a,per)-per*.5;
|
||||
p = vec2(cos(a),sin(a))*length(p);
|
||||
}
|
||||
|
||||
void mo(inout vec2 p, vec2 d)
|
||||
{
|
||||
p = abs(p)-d;
|
||||
if(p.y>p.x)p=p.yx;
|
||||
}
|
||||
|
||||
float SDF (vec3 p)
|
||||
{
|
||||
p.z += time*2.;
|
||||
p.x += sin(p.z*2.)*.5;
|
||||
p.y += cos(p.z*1.5)*.25;
|
||||
|
||||
p.xy *= rot(p.z*.25);
|
||||
float r = mix(2., 8., sin(time)*.5+.5);
|
||||
moda(p.xy, r);
|
||||
p.x -= 2.;
|
||||
return cyl(p, 1., 1e10);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = (2.*gl_FragCoord.xy - v2Resolution.xy)/v2Resolution.y;
|
||||
vec2 uu = gl_FragCoord.xy/v2Resolution.xy;
|
||||
|
||||
uv *= rot(time);
|
||||
|
||||
if(swi>.5) mo(uv,vec2(.1));
|
||||
|
||||
vec2 up = uv;
|
||||
up += vec2(cos(time),sin(time))*.5;
|
||||
moda(up,5.);
|
||||
vec4 hg = hexgrid(up*3.-time);
|
||||
uv += smoothstep(0.35,0.5,hex(hg.xy))*.1;
|
||||
|
||||
float dither = hash21(uv);
|
||||
vec3 ro = vec3(0.001, 0.001, -3.), rd=normalize(vec3(uv,1.)),p=ro,
|
||||
col = vec3(0.);
|
||||
|
||||
|
||||
float shad = 0.;
|
||||
for(float i=.0; i<32.; i++)
|
||||
{
|
||||
float d = SDF(p);
|
||||
if (d<0.01)
|
||||
{
|
||||
shad = i/64.;
|
||||
//break;
|
||||
}
|
||||
d *= .9+dither*.01;
|
||||
d = max(0.025, abs(d)-0.025);
|
||||
p += d*rd;
|
||||
}
|
||||
|
||||
float t = length(ro-p);
|
||||
|
||||
col = mix(pal(p.z, vec3(.1+sin(time)*.5)),vec3(1.),shad*.05);
|
||||
col = mix(col, vec3(0.),1.-exp(-0.01*t*t));
|
||||
col = mix(col, pow(col,vec3(0.8,2.,.1)), length(uv)-.1);
|
||||
col = mix(col, 1.-col, step(.48,hex(hg.xy)));
|
||||
out_color = vec4(sqrt(col), 1.);
|
||||
out_color += texture(texPreviousFrame,uu )*.25;
|
||||
}
|
BIN
2023-04-26_FabriqueACookie07/flopine.png
Normal file
BIN
2023-04-26_FabriqueACookie07/flopine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 MiB |
132
2023-04-26_FabriqueACookie07/nusan.glsl
Normal file
132
2023-04-26_FabriqueACookie07/nusan.glsl
Normal file
@ -0,0 +1,132 @@
|
||||
#version 410 core
|
||||
|
||||
uniform float fGlobalTime; // in seconds
|
||||
uniform vec2 v2Resolution; // viewport resolution (in pixels)
|
||||
uniform float fFrameTime; // duration of the last frame, in seconds
|
||||
|
||||
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 texPreviousFrame; // screenshot of the previous frame
|
||||
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 time=mod(fGlobalTime, 300);
|
||||
|
||||
mat2 rot(float a) {
|
||||
float ca=cos(a);
|
||||
float sa=sin(a);
|
||||
return mat2(ca,sa,-sa,ca);
|
||||
}
|
||||
|
||||
float box(vec3 p, vec3 s) {
|
||||
p=abs(p)-s;
|
||||
return max(p.x, max(p.y,p.z));
|
||||
}
|
||||
|
||||
float planet(vec3 p, float size, float dist, float spd) {
|
||||
|
||||
p.xz *= rot(time * spd);
|
||||
vec3 p2=p;
|
||||
p.x-=dist;
|
||||
|
||||
float tt=length(vec2(length(p2.xz)-dist, p2.y))+0.1;
|
||||
return min(box(p, vec3(size)), tt);
|
||||
|
||||
}
|
||||
|
||||
vec3 rnd(vec3 p) {
|
||||
return fract(sin(p*234.545 + p.yzx*644.232 + p.zxy * 512.343)*656.232);
|
||||
}
|
||||
|
||||
float rnd(float t) {
|
||||
return fract(sin(t*343.656)*564.032);
|
||||
}
|
||||
|
||||
vec3 amb=vec3(0);
|
||||
|
||||
float camb(float d, vec3 col, float e, float f) {
|
||||
amb += col * e * f / (e + abs(d));
|
||||
return d;
|
||||
}
|
||||
|
||||
float curve(float t, float d) {
|
||||
t/=d;
|
||||
return mix(rnd(floor(t)), rnd(floor(t)+1), pow(smoothstep(0,1, fract(t)),10));
|
||||
}
|
||||
|
||||
float map(vec3 p) {
|
||||
|
||||
p.yz *= rot(-0.5 + time*0.2);
|
||||
|
||||
vec3 p2=p;
|
||||
p2.xz *= rot(time*0.3);
|
||||
p2.yz *= rot(time*0.4);
|
||||
|
||||
float ss = clamp(texture(texFFTSmoothed, 0.01).x*40 + 0.3, 0, 2);
|
||||
float d = camb(box(p2, vec3(ss)), vec3(1,0.7,0.3), 0.9, 0.15);
|
||||
|
||||
for(int i=0; i<5; ++i) {
|
||||
d = min(d, camb(planet(p, 0.1, rnd(i+0.5)*10+1, rnd(i+0.4)*2+1), abs(sin(rnd(i+0.6)*23+time*0.3+vec3(1,2,3))), 0.1, 0.5));
|
||||
}
|
||||
d = min(d, planet(p, 0.4, 14, 0.5));
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void cam(inout vec3 p) {
|
||||
|
||||
p.yz *= rot(sin(time*0.13)*0.4 + time*0.2 + curve(time, 0.8));
|
||||
p.xz *= rot(time*0.1+curve(time, 0.9));
|
||||
}
|
||||
|
||||
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 hyper=min(curve(time, 0.7),curve(time, 1.8));
|
||||
|
||||
uv *= 1 - 0.6*hyper*fract(time);
|
||||
|
||||
uv.x += (curve(time, 0.9)-0.5)*0.5;
|
||||
|
||||
vec3 col=vec3(0);
|
||||
|
||||
vec3 s=vec3(0,0,-20);
|
||||
vec3 r=normalize(vec3(uv, 1));
|
||||
|
||||
cam(s);
|
||||
cam(r);
|
||||
|
||||
vec3 p=s;
|
||||
for(int i=0; i<100; ++i) {
|
||||
float d=map(p);
|
||||
if(d<0.001) break;
|
||||
if(d>100) break;
|
||||
p+=r*d;
|
||||
}
|
||||
|
||||
float fog=1-clamp(length(p-s)/100,0,1);
|
||||
|
||||
//col += map(p-r) * fog;
|
||||
col += amb;
|
||||
|
||||
vec3 stars=vec3(4);
|
||||
stars *= smoothstep(0.9,1.0, rnd(floor(r*699)));
|
||||
stars *= smoothstep(0.9,1.0, rnd(floor(r*199)));
|
||||
col += stars;
|
||||
|
||||
col = mix(col, pow(texture(texPreviousFrame, gl_FragCoord.xy / v2Resolution.xy).xyz, vec3(3))*hyper*4, 0.5);
|
||||
//col *= 1.4-length(uv);
|
||||
out_color = vec4(col, 1);
|
||||
}
|
BIN
2023-04-26_FabriqueACookie07/nusan.png
Normal file
BIN
2023-04-26_FabriqueACookie07/nusan.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 MiB |
BIN
2023-04-26_FabriqueACookie07/z0rg.png
Normal file
BIN
2023-04-26_FabriqueACookie07/z0rg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
294
2023-04-26_FabriqueACookie07/z0rg_template.frag
Normal file
294
2023-04-26_FabriqueACookie07/z0rg_template.frag
Normal file
@ -0,0 +1,294 @@
|
||||
/*{ "camera": true,
|
||||
"audio":true }*/
|
||||
uniform sampler2D camera;
|
||||
|
||||
#ifndef TOOLS_INCLUDE
|
||||
#define TOOLS_INCLUDE
|
||||
|
||||
precision highp float;
|
||||
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
uniform sampler2D spectrum;
|
||||
uniform sampler2D midi;
|
||||
|
||||
uniform sampler2D backbuffer;
|
||||
|
||||
uniform sampler2D greyNoise;
|
||||
|
||||
float mtime; // modulated time
|
||||
|
||||
#define FFTI(a) time
|
||||
|
||||
#define sat(a) clamp(a, 0., 1.)
|
||||
#define FFT(a) texture2D(spectrum, vec2(a, 0.)).x
|
||||
|
||||
#define EPS vec2(0.01, 0.)
|
||||
|
||||
#define FFTlow (FFT(0.1) * MIDI_KNOB(0))
|
||||
#define FFTmid (FFT(0.5) * MIDI_KNOB(1))
|
||||
#define FFThigh (FFT(0.7) * MIDI_KNOB(2))
|
||||
#define PI 3.14159265
|
||||
#define TAU (PI*2.0)
|
||||
float hash11(float seed)
|
||||
{
|
||||
return fract(sin(seed*123.456)*123.456);
|
||||
}
|
||||
|
||||
float _cube(vec3 p, vec3 s)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
return max(l.x, max(l.y, l.z));
|
||||
}
|
||||
float _cucube(vec3 p, vec3 s, vec3 th)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
float cube = max(max(l.x, l.y), l.z);
|
||||
l = abs(l)-th;
|
||||
float x = max(l.y, l.z);
|
||||
float y = max(l.x, l.z);
|
||||
float z = max(l.x, l.y);
|
||||
|
||||
return max(min(min(x, y), z), cube);
|
||||
}
|
||||
float _seed;
|
||||
|
||||
float rand()
|
||||
{
|
||||
_seed++;
|
||||
return hash11(_seed);
|
||||
}
|
||||
|
||||
mat2 r2d(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
|
||||
|
||||
vec3 getCam(vec3 rd, vec2 uv)
|
||||
{
|
||||
vec3 r = normalize(cross(rd, vec3(0.,1.,0.)));
|
||||
vec3 u = normalize(cross(rd, r));
|
||||
return normalize(rd+(r*uv.x+u*uv.y)*2.);
|
||||
}
|
||||
|
||||
float lenny(vec2 v)
|
||||
{
|
||||
return abs(v.x)+abs(v.y);
|
||||
}
|
||||
float _sqr(vec2 p, vec2 s)
|
||||
{
|
||||
vec2 l = abs(p)-s;
|
||||
return max(l.x, l.y);
|
||||
}
|
||||
float _cir(vec2 uv, float sz)
|
||||
{
|
||||
return length(uv)-sz;
|
||||
}
|
||||
|
||||
float _loz(vec2 uv,float sz)
|
||||
{
|
||||
return lenny(uv)-sz;
|
||||
}
|
||||
vec2 _min(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x < b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
vec2 _max(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x > b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
// To replace missing behavior in veda
|
||||
vec4 textureRepeat(sampler2D sampler, vec2 uv)
|
||||
{
|
||||
return texture2D(sampler, mod(uv, vec2(1.)));
|
||||
}
|
||||
|
||||
#endif // !TOOLS_INCLUDE
|
||||
|
||||
|
||||
|
||||
vec2 map(vec3 p)
|
||||
{
|
||||
vec2 acc = vec2(10000., -1.);
|
||||
|
||||
p.xy *= r2d(sin(time*.3)*.5);
|
||||
|
||||
vec3 pt = p+vec3(0., 0., time);
|
||||
vec3 opt = pt;
|
||||
vec3 repl = vec3(5.,5.,10.);
|
||||
pt = mod(pt+repl*.5,repl)-repl*.5;
|
||||
float tube = length(pt.xy)-.1;
|
||||
tube = max(tube, sin(pt.z+time*70.));
|
||||
tube = max(tube, -(length(opt.xy)-25.));
|
||||
acc = _min(acc, vec2(tube, 2.));
|
||||
|
||||
|
||||
vec3 pc = p+vec3(sin(time)*vec3(1.,2.,3.))+vec3(0.,0.,time*100.);
|
||||
vec3 repc = vec3(20.);
|
||||
vec3 idc = floor((pc+repc*.5)/repc);
|
||||
pc = mod(pc+repc*.5,repc)-repc*.5;
|
||||
pc.xy *= r2d(pc.z);
|
||||
|
||||
float cucu = _cucube(pc, vec3(1.), vec3(.01));
|
||||
// oui ma variable s'appelle cucu et alors ?
|
||||
cucu = length(pc.xz)-.5;
|
||||
cucu = max(cucu, -(length(pc.xz)-2.));
|
||||
acc = _min(acc, vec2(cucu, 2.));
|
||||
|
||||
p += vec3(sin(time), -3.+cos(time*.33), 0.);
|
||||
vec3 pu = p;
|
||||
pu.y = abs(pu.y);
|
||||
pu.y += 2.2;
|
||||
float ufo = length(pu)-3.;
|
||||
acc = _min(acc, vec2(ufo, 0.));
|
||||
|
||||
float glass = length(p-vec3(0.,-.5,0.))-.7;
|
||||
acc = _min(acc, vec2(glass, 1.));
|
||||
|
||||
vec3 pl = p-vec3(0.,-.3,0.);
|
||||
float an = atan(pl.z, pl.x)+time;
|
||||
float repa = PI*2./12.;
|
||||
|
||||
float sector = mod(an+repa*.5,repa)-repa*.5;
|
||||
pl.xz = vec2(sin(sector), cos(sector))*length(pl.xz);
|
||||
float light = length(pl-vec3(0.,0.,1.8))-.2;
|
||||
acc = _min(acc, vec2(light, 2.));
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
||||
vec3 accCol;
|
||||
vec3 trace(vec3 ro, vec3 rd)
|
||||
{
|
||||
accCol = vec3(0.);
|
||||
vec3 p = ro;
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
vec2 res = map(p);
|
||||
if (res.x < 0.01)
|
||||
return vec3(res.x, distance(p, ro), res.y);
|
||||
accCol += vec3(.5,.2,.9)*(1.-sat(res.x/2.5))*.05;
|
||||
p+= rd*res.x;
|
||||
}
|
||||
return vec3(-1.);
|
||||
}
|
||||
|
||||
vec3 getNorm(vec3 p, float d)
|
||||
{
|
||||
vec2 e = vec2(0.01, 0.);
|
||||
return normalize(vec3(d) - vec3(map(p-e.xyy).x, map(p-e.yxy).x, map(p-e.yyx).x));
|
||||
}
|
||||
vec3 getMat(vec3 p, vec3 n, vec3 rd, vec3 res)
|
||||
{
|
||||
vec3 col = n*.5+.5;
|
||||
|
||||
if (res.z == 1.)
|
||||
{
|
||||
vec3 a = vec3(1.,.1,.2)*1.5;
|
||||
vec3 b = vec3(1.,.1,.2)*3.5;
|
||||
col = mix(a, b, (sin(p.y+time*13.)));
|
||||
col.xy *= r2d(p.x+time);
|
||||
col = abs(col);
|
||||
col *= .5;
|
||||
}
|
||||
if (res.z == 2.)
|
||||
{
|
||||
col = vec3(1.);
|
||||
}
|
||||
if (res.z == 3.)
|
||||
{
|
||||
col = vec3(0.1);
|
||||
}
|
||||
return col;
|
||||
}
|
||||
|
||||
vec3 rdrenv(vec3 rd)
|
||||
{
|
||||
float an2 = atan(rd.y, rd.x);
|
||||
float repb = PI*2./12.;
|
||||
float sector = mod(an2+repb*.5,repb)-repb*.5;
|
||||
rd.xy = vec2(sin(sector), cos(sector))*length(rd.xy);
|
||||
|
||||
|
||||
rd *= .5;
|
||||
float an = atan(rd.y, rd.x);
|
||||
vec3 col = vec3(1.)*FFT(abs(rd.x*length(rd.xy))*2.)*1.;
|
||||
col += .2*vec3(1.)*sin(an*100.)*sat(sin(length(rd.xy)*100.-time*30.));
|
||||
|
||||
return .1*col * vec3(sin(time)*.3+.7, .5,length(rd.xy))*(1.-sat(length(rd.xy)*1.5));
|
||||
}
|
||||
|
||||
vec3 rdr(vec2 uv)
|
||||
{
|
||||
uv *= r2d(time*.13);
|
||||
vec3 ro = vec3(2, 0., -10.);
|
||||
vec3 ta = vec3(0.,0.,0.);
|
||||
vec3 rd = normalize(ta-ro);
|
||||
rd = getCam(rd, uv);
|
||||
vec3 col = vec3(0.);
|
||||
|
||||
|
||||
uv.x -= sign(uv.x)*abs(uv.y*.5);
|
||||
col = rdrenv(rd);
|
||||
|
||||
vec3 res = trace(ro, rd);
|
||||
vec3 acc = accCol;
|
||||
if (res.y > 0.)
|
||||
{
|
||||
vec3 p = ro + rd*res.y;
|
||||
vec3 n = getNorm(p, res.x);
|
||||
col = getMat(p, n, rd, res);
|
||||
if (res.z == 3.)
|
||||
{
|
||||
vec3 refl = normalize(reflect(rd, n)
|
||||
+(vec3(rand(), rand(), rand())-.5)*.0);
|
||||
vec3 resrefl = trace(p+n*0.01, refl);
|
||||
if (resrefl.y > 0.)
|
||||
{
|
||||
vec3 prefl = p+n*0.01+refl*resrefl.y;
|
||||
vec3 nrefl = getNorm(prefl, resrefl.x);
|
||||
col += getMat(prefl, nrefl, refl, resrefl);
|
||||
vec3 refl = normalize(reflect(rd, n));
|
||||
if (res.z == 1.)
|
||||
col += rdrenv(refl);
|
||||
}
|
||||
}
|
||||
}
|
||||
col += accCol*FFT(.1)*5.;
|
||||
|
||||
return col;
|
||||
}
|
||||
vec3 dunno(vec2 uv, vec3 col)
|
||||
{
|
||||
uv *= r2d(sin(length(uv)*3.+time*.2));
|
||||
float an = atan(uv.y, uv.x);
|
||||
float repa = PI*2./12.;
|
||||
float id = floor((an+repa*.5)/repa);
|
||||
float sector = mod(an+repa*.5,repa)-repa*.5;
|
||||
uv = vec2(sin(sector), cos(sector))*length(uv);
|
||||
vec2 nuv = uv-vec2(0.,.5+.1*sin(time*.5+id));
|
||||
float body = _sqr(nuv, vec2(.05,.2));
|
||||
nuv.x = abs(nuv.x);
|
||||
float eye = length((nuv-vec2(.02, -0.15))/vec2(1.,abs(sin(time*4.+id))))-.01;
|
||||
|
||||
col = mix(col, vec3(0.), 1.-sat(body*400.));
|
||||
col = mix(col, vec3(0.,1.,1.), 1.-sat(eye*400.));
|
||||
return col;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 ouv = gl_FragCoord.xy / resolution.xy;
|
||||
vec2 uv = (gl_FragCoord.xy-.5*resolution.xy) / resolution.xx;
|
||||
_seed = time+length(uv)+uv.x*10.+hash11(uv.y);
|
||||
uv += (vec2(rand(), rand())-.5)*.05*sat(length(uv)-.15);
|
||||
vec3 col = rdr(uv);
|
||||
col = dunno(uv, col);
|
||||
col *= (1.-sat(length(uv)*2.));
|
||||
col *= 2.;
|
||||
// col *= 1.-sat((abs(uv.x)-.0)*100.);
|
||||
col = mix(col, texture2D(backbuffer, ouv).xyz, 0.5);
|
||||
gl_FragColor = vec4(col, 1.0);
|
||||
}
|
Reference in New Issue
Block a user