Adding la fabrique à cookie 03

This commit is contained in:
seb776 2022-12-17 17:28:30 +01:00
parent 17348b448a
commit a2c7429362
9 changed files with 572 additions and 0 deletions

22
2022-12-07/Readme.md Normal file
View File

@ -0,0 +1,22 @@
# Performances
On November 9, 2022 on [La fabrique à cookie 03](https://fb.me/e/2legCGjjq).
## Shaders
1. z0rg
![](https://raw.githubusercontent.com/CookieCollective/Live-Coding-Sources/master/2022-12-07/z0rg.png)
2. leon
![](https://raw.githubusercontent.com/CookieCollective/Live-Coding-Sources/master/2022-12-07/leon.png)
3. cosamentale
![](https://raw.githubusercontent.com/CookieCollective/Live-Coding-Sources/master/2022-12-07/cosamentale.png)
4. NuSan
![](https://raw.githubusercontent.com/CookieCollective/Live-Coding-Sources/master/2022-12-07/nusan.png)
5. Flopine
I'm so sorry we lost the source :(, this was a beautiful isometric landscape full of tiny little cubes and lovely colors :)
## Software
- [Atom](https://github.com/atom/atom)
- [Veda](https://github.com/fand/veda)
- [Bonzomatic](https://github.com/TheNuSan/Bonzomatic/)

BIN
2022-12-07/cosamentale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

BIN
2022-12-07/leon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 KiB

BIN
2022-12-07/nusan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 KiB

View File

@ -0,0 +1,95 @@
#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;
in vec2 out_texcoord;
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
#define PI acos(-1.)
#define rot(a) mat2(cos(a),-sin(a), sin(a),cos(a))
#define rep(p,c) p = mod(p, c)-c*.5
#define time fGlobalTime
float se;
float zl;
float rd(){return fract(sin(se+=1.)*3424.43);}
vec3 vr(){float sd = rd()*6.28;
float sa = rd();
float a = sqrt(1.-sa*sa);
vec3 rn = vec3(a*cos(sd),a*sin(sd),(sa-0.5)*2.);
return rn*sqrt(rd());}
float dl(vec3 p, float r){
p = pow(abs(p),vec3(r));
return pow(p.x+p.y+p.z,1/r);
}
float ld(vec3 p,vec3 a, vec3 b, float r){
vec3 pa = p-a;vec3 ba =b-a;
float h = clamp(dot(pa,ba)/dot(ba,ba),0.,1.);
return dl(pa-ba*h,10.)-r;}
float map(vec3 p){
float d2 = length(p-vec3(0.,20.*sign(sin(time*16.)),0.))-10.;
for(int i = 0; i < 7 ; i++){
p.xy *= rot(0.3+((time*1.9)*0.5+0.5));
p.yz *= rot(0.3+(sin(texture(texFFTIntegrated,1.).x*.6)*0.5+0.5));
p.x = abs(p.x)-1.2;
p -= 0.3;
}
zl = d2;
float d1 = ld(p, vec3(0.),vec3(0.,5.,0.),smoothstep(5.,0.,p.y)+(sin(p.y*4.)*0.5+0.5)*0.2);
return min(d2,d1);}
float rm (vec3 p, vec3 r){
float dd = 0.;
for (int i = 0; i < 40 ; i++){
float d = map(p);
if(dd>30.){dd=30.; break;}
if(d<0.01){break;}
p +=r*d;
dd += d;}
return dd;
}
vec3 nor(vec3 p){ vec2 e = vec2(0.01,0.);return normalize(map(p)-vec3(map(p-e.xyy),map(p-e.yxy),map(p-e.yyx)));}
void main(void)
{
vec2 uv = out_texcoord;
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
se = uv.x*v2Resolution.y+uv.y;
se += time;
vec3 p = vec3(0.,0.,-12.);
vec3 r = normalize(vec3(uv,1.));
float r1 = 0.;
float dd = 0.;
for(int i = 0; i<4; i++){
float d = rm(p,r);
if(i==0){ dd = d;}
if(step(0.4,zl)>0.){
vec3 pp = p + r*d;
vec3 n = nor(pp);
r = n * vr();
p = pp + 0.1* r;
}
else{r1 = 1.; break;}
}
float m = smoothstep(19.,18.,dd);
float d2 = max(r1,texture(texPreviousFrame,out_texcoord+vec2(0.001)).x*0.9);
out_color = vec4(vec3(r1+d2*mix(0.5,1.,1-m)),d2);
}

View File

@ -0,0 +1,68 @@
/*{ "camera": true, "audio": true }*/
uniform sampler2D camera;
uniform sampler2D backbuffer;
precision highp float;
uniform float time, volume;
uniform vec2 resolution;
uniform sampler2D spectrum;
uniform sampler2D midi;
float rng;
mat2 rot(float a){
float c=cos(a),s=sin(a); return mat2(c,s,-s,c);
}
#define repeat(p,r) (mod(p,r)-r/2.)
float map (vec3 p)
{
vec3 q = p;
float dist = 100.;
//p.z = repeat(p.z - time * .2, 2.);
float t = time*2. - p.z*.5;;
t = pow(fract(t), 10.) + floor(t);
t += sin(time*2.)*.1;
//t += q.z;
//t += rng*.1;
//t = 104.;
float tt = time * 1.;
tt = pow(fract(tt), 10.) + floor(tt);
float r = .0+.8*abs(sin(tt*2.+p.z*2.1));
//r = .5 + volume;
//r += rng * .1;
p.xy *= rot(time);
p.xz *= rot(time);
float a = 1.;
const float count = 8.;
for (float i = 0.; i < count; i++)
{
p.xz *= rot((t)*.4);
p.yz *= rot((t*4.)*.4);
p.x = abs(p.x)-r*a;
dist = min(dist, length(p)-.3*a);
a /= 1.2;
}
//dist = max(abs(dist), -length(q)+0.8);
return dist*.3;
}
void main() {
vec2 uv = (gl_FragCoord.xy-.5*resolution.xy) / resolution.xx;
vec2 ouv = gl_FragCoord.xy/resolution.xy;
vec3 pos = vec3(0,0,3);
vec3 ray = normalize(vec3(uv, -0.4));
rng = fract(sin(dot(uv, vec2(132.5,534.42124)))*12432.4214);
float shade = 0.;
const float count = 100.;
for (float i = count; i > 0.; --i) {
float dist = map(pos);
if (dist < 0.001) {
shade = i/count;
break;
}
pos += ray * dist;
}
vec3 col = vec3(1);
col = .95+.5*cos(vec3(1,2,3)*4.5+floor(pos.z*2.) + time + shade * 2.);
col *= shade*shade*shade;
gl_FragColor = vec4(col, 1.0);
}

View File

@ -0,0 +1,142 @@
#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;
in vec2 out_texcoord;
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
float time=mod(fGlobalTime, 300);
float box(vec3 p, vec3 s) {
p=abs(p)-s;
return max(p.x, max(p.y,p.z));
}
mat2 rot(float t) {
float ca=cos(t);
float sa=sin(t);
return mat2(ca,sa,-sa,ca);
}
vec3 rnd3(vec3 r) {
return fract(sin(r*362.574 + r.yzx*483.994 + r.zxy * 675.034)*422.455);
}
float rnd(float t) {
return fract(sin(t*273.944)*594.033);
}
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 smin(float a, float b, float h) {
float k=clamp((a-b)/h*0.5+0.5, 0, 1);
return mix(a,b,k) - h*k*(1-k);
}
float map(vec3 p) {
vec3 bp=p;
for(int i=0; i<4; ++i) {
p.xz *= rot(time*0.2 + i + curve(time, 1.4) + p.y*0.1);
p.xy *= rot(time*0.3 + i*i + curve(time, 1.7) + sin(p.z*0.1+time));
p=abs(p)-0.6-sin(curve(time, 0.3 + i*i*0.2))*1.4 - pow(abs(sin(curve(time, 0.5)*0.4)),3)*1.6;
}
float d = box(p, vec3(0.5,0.1, 2.7));
float ss=29*curve(time+p.y*0.2, 1)-length(bp)*10*curve(time+p.x*0.1, 1.4);
ss *= 0.1;
d = min(d, length(p.xz) - ss);
d = min(d, length(p.xy) - ss);
d = min(d, length(p.yz) - ss);
float d2=length(bp)-5 - curve(time+sin(p.z)+sin(p.y+time), 0.3) * 3;
d=max(d, -d2);
d = min(d, d2);
for(int i=0; i<3; ++i) {
bp.xy *= rot(0.1+time*0.3);
bp.xz *= rot(0.3+time*0.2);
bp.xz=abs(bp.xz)-6;
}
d=smin(d, length(bp.xz)-1, 16+15*sin(time));
return d;
}
void cam(inout vec3 p) {
p.xy *= rot(time*0.3);
p.xz *= rot(time*0.1);
}
void main(void)
{
vec2 uv = out_texcoord;
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
//uv.x *= 0.66;
uv.x -= 0.15;
float anim = floor(time)+pow(fract(time), 30);
uv = uv * rot(pow(length(uv),3.)+anim);
float l=fract(time)*500;
uv=floor(uv*l)/l;
time = mod(fGlobalTime*0.6, 300);
time += floor((length(uv)-time)*0.1)*100;
float oo=pow(curve(floor(pow(abs(uv.x),0.8)*6-time)+time*0.4,0.12), 3.0);
time += oo;
vec3 s=vec3(curve(time, 7)*16-8,0,-50);
vec3 r=normalize(vec3(uv, 0.2+curve(time, 9.2)));
cam(s);
cam(r);
float dit = mix(0.9,1.0, rnd3(vec3(uv, fract(time))).x);
vec3 col=vec3(0);
vec3 p=s;
for(int i=0; i<100; ++i) {
float d=abs(map(p));
if(d<0.01) {
//col += map(p-r);
d=0.1;
}
if(d>100) break;
p+=r*d*dit;
col += vec3(1,0.4,0.6 + sin(p.x+curve(time, 0.9)*3)) * 0.0005 / (0.5 * d);
}
float t2=time*0.3-length(uv)*3 + oo*0.3;
col.xz *= rot(t2);
col.xy *= rot(t2*0.7);
col = abs(col);
float fac = curve(time + length((uv-vec2(1,0)*rot(time))), 1.1);
col = mix(col, vec3(dot(col,vec3(0.333))), fac);
col = smoothstep(0,1,col);
col = pow(col, vec3(0.4545));
out_color = vec4(col, 1);
}

245
2022-12-07/shader_z0rg.glsl Normal file
View File

@ -0,0 +1,245 @@
precision highp float;
uniform float time;
uniform vec2 resolution;
uniform sampler2D spectrum;
uniform sampler2D midi;
uniform sampler2D greyTex;
uniform sampler2D cookieTex;
uniform sampler2D ziconTex;
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 hash(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 hash(_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)*3.);
}
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.)));
}
vec2 map(vec3 p)
{
vec2 acc = vec2(10000., -1.);
acc = _min(acc, vec2(length(p)-1., 0.));
return acc;
}
vec3 accCol;
vec3 trace(vec3 ro, vec3 rd)
{
accCol = vec3(0.);
vec3 p = ro;
for (int i = 0; i < 128; ++i)
{
vec2 res = map(p);
if (res.x < 0.01)
return vec3(res.x, distance(p, ro), res.y);
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, vec2 id)
{
vec3 col = n *.5+.5;
vec3 ldir = normalize(vec3(1.));
if (res.z == 0.)
{
col = vec3(.3,.1,.1)+mix(vec3(1.), vec3(.5,.6,.3), .5)*sat(dot(-rd, n));
vec3 p2 = p;
float speed = 2.;
float it = float(int(time));
float t=time*2.+length(id);
float hangle = clamp(sin(t)*2., -1.,1.);
p2.xz *= r2d((smoothstep(-1.,1.,hangle)-.5));
p2.yz *= r2d(sin(t*.3)*.5);
vec2 uv = p2.xy;
float border = abs(length(uv)-.4)-.2+.1*sin(time);
float eyemask = length(uv)-.5;
border = max(border, eyemask);
col = mix(col, vec3(0.), 1.-sat(eyemask*400.));
float an = atan(uv.y, uv.x);
vec2 uvi = vec2(an*.1, .05*length(uv));
vec3 rgb = vec3(0.);
vec3 iriscol = mix(vec3(0.,.4,.2), vec3(0.,0.5,0.8), textureRepeat(greyTex, uvi).x);
iriscol.yz *= r2d(textureRepeat(greyTex, id*.1).x*15.+time);
iriscol = abs(iriscol.zxy);
rgb = iriscol
*(pow(textureRepeat(greyTex, uvi*.5).x, 2.)+.5)
*pow(sat(-dot(rd, n)), 2.);
col = mix(col, rgb, 1.-sat(border*400.));
vec3 h = normalize(rd+ldir);
col += vec3(.2)*pow(sat(-dot(h, n)), 45.);
}
return col;
}
vec3 rdrback(vec2 uv)
{
vec2 ouv = uv;
vec3 col = vec3(0.);
float t = time*.1;
uv += vec2(sin(t), cos(t))*.25;
vec2 uv2 = vec2(atan(uv.y, uv.x)/PI, length(uv))*.25;
col = pow(textureRepeat(greyTex, uv2+vec2(0., -time*.125)).xxx, vec3(6.))*.45*vec3(.9,.2,.1);
col += vec3(.1,.2,.5)*pow(textureRepeat(greyTex, uv2*.5+vec2(0., -time*.0125)).xxx, vec3(16.))*.45;
col.xy *= r2d(time+13.*length(uv));
col = abs(col);
col *= 1.5;
return col.zxy*sat(length(ouv)*5.);
}
vec3 rdr(vec2 uv)
{
uv *= r2d(.5);
vec2 rep = vec2(.25);
vec2 id = floor((uv+rep*.5)/rep);
uv = mod(uv+rep*.5,rep)-rep*.5;
uv *= 1.-.2*sin(length(id)*10.+time);
vec3 ro = vec3(0.,0., -5.);
vec3 ta = vec3(sin(time*.5+id.y*3.)*.5,sin(time*.25+id.x*2.)*.5,0.);
vec3 rd = normalize(ta-ro);
rd = getCam(rd, uv);
vec3 col = vec3(0.);
col = rdrback(uv);
vec3 res = trace(ro, rd);
float depth = 100.;
if (res.y > 0.)
{
depth = res.y;
vec3 p = ro + rd*res.y;
vec3 n = getNorm(p, res.x);
col = getMat(p, n, rd, res, id);
float spec = .1;
vec3 refl = normalize(reflect(rd, n)+spec*(vec3(rand(), rand(), rand())-.5));
vec3 resrefl = trace(p+n*0.01, refl);
}
return col;
}
uniform sampler2D backbuffer;
void main() {
vec2 ouv = gl_FragCoord.xy / resolution.xy;
vec2 uv = (gl_FragCoord.xy-.5*resolution.xy) / resolution.xx;
//uv *= vec2(.66, 1.);
//uv -= vec2(.1,0.);
uv *= 1.+length(uv)*5.;
uv *= 1.;
_seed = time+textureRepeat(greyTex, uv).x;
vec3 col = rdr(uv);
col += pow(rdr(uv+(vec2(rand(), rand())-.5)*.05), vec3(2.));
col = sat(col);
col *= (1.-sat((length(uv)-.5)*2.));
col = mix(col, texture2D(backbuffer, ouv).xyz, .75);
// col += texture2D(ziconTex, (uv*4.+.5)).xyz;
gl_FragColor = vec4(col, 1.0);
}

BIN
2022-12-07/z0rg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB