From 6f00934e7a0e8364162f94ba2b4685cfd72e5166 Mon Sep 17 00:00:00 2001 From: Jonathan Giroux Date: Sun, 18 Apr 2021 22:00:00 +0200 Subject: [PATCH] Add 2021-04-16 --- 2021-04-16/01-audio.py | 14 +++ 2021-04-16/01-nusan.glsl | 122 ++++++++++++++++++++++ 2021-04-16/01-z0rg.glsl | 129 ++++++++++++++++++++++++ 2021-04-16/02-lechugafeliz.glsl | 91 +++++++++++++++++ 2021-04-16/02-wrighter.glsl | 173 ++++++++++++++++++++++++++++++++ 2021-04-16/03-tater.glsl | 91 +++++++++++++++++ 2021-04-16/03-z0rg.glsl | 121 ++++++++++++++++++++++ 2021-04-16/04-lechugafeliz.glsl | 105 +++++++++++++++++++ 2021-04-16/Readme.md | 20 ++++ 9 files changed, 866 insertions(+) create mode 100644 2021-04-16/01-audio.py create mode 100644 2021-04-16/01-nusan.glsl create mode 100644 2021-04-16/01-z0rg.glsl create mode 100644 2021-04-16/02-lechugafeliz.glsl create mode 100644 2021-04-16/02-wrighter.glsl create mode 100644 2021-04-16/03-tater.glsl create mode 100644 2021-04-16/03-z0rg.glsl create mode 100644 2021-04-16/04-lechugafeliz.glsl create mode 100644 2021-04-16/Readme.md diff --git a/2021-04-16/01-audio.py b/2021-04-16/01-audio.py new file mode 100644 index 0000000..3d4bdaf --- /dev/null +++ b/2021-04-16/01-audio.py @@ -0,0 +1,14 @@ +Clock.bpm = 110 + +p3 >> play("<( )( f--)>< ([nn]d)>").every(4, "stutter", dur=1/2, amp=0.5, pan=[-1, 1, 1], fmod=0.5, slide=2) + +p1 >> play(" a ") + +p2 >> prophet(P[[0, 2, 3, 2], 1, var([2, [5, 9]], [4, 8])] + P(var([1, -1], 32), 1), dur=var([8, 4], [32, 16]), amp=0.9, oct=4, spin=0, coarse=[0.1, 0, 0.2]) + +p4 >> sitar([-1, 1], amp=sinvar([0.6, 0.9], 16), dur=PDur(5, 12)*2, vib=0.1, lpf=1000).every(4, "stutter", 2, pan=[-1, 1]) + +p5 >> orient(p4.pitch, dur=[1/2, 1], amp=0.1, room=[0.5, 1], mix=0.3, blur=[0, 0], hpf=100).every(8 ,"reverse").stop() + +p8 >> bug([[-1, 2], -2, (1, [3, [4, 8, 12], 1])], amp=0.6, dur=0, pan=sinvar([-0.2, 0.2], 8), tremolo=2).every(16, "stutter", fmod=Cycle([1, 2]), pan=[1, -1], dur=5, echo=[1, 2]).stop() + diff --git a/2021-04-16/01-nusan.glsl b/2021-04-16/01-nusan.glsl new file mode 100644 index 0000000..6b09b81 --- /dev/null +++ b/2021-04-16/01-nusan.glsl @@ -0,0 +1,122 @@ +#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 texRevision; +uniform sampler2D texTex1; +uniform sampler2D texTex2; +uniform sampler2D texTex3; +uniform sampler2D texTex4; + +// hello laval virtual ! +#define time fGlobalTime + +layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything + +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 rnd(float a) { + return fract(sin(a*452.511)*714.712); +} + +float curve(float t, float d) { + t/=d; + return mix(rnd(floor(t)), rnd(floor(t)+1), pow(smoothstep(0,1,fract(t)),10)); +} + +vec3 add=vec3(0); +float map(vec3 p) { + + + float t2=time*.3 + sin(p.y*.3+time); + p.xz *= rot(t2); + p.yz *= rot(t2*1.3); + + + vec3 bp=p; + + for(int i=0; i<7; ++i) { + float t=time*.3 + i; + p.yz *= rot(t*.7 + curve(time, 1.3)*3.2); + p.xz *= rot(t + curve(time, 1.1)*3.2); + p.xz=abs(p.xz); + p.xz-=0.4+curve(time, 3); + } + + float d = box(p, vec3(.3)); + + add += vec3(0.5,1,.2) * 0.01/(0.1 + abs(d)); + + float d2 = length(p.xz)-.1; + add += vec3(0.5,.7,2) * 0.01/(0.1 + abs(d2)); + + bp.xy=abs(bp.xy)-3.9; + bp.xy=abs(bp.xy)-0.9; + float d3 = length(bp.xy)-.2-curve(bp.z+time*3.,.1)*.2; + add += vec3(1,.4,.2) * 0.07/(0.6 + abs(d3)); + + d=min(d,d2); + d=min(d,d3); + + d*=.7; + + 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); + + uv *= 1+curve(time-length(uv),.2)*.3; + + vec3 s=vec3(0,0,-17 - curve(time, 1)*70); + vec3 r=normalize(vec3(uv, 1)); + vec3 p=s; + + vec3 col=vec3(0); + + for(int i=0; i<100; ++i) { + float d=abs(map(p)); + if(d<.001) { + d=.1; + //break; + } + if(d>100.) break; + p+=r*d; + + } + col += add*.1; + float fog = 1-clamp(length(p-s)/100,0,1); + //col += map(p-r)*fog; + + float a=time*.2 + uv.y*.5; + a += smoothstep(0.,.01,abs(uv.x)-.1-.2*curve(time+sin(uv.y*4.+time)*.2, .4)); + col.xz *= rot(a); + //col.yz *= rot(a*1.3); + col=abs(col); + + col=smoothstep(0,1,col); + col=pow(col, vec3(.4545)); + + out_color = vec4(col, 1); +} diff --git a/2021-04-16/01-z0rg.glsl b/2021-04-16/01-z0rg.glsl new file mode 100644 index 0000000..7e18d39 --- /dev/null +++ b/2021-04-16/01-z0rg.glsl @@ -0,0 +1,129 @@ +#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 sat(a) clamp(a, 0., 1.) + +float _sqr(vec2 uv, vec2 s) +{ + vec2 l = abs(uv)-s; + return max(l.x,l.y); +} +float _time; +mat2 r2d(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c);} + +vec4 map2d(vec2 p) +{ + float acc = 100.; + vec3 col; + for (int i = 0; i < 15; ++i) + { + float th = 0.01+0.01*float(i); + + float sqr = abs(_sqr(p*r2d(sin(float(i)+_time*.5)), vec2(.05)*float(i+.5)))-th; + if (sqr < 0.) + { + + if (i == 0) + col = vec3(1.,1.,1.); + if (i == 1) + col = vec3(1.,.5,0.5); + if (i == 2) + col = vec3(1.,.5,0.8); + if (i == 3) + col = mix(vec3(.5), vec3(1.,.9,0.8), sat(sin((p.x+p.y)*155.+_time)*50.)); + } + acc = min(acc, sqr); + } + return vec4(acc, col); +} + +vec3 getCam(vec3 rd, vec2 uv) +{ + float fov = 1.; + vec3 r = normalize(cross(rd, vec3(0.,1.,0.))); + vec3 u = normalize(cross(rd, r)); + return normalize(rd+fov*(r*uv.x+u*uv.y)); +} +float _cube(vec3 p, vec3 s) +{ + vec3 l = abs(p)-s; + l.xy *= r2d(_time); + l = abs(l)-s; + l.xz *= r2d(_time); + return max(l.x, max(l.y,l.z)); +} +vec2 map(vec3 p) +{ + p.xy *= r2d(_time); + p.xz *= r2d(_time*.5); + vec2 cube = vec2(_cube(p, vec3(.5)), 0.); + return cube; +} + +vec3 trace(vec3 ro, vec3 rd, int steps) +{ + vec3 p = ro; + for (int i = 0; i< steps;++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 norm(float d, vec3 p) +{ + 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 rdr(vec2 uv) +{ + float shp = 400.; + vec3 col = vec3(.1)+texture(texTex2, uv).xxx*.1; + vec4 res = map2d(uv*2.); + col = mix(col, res.yzw, 1.-sat(shp*res.x)); + + vec3 ro = vec3(0.,0.,-5.); + vec3 ta = vec3(0.,0.,0.); + vec3 rd = normalize(ta-ro); + + rd = getCam(rd, uv); + vec3 r = trace(ro,rd,256); + if (r.y > 0.) + { + vec3 p = ro +rd*res.y; + vec3 n = norm(res.x, p); + + col += mix(vec3(1.,.5,.25), vec3(p.xzy), p.x); + } + + return col; +} + +void main(void) +{ + _time = fGlobalTime; + vec2 uv = (gl_FragCoord.xy-vec2(.5)*v2Resolution.xy)/v2Resolution.xx; + vec3 col; + col = rdr(uv); + col = rdr(uv*.5)*.5; + col = rdr(uv*vec2(-1.,1.)*2.*mix(1.,1.5,mod(_time, 1.5))); + out_color = vec4(col, 1.); +} diff --git a/2021-04-16/02-lechugafeliz.glsl b/2021-04-16/02-lechugafeliz.glsl new file mode 100644 index 0000000..35e1ede --- /dev/null +++ b/2021-04-16/02-lechugafeliz.glsl @@ -0,0 +1,91 @@ +#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 texLogo; +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 rot(a) mat2(cos(a), sin(a), -sin(a), cos(a)) +float rand(float x){ return fract(fract(sin(x*234.2342))*234.234);} +float c(float t, float s){ + t/=s; + return mix(rand(floor(t)), rand(floor(t)), smoothstep(0., 1., pow(fract(t), 20.))); +} +float t= mod(fGlobalTime, 40.); +float tri(vec3 p, vec3 s){ + p.xz=abs(p.xz); + vec2 a = vec2(0.4); + return max(max(p.y-s.y, dot(p.xy, a)), p.z); +} +float g1,g2; +float m(vec3 p){ + vec3 p1=p; + float ii; + for(float i = 8;i--;){ + p1.xz*=rot(t*.234); + p1.yz*=rot(t*.23244); + p1=abs(p1)-40.-i; + ii+=i; + } + float a=tri(p1, vec3(1.))*.15; + g1+=.5/(.1+a*a); + vec3 p2 = p; + p2=abs(p2)-5.; + p2=(fract(p2/100.+.5)-.5)*100.; + p2=abs(p2)-.5; + float cc=max(max(p2.z, p2.x), p2.z); + a=min(1., cc); + g2+=.1/(1.+cc*cc); + vec3 p3=p; + float tt=c(t*.5, 10.)*2.+t; + p3.xz*=rot(tt*.7); + p3.xy*=rot(tt*.5); + p3=abs(p3)-5.; + + float cc2=max(max(p3.x, p3.z), p3.y); + a=min(a, cc2); + return a; +} +float ao(vec3 n, vec3 p, float d){ + float o; + for(float i=8;i--;) + o+=clamp(m(p+n*d*i*i)/d*i*i, 0., 1.); + return o; +} + +void cam(inout vec3 p){ + p.xz*=rot(t*.17); +} +vec3 nm(vec3 p){const vec2 e = vec2(0.01, 0.); return m(p)-normalize(vec3(m(p-e.xyy), m(p-e.yxy), m(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); + + float fov = 1.+length(uv)*sin(t)*.25; + vec3 s = vec3(0.001, 0.00001, -55.), r = normalize(vec3(uv, fov)); + cam(s), cam(r); + vec3 p=s; float d; + vec3 n=vec3(.25); + float i; + for(i=64.; i--;) if(d=m(p),p+=d*r,abs(d) < .001) n*=nm(p); + n=nm(p); + n*=ao(n,p,1.)*.24; + + out_color = vec4(vec3(g2*vec3(0., 0.234, 0.3435)+g1*vec3(0.234, 0., .134)-(max(length(p-s)/100., 0.)* + 1-dot(n,normalize(vec3(-10., -20., -1e5))*0.00001))), 1.); +} diff --git a/2021-04-16/02-wrighter.glsl b/2021-04-16/02-wrighter.glsl new file mode 100644 index 0000000..759ef00 --- /dev/null +++ b/2021-04-16/02-wrighter.glsl @@ -0,0 +1,173 @@ +#version 410 core + +uniform float fGlobalTime; // in seconds +#define iTime fGlobalTime +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; +uniform sampler2D texTex5; + +layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything +#define pmod(p,a) mod(p ,a) - 0.5*a +#define rot(a) mat2(cos(a),-sin(a),sin(a),cos(a)) +float nois(vec3 _p){ + vec4 p = vec4(_p,1 + iTime); + float n = 0.; + float amp = 1.; + for(int i = 0; i < 5; i++){ + + p.xz *= rot(0.5); + p.wz *= rot(0.5); + p.yz *= rot(0.5); + n += dot(sin(p),cos(p))*amp; + + amp *= 0.7; + p *= 1.5; + } + return n; +} +float N = 0.; + +vec3 pal(float m){return pow(0.5 + 0.5*sin(m + vec3(-0.5,-0.,0.5)),vec3(0.2));} + +float map(vec3 p){ + N = nois(p*4.)*0.1; + float d = 10e5; + for(float i = 0.; i < 5.; i++){ + p.xz *= rot(0.4 + (iTime + sin(iTime + i*11.5))*0.2); + p.yz *= rot(0.4 + (iTime + sin(iTime + i))*0.2); + d = min(d, length(p.xz) - 0.04 - N*0.5); + + } + return d; +} + +float sdBox(vec2 p, vec2 s){p = abs(p) -s; return max(p.x,p.y);} +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 col = vec3(1); + + float pxsz = fwidth(uv.x); + { + vec3 c = vec3(0.6,0.2,0.7) + sin(uv.xyx*20.)*0.3; + + float md = 0.1; + + vec2 p = uv; + p.x += (sin(iTime) + iTime+ cos(iTime*1.5))*0.2; + vec2 id = floor(p/md); + float m = (sin(id.x + iTime + cos(id.y)*3.)); + c = pal(uv.x + id.x); + p = pmod(p,md); + p *= rot(m + iTime); + + float d = abs(p.x); + d = min(d,abs(p.y)); + + d = max(d,abs(length(p)- m*md*0.5) - 0.01); + + col = mix(col,c,smoothstep(pxsz,0.,d - 0.003)); + } + { + vec3 c = vec3(0.6,0.2,0.7) + sin(uv.xyx*20.)*0.3; + + float md = 0.2; + + vec2 p = uv; + p += 0.05; + p.x += (sin(iTime) + iTime+ cos(iTime*1.5))*0.1; + vec2 id = floor(p/md); + float m = (sin(id.x + iTime + cos(id.y)*3.)); + c = pal(uv.x + id.x); + p = pmod(p,md); + //p *= rot(m + iTime); + + float d = abs(p.x); + d = min(d,abs(p.y)); + + //d = max(d,abs(length(p)- m*md*0.5) - 0.01); + + col = mix(col,c,smoothstep(pxsz,0.,d - 0.0001)); + } + + + + { + vec3 p = vec3(0,0,-2); + vec3 rd = normalize(vec3(uv,1)); + bool hit = false; float t= 0.; + + for(int i = 0; i < 60; i++){ + float d = map(p); + if(d < 0.01){ + hit = true; + break; + } + + p += rd*d; + } + if(hit){ + //col = 1.-col; + col = vec3(1); + col = mix(col,pow(pal(p.x + p.y + sin(p.x)),vec3(2.)),nois(p*4.)*0.6); + } + } + + #define xor(a,b,c) min(max(a + c,-(b)),max(b,-(a))) + { + vec2 p = uv; + + float d = 10e5; + for(int i = 0; i < 5; i++){ + float m = sin(iTime+i + cos(iTime+i)); + vec2 q = p + vec2(m,0.)*0.2; + d = xor(d,abs(length(q) - length(sin(iTime+m))*0.2 ) - 0.01*m,-0.01); + } + col = mix(col,1.2-col,smoothstep(pxsz,0.,d)); + + } + + { + vec2 p = uv; + p.y = abs(p.y) - 0.45; + float id = floor(p.x/0.1+ iTime*4. + cos(iTime+ sign(uv.y)*2. - 1) + sign(uv.y)*2. - 1); + + float d = abs(p.t) - 0.1; + + + col = mix(col,1.2-col*pal(id),smoothstep(pxsz,0.,d)); + col = mix(col,1.2-col*pal(id*2.),smoothstep(pxsz,0.,abs(d) - 0.02)); + + + } + + { + vec2 p = uv; + //p.y = abs(p.x) - 0.45; + + float d = abs(p.x - 0.6) - 0.1; + d = sdBox(p.x - vec2(0.5,0.),vec2(0.1,0.3)); + + col = mix(col,1.-col*(0.6 + 0.5*pal(uv.y*4.)),smoothstep(pxsz,0.,d)); + //col = mix(col,1.2-col*pal(id*2.),smoothstep(pxsz,0.,abs(d) - 0.02)); + + + } + //col = 1. - col; + + col = pow(col,vec3(0.4545)); + out_color = vec4(col,1); +} diff --git a/2021-04-16/03-tater.glsl b/2021-04-16/03-tater.glsl new file mode 100644 index 0000000..fa643de --- /dev/null +++ b/2021-04-16/03-tater.glsl @@ -0,0 +1,91 @@ +#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 donut(vec3 p, vec2 t){ return length(vec2(length(p.xz)-t.x,p.y))-t.y;} +#define rot(a) mat2(cos(a),-sin(a),sin(a),cos(a)) + +vec2 Dist(vec3 p){ + vec2 a = vec2(donut(p,vec2(1,0.5)),2.0); + vec2 b = vec2(length(p+vec3(0,1.0-abs(sin(fGlobalTime))*3.0,0))-0.5,1.0); + b = (b.x < a.x) ? b:a; + //a = vec2(length(p+vec3(0,5.0,0))-0.5,3.0); + //b = (b.x < a.x) ? b:a; + return b; +} +vec2 Dist2(vec3 p){ + float t= mod(fGlobalTime,200.0); + t = fract(t)*fract(t)+floor(t); + vec3 p2 = p; + float modd = 45.0; + vec3 id = floor((p2+modd*0.5)/modd); + t+= id.x*2.0; + t+= id.z*2.0; + p2.yz*=rot(sin(t)*0.2); + p2.y +=sin(id.x+t)*12.0; + p2 = mod(p2+modd*0.5,modd)-modd*0.5; + for(int i = 0; i < 4; i++){ + p2 = abs(p2)-vec3(2,1,1); + p2.xy *=rot(0.5); + p2.zy *=rot(0.5+sin(t)*2.0); + p2.zx *=rot(0.5); + } + return Dist(p2); +} +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 t = mod(fGlobalTime,200.0); + + vec3 ro = vec3(t*3.0,0,-30); + vec3 rd = normalize(vec3(uv,1)); + + float dO = 0.0; + float shad = 0.0; + vec2 obj; + for(int i = 0; i <128; i++){ + vec3 p = ro + rd*dO; + obj = Dist2(p); + dO += obj.x; + if(obj.x <0.001|| dO>300.0){ + shad = float(i)/128.0; + break; + } + } + + vec3 col = vec3(0); + + if(obj.y == 1.0){ + shad= 1.0-shad; + col = vec3(shad)*vec3(0.2,0.5,0.8); + } + if(obj.y == 2.0){ + shad= shad; + col = vec3(shad)*vec3(0.8,0.2,0.9); + } + //if(obj.y == 3.0){ + // shad= shad; + // col = vec3(shad)*vec3(1)*3.0; + //} +col = mix(col,vec3(0),clamp(dO/300.0,0,1)); + + +out_color = vec4(col*2.0,0.0); +} diff --git a/2021-04-16/03-z0rg.glsl b/2021-04-16/03-z0rg.glsl new file mode 100644 index 0000000..d1379cc --- /dev/null +++ b/2021-04-16/03-z0rg.glsl @@ -0,0 +1,121 @@ +#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 sat(a) clamp(a, 0., 1.) +float _time; +mat2 r2d(float a) { float c = cos(a), s = sin(a); return mat2(c, -s,s,c);} +vec3 getCam(vec3 rd, vec2 uv) +{ + float fov = 1.; + vec3 r = normalize(cross(rd, vec3(0.,1.,0.))); + vec3 u = normalize(cross(rd, r)); + return normalize(rd+fov*(uv.x*r+uv.y*u)); +} + +float _cube(vec3 p, vec3 s) +{ + vec3 l = abs(p)-s; + l = abs(l)-s*.5; + l.z += sin(_time+p.y); + l.xy *= r2d(_time); + l = abs(l)-s*.25; + l.yz *= r2d(_time); + return max(l.x, max(l.y, l.z)); +} + +vec2 map(vec3 p) +{ + vec3 pc = p; + pc.xz *= r2d(_time); + pc.xy *= r2d(_time*.5); + vec2 cube = vec2(_cube(pc, vec3(1.)), 0.); + + return cube; +} + +vec3 trace(vec3 ro, vec3 rd, int steps) +{ + vec3 p = ro; + for (int i = 0; i < steps; ++i) + { + vec2 res = map(p); + if (res.x < 0.01) + return vec3(res.x, distance(p, ro), res.y); + p+= rd*res.x*.25; + } + return vec3(-1.); +} + +float lenny(vec2 v) +{ + return abs(v.x)+abs(v.y); +} + +vec3 rdr(vec2 uv) +{ + vec3 col; + + vec3 ro = vec3(0.,0.,-15.); + vec3 ta = vec3(0.,0.,0.); + vec3 rd = normalize(ta-ro); + rd = getCam(rd, uv); + + vec3 res = trace(ro, rd, 128); + if (res.y > 0.) + { + vec3 p = ro+rd*res.y; + + vec3 n = normalize(cross(dFdx(p), dFdy(p))); + col = sat(n*.5+.5)*pow(sat(dot(n, normalize(vec3(1.)))),5.); + col += vec3(1.)*distance(p, ro)*.05; + } + float borders = max(sin((uv.x+uv.y)*50.+_time*sign(uv.x)), -(abs(uv.x)-.4)); + vec3 rgb = mix(vec3(.25,.367,.96), vec3(.87,.15,.96), sat(sin(uv.y*10.)*.5+.5)); + col = mix(col, rgb, 1.-sat(borders*400.)); + + col += .5*vec3(1.)*pow(1.-sat(lenny(uv)),5.)*vec3(1.,2.,4.)*(uv.xyx*.5+.5+sat(sin(_time))); + return col; +} +vec3 rdr3(vec2 uv) +{ + vec3 col = rdr(uv)*.75; + uv *= r2d(_time); + + vec2 uv2 = uv; + float stp = 0.1; + uv2 = floor(uv/stp)*stp; + col += rdr(uv2*4.).zxy*.25*pow(sat(length(uv)),.5); +return col; +} +vec3 rdr2(vec2 uv) +{ + vec2 dir = normalize(vec2(1.)); + float str = 0.01*sin(uv.y*5.+_time*10.); + vec3 col; + col.r = rdr3(uv+dir*str).r; + col.g = rdr3(uv).g; + col.b = rdr3(uv-dir*str).b; + return col; +} + +void main(void) +{ + _time = fGlobalTime; + vec2 uv = (gl_FragCoord.xy-vec2(.5)*v2Resolution.xy)/v2Resolution.xx; + + vec3 col = rdr2(uv); + out_color = vec4(col, 1.); +} diff --git a/2021-04-16/04-lechugafeliz.glsl b/2021-04-16/04-lechugafeliz.glsl new file mode 100644 index 0000000..11feb8a --- /dev/null +++ b/2021-04-16/04-lechugafeliz.glsl @@ -0,0 +1,105 @@ +#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 texLogo; +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 t=mod(fGlobalTime, 50.); +float rand(float x){ return fract(sin(x*324.234)*234.234); } + +#define smin(a, b, k) min(a, b)-pow(max(k-abs(a-b),0.), k)*k*(1.0/6.0); +#define rot(a) mat2(cos(a), sin(a), -sin(a), cos(a)) +float c(float t, float s){ + t/=s; + return mix(rand(floor(t)), rand(floor(t+1)), pow(smoothstep(0., 1., fract(t)), 20.)); +} +float sb(vec3 p, vec3 s){ + p=abs(p)-s; + return max(max(p.y, p.x), p.z); +} +float m2(vec3 p){ + vec3 p1=p; + p1.xy=abs(p1.xy)-10.; + for(float i= 0; i < 4; i++){ + p1=abs(p1)-20; + p1.xy*=rot(t); + } + + vec3 p2=p; + float a=length(p1)-2.; + for(int i = 0; i < 3; i++){ + p2.xz*=rot(t*.2); + p2.yx*=rot(t*.345); + p2=smin(p2,6-p2,vec3(6.)); + } + float b= sb(p2, vec3(1.)); + + float d=b; + float m=mix(a, b, sin(t*2.)*.25-.5); + return min(d, m); + +} +float g1,g2; +void orbit(inout vec3 p1){ + const float rr=4.5; + p1.x+=sin(t)*rr; + p1.z+=cos(t)*rr; +} +float m(vec3 p){float d=m2(p); + vec3 p1=p; + + + p1=abs(p1)-5.; + orbit(p1); + const float ss= .1; + float esf=length(p1.yz)-ss; + g2+=.01/(.1+esf*.5); + vec3 p2=p.zxy; + orbit(p2); + float esf2=length(p2.xy)-ss; + g1+=.1/(1+esf2*esf2); + d=smin(d, esf, 0.2); + d=smin(d, esf2, 0.2); + return d; +} +void cam(inout vec3 p){p.xz*=rot(t*.5); p.yx*=rot(t*.435);} +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 s=vec3(0.0001, 0.001, -20.), r=normalize(vec3(uv, 1.)); + cam(s), cam(r); + vec3 p=s; + float i,d; + const float MAX=100.; + + for(i=MAX;i--;){ + d=m(p); + if(abs(d) < .0001 || d >MAX) break; + p+=d*r; + } + + vec3 col=vec3(0.); + col+=1-i/MAX; + vec3 c1 = vec3(0.234, 0.345, 0.1); + vec3 c2 = vec3(0.234, 0.345, 0.1); + c1.xy*=rot(t); + col+=g1*c1; + col+=g2*c2; + out_color = vec4(col,1.); +} diff --git a/2021-04-16/Readme.md b/2021-04-16/Readme.md new file mode 100644 index 0000000..f7a91ad --- /dev/null +++ b/2021-04-16/Readme.md @@ -0,0 +1,20 @@ +# Performances + +On April 16, 2021 on [Cookie Live Stream](https://youtu.be/UIGlDjnuUIY) as part of [Recto VRso exhibition](https://rectovrso.laval-virtual.com/). + +## Shader rounds + +1. NuSan & z0rg +2. LechugaFeliz & wrigther +3. Tater & z0rg +4. Lamogui & LechugaFeliz + +## Audio + +- Joseph +- Koltes + +## Software + +- [Bonzomatic](https://github.com/TheNuSan/Bonzomatic/) +- [FoxDot](https://foxdot.org/)