From 6435b432c13794986a659546ab7302f32008aabe Mon Sep 17 00:00:00 2001 From: Jonathan Giroux Date: Mon, 3 Dec 2018 20:55:48 +0100 Subject: [PATCH] Add 2012-12-01 --- 2018-12-01/01-elie.glsl | 81 +++++++++++++++++++ 2018-12-01/01-wsmind.glsl | 69 ++++++++++++++++ 2018-12-01/02-evvvvil.glsl | 98 +++++++++++++++++++++++ 2018-12-01/02-ponk.glsl | 116 +++++++++++++++++++++++++++ 2018-12-01/03-flopine.glsl | 143 +++++++++++++++++++++++++++++++++ 2018-12-01/03-lsdlive.glsl | 129 ++++++++++++++++++++++++++++++ 2018-12-01/04-eybor.glsl | 124 +++++++++++++++++++++++++++++ 2018-12-01/04-nusan.glsl | 158 +++++++++++++++++++++++++++++++++++++ 2018-12-01/05-ponk.glsl | 122 ++++++++++++++++++++++++++++ 2018-12-01/05-wsmind.glsl | 138 ++++++++++++++++++++++++++++++++ 2018-12-01/06-flopine.glsl | 122 ++++++++++++++++++++++++++++ 2018-12-01/06-nusan.glsl | 121 ++++++++++++++++++++++++++++ 2018-12-01/07-nusan.glsl | 152 +++++++++++++++++++++++++++++++++++ 2018-12-01/07-ponk.glsl | 106 +++++++++++++++++++++++++ 2018-12-01/Readme.md | 37 +++++++++ 15 files changed, 1716 insertions(+) create mode 100644 2018-12-01/01-elie.glsl create mode 100644 2018-12-01/01-wsmind.glsl create mode 100644 2018-12-01/02-evvvvil.glsl create mode 100644 2018-12-01/02-ponk.glsl create mode 100644 2018-12-01/03-flopine.glsl create mode 100644 2018-12-01/03-lsdlive.glsl create mode 100644 2018-12-01/04-eybor.glsl create mode 100644 2018-12-01/04-nusan.glsl create mode 100644 2018-12-01/05-ponk.glsl create mode 100644 2018-12-01/05-wsmind.glsl create mode 100644 2018-12-01/06-flopine.glsl create mode 100644 2018-12-01/06-nusan.glsl create mode 100644 2018-12-01/07-nusan.glsl create mode 100644 2018-12-01/07-ponk.glsl create mode 100644 2018-12-01/Readme.md diff --git a/2018-12-01/01-elie.glsl b/2018-12-01/01-elie.glsl new file mode 100644 index 0000000..6706b48 --- /dev/null +++ b/2018-12-01/01-elie.glsl @@ -0,0 +1,81 @@ +#version 410 core + +uniform float fGlobalTime; // in seconds +uniform vec2 v2Resolution; // viewport resolution (in pixels) + +uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq +uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients +uniform sampler1D texFFTIntegrated; // this is continually increasing +uniform sampler2D texChecker; +uniform sampler2D texNoise; +uniform sampler2D texTex1; +uniform sampler2D texTex2; +uniform sampler2D texTex3; +uniform sampler2D texTex4; + +layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything + +vec4 plas( vec2 v, float time ) +{ + float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 ); + return vec4(sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 ); +} + +float map(vec3 p) { + p.x *= p.z; + return length(p) - 0.1; +} + + +void main(void) +{ + vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); + vec2 uv0 = uv; + uv.x += smoothstep(0.95, 1.0, sin(fGlobalTime * 10.0)) * 0.1; + uv.x -= smoothstep(0.95, 1.0, sin(fGlobalTime * 25.33)) * 0.1; + uv -= 0.5; + uv /= vec2(v2Resolution.y / v2Resolution.x, 1); + + vec2 s = vec2(1.0, v2Resolution.y / v2Resolution.y) * 40.; + uv = round(uv * s) / s; + vec2 xy = fract(uv0 * s); + + vec3 p = vec3(0.0, 0.0, 5.0); + vec3 v = normalize(vec3(uv, -1.0)); + float i = 0.0; + for (; i < 1.0 ; i+=0.01) { + float d = map(p); + p += v * d; + } + + vec2 m; + m.x = atan(uv.x / uv.y) / 3.14; + m.y = 1 / length(uv) * .2; + float d = m.y; + + float f = texture( texFFT, d ).r * 100; + m.x += sin( fGlobalTime ) * 0.1; + m.y += fGlobalTime * 0.25; + + vec4 t = plas( m * 3.14, fGlobalTime ) / d; + t = clamp( t, 0.0, 1.0 ); + //out_color = vec4(i); + + float alpha = atan(uv.y, uv.x); + float aa = alpha * 0.01 ; + vec4 c0 = sin(aa) * vec4(1.0, 1.0, 0.0, 1.0) + cos(aa) * vec4(0.0, 1.0, 0.0, 1.0); + c0 = sin(aa * 0.05) * vec4(1.0, 0.0, 0.0, 0.0); + c0 += sin(aa * 0.1 + fGlobalTime * 0.001) * vec4(1.0, 0.5, 0.0, 0.0); + out_color = sin(c0 * (alpha + fGlobalTime) * 10.0); + + float tt = mod(fGlobalTime, 2.0) - 1.4; + tt += smoothstep(0.0, 1.0, sin(uv0.y * 10.0) * 0.2); + out_color += (smoothstep(0.1 + tt, 0.2 + tt, uv0.x) - smoothstep(0.3 + tt, 0.4 + tt, uv0.x)) * vec4(0.0, 0.5, 1.0, 1.0); + out_color -= (smoothstep(0.1 + tt * 2.0, 0.2 + tt * 2.0, uv0.x) - smoothstep(0.3 + tt * 2.0, 0.4 + tt * 2.0, uv0.x)) * vec4(0.0, 0.5, 0.5, 1.0); + + //out_color = f * 0.5 + pow(t, vec4(5.1)); + float rad = dot(xy - 0.5, xy - 0.5); + out_color *= pow(rad, 0.5); + float rad2 = rad + sin(fGlobalTime * uv0.x) * 0.2; + out_color += smoothstep(0.04, 0.02, rad2) * 0.2; +} diff --git a/2018-12-01/01-wsmind.glsl b/2018-12-01/01-wsmind.glsl new file mode 100644 index 0000000..0e9cd98 --- /dev/null +++ b/2018-12-01/01-wsmind.glsl @@ -0,0 +1,69 @@ +#version 410 core + +uniform float fGlobalTime; // in seconds +uniform vec2 v2Resolution; // viewport resolution (in pixels) + +uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq +uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients +uniform sampler1D texFFTIntegrated; // this is continually increasing +uniform sampler2D texChecker; +uniform sampler2D texNoise; +uniform sampler2D texTex1; +uniform sampler2D texTex2; +uniform sampler2D texTex3; +uniform sampler2D texTex4; + +layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything + +vec2 rotate(vec2 uv, float angle) +{ + float c = cos(angle); + float s = sin(angle); + return mat2(c, s, -s, c) * uv; +} + +float tile2(vec2 uv) +{ + uv.x += cos(fGlobalTime); + //uv.y += sin(fGlobalTime); + return step(0.5, length(uv)); +} + +float tile(vec2 uv) +{ + return step(-0.4, uv.x + uv.y) * step(uv.x + uv.y, 0.4); +} + +float hash(vec2 uv) +{ + return fract(sin(dot(uv, vec2(12.578, 3.541)) * 577.4357)); +} + +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 pulse = exp(-fract(fGlobalTime) * 20.0); + uv.x += sin(uv.y * 500.0) * 0.4 * pulse; + + vec3 color = mix(vec3(0.7, 0.8, 0.4), vec3(0.2, 0.8, 1.0), uv.x + uv.y); + + uv.x += sin(fGlobalTime * 0.2) * 0.5; + + uv *= 15.0 + sin(fGlobalTime * 0.2) * 5.0; + vec2 index = floor(uv); + uv = fract(uv) * 2.0 - 1.0; + + float t0 = floor(fGlobalTime); + float t1 = fract(fGlobalTime); + float angle = t0 + floor(hash(index) * 100.0) + pow(t1, 10.0); + angle *= 3.1415926535 / 2.0; + uv = rotate(uv, angle); + + float t = mod(tile(uv) + tile2(uv), 2.0); + color = mix(color, vec3(1.0), t); + + out_color = vec4(color, 1.0); +} \ No newline at end of file diff --git a/2018-12-01/02-evvvvil.glsl b/2018-12-01/02-evvvvil.glsl new file mode 100644 index 0000000..717a596 --- /dev/null +++ b/2018-12-01/02-evvvvil.glsl @@ -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 +vec2 sc,e=vec2(.00035,-.00035);float t,tt;vec3 pos; +float mx(vec3 p){return max(max(p.x,p.y),p.z);} +float bo(vec3 p, vec3 r){return mx(abs(p)-r);} +mat2 r2(float r){return mat2(cos(r),sin(r),-sin(r),cos(r));} +vec2 fb( vec3 p) +{ +vec2 h,t=vec2(0.8*bo(p,vec3(1,.5,6)),5); +t.x=min(t.x,0.8*bo(p-vec3(1,0,0),vec3(.2,1,1.5))); +t.x=min(t.x,0.8*bo(p+vec3(1,0,0),vec3(.2,1,1.5))); +h=vec2(0.8*bo(abs(p)-vec3(.25,0,.25),vec3(.15,1,1.4)),3); +t=(t.x60) break; +t.x+=h.x;t.y=h.y; +} +if(t.x>60) t.x=0; + return t; +} +float noise(vec3 p){ +vec3 ip=floor(p),s=vec3(7,157,113); +p-=ip; +vec4 h=vec4(0,s.yz,s.y+s.z)+dot(ip,s); +p=p*p*(3-2*p); +h=mix(fract(sin(h)*43758.5),fract(sin(h+s.x)*43758.5),p.x); +h.xy=mix(h.xz,h.yw,p.y); +return mix(h.x,h.y,p.z); +} +void main(void) +{ +tt=mod(fGlobalTime,100); + 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), +rd=normalize(vec3(uv,1)),co,fo,ld=normalize(vec3(.5,.5,-.5));co=fo=vec3(.9); + +sc=tr(ro,rd);t=sc.x; +if(t>0){ +vec3 po=ro+rd*t, +no=normalize(e.xyy*mp(po+e.xyy).x+ +e.yyx*mp(po+e.yyx).x+ +e.yxy*mp(po+e.yxy).x+ +e.xxx*mp(po+e.xxx).x),al=vec3(.5); +if(sc.y<5) al=vec3(1,.5,0); +float dif=max(0,dot(no,ld)), +aor=t/50, +ao=exp2(-2*pow(max(0,1-mp(po+no*aor).x/aor),2)), +specPo=exp2(5-3*noise(pos/vec3(.2))); +float fresnel=pow(1+dot(no,rd),4); +vec3 sss=vec3(.5)*smoothstep(0,1,mp(po+ld*0.4).x/0.4), +spec=vec3(5)*pow(max(0,dot(no,normalize(ld-rd))),specPo)*specPo/32; +co=spec+al*(ao*0.8+0.2)*(dif+sss); +} + + //float f = texture( texFFT, d ).r * 100; + + out_color = vec4(pow(co,vec3(0.45)),1); + //out_color = vec4(vec3(0.45),1); +} \ No newline at end of file diff --git a/2018-12-01/02-ponk.glsl b/2018-12-01/02-ponk.glsl new file mode 100644 index 0000000..d193454 --- /dev/null +++ b/2018-12-01/02-ponk.glsl @@ -0,0 +1,116 @@ +#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; + +#define time fGlobalTime + +#define PI 3.1415 +#define TAU 6.283 +#define repeat(p,r) (mod(p,r)-r/2.) + +layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything + +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 c = count/TAU; + float a = atan(p.y, p.x); + a = mod(a, c)-c/2.; + p = vec2(cos(a),sin(a))*length(p); +} + +float map (vec3 pos) { + + float scene = 10.; + + float d = length(pos) * 4.; + //pos.xz *= rot(d + time); + //pos.yz *= rot(d + time); + vec3 p = pos; + vec3 pp = p; + + const float count = 3.; + + + for (float i = count; i > 0.; --i) { + + float r = i / count; + //amod(p.xz, 5.); + p = abs(p)-.2*r; + p.x -= .2 * r; + p.xz *= rot(time*.4); + p.yz *= rot(time*.3); + p.xz *= rot(sin(time*2.)*2.); + + float rr = (.01*r + .005 * sin(time * 12.) * r); + scene = min(scene, length(p.xz)-rr); + scene = min(scene, length(p.yz)-rr); + + pp = abs(pp) - (.2 + .1 *sin(time*2.)) * r; + pp.xz *= rot(time); + pp.yz *= rot(time); + //pp.xz *= rot(sin(time*40.)*.1); + + scene = min(scene, length(pp)-.1*r); + } + + p = pos; + + p.z += time * 2.; + p = repeat(p, .3); + + scene = min(scene, length(p)-.01); + + 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); + + float a = atan(uv.y, uv.x); + float d = length(uv); + uv *= rot(time); + + amod(uv, 10.); + + //uv.x += sin(uv.y*1000.)*.001; + + vec3 eye = vec3(0,0,-1.5); + vec3 ray = normalize(vec3(uv, .5+.4*sin(time*4.))); + vec3 pos = eye; + float shade = 0.; + const float count = 50.; + for (float i = count; i > 0.; --i) { + float dist = map(pos); + if (dist < .001) { + shade = i / count; + break; + } + pos += ray * dist * .5; + } + + float invert = step(sin(length(uv)*2.-time*2.5), .0); + + shade = mix(shade, 1.-shade, invert); + + vec3 color = vec3(.5)+vec3(.5)*sin(vec3(.1,.2,.3)*time*4. + shade * 4.); + + + out_color = vec4(shade); +} \ No newline at end of file diff --git a/2018-12-01/03-flopine.glsl b/2018-12-01/03-flopine.glsl new file mode 100644 index 0000000..995cd59 --- /dev/null +++ b/2018-12-01/03-flopine.glsl @@ -0,0 +1,143 @@ +#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 time = fGlobalTime; + +vec2 moda (vec2 p, float per) +{ +float a= atan(p.y, p.x); +float l = length(p); +a = mod(a-per/2., per) -per/2.; +return vec2(cos(a),sin(a))*l; +} + +vec2 mo (vec2 p, vec2 d) +{ +p = abs(p)-d; +if (p.y >p.x) p.xy = p.yx; +return p; +} + +mat2 rot(float a) +{return mat2 (cos(a),sin(a),-sin(a), cos(a));} + +float stmin(float a, float b, float k, float n) +{ +float st = k/n; +float u = b-k; +return min(min(a,b),0.5 * (u+a+abs(mod(u-a+st, 2.*st)-st))); +} + +float sphe (vec3 p, float r) +{return length(p)-r;} + +float od (vec3 p, float d) +{ +return dot(p, normalize(sign(p)))-d; +} + +float cyl (vec2 p, float r) +{return length(p)-r;} + +float g1 = 0.; +float prim1 (vec3 p) +{ +float d = sphe(p, 0.8); +g1 += 0.01/(0.01+d*d); +return d; +} + +float prim2 (vec3 p) +{ +float per = 5.; +vec3 pp = p; +p.y = mod(p.y-per/2., per) -per/2.; +float o = min(prim1(p),max(-sphe(p, 1.2),od(p, 1.))); + + +p = pp; +p.xz *= rot(time*0.7); +p.xz *= rot(p.y*0.5); +p.xz = moda(p.xz, (2.*3.14)/4.); +p.x -= 1.3; + + +return stmin(o, cyl(p.xz, 0.15), 0.5, 4.); +} + + +vec2 frame_size = vec2 (10., 7.); + +float prim3 (vec3 p) +{ +p.xy = mo(p.xy,frame_size); +return prim2(p); +} + + +float g2 = 0.; +float in_frame(vec3 p) +{ +p.xy +=texture(texNoise, p.xy).rg * 0.2; +p.z +=sin(p.y); +p.x += cos(p.z + time); + p.x = abs(p.x + p.y); + +p.x = fract(p.x)-0.5; +float d = cyl(p.xz, 0.15); +g2 += 0.01/(0.01+d*d); +return d; +} + +float prim4 (vec3 p) +{ +if (abs(p.x) <= frame_size.x && abs(p.y) <= frame_size.y) return in_frame(p); +} + +float SDF (vec3 p) +{ + return min(prim3(p), prim4(p)); +} + +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.001,0.001, -20.); vec3 p = ro; + vec3 rd = normalize(vec3(uv, 1.)); + + float shad = 0.; + + for (float i=0.; i<64.; i++) +{ + float d = SDF(p); + if (d<0.01) +{ +shad = i/64.; +break; +} + +p += d*rd*0.7; +} + + vec3 col = vec3(shad); +col += g1*vec3(0.,0.5,0.2) + g2 *vec3(0.1,0.3,0.3); + + out_color = vec4(col,1.); +} \ No newline at end of file diff --git a/2018-12-01/03-lsdlive.glsl b/2018-12-01/03-lsdlive.glsl new file mode 100644 index 0000000..800fc03 --- /dev/null +++ b/2018-12-01/03-lsdlive.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 + +vec4 plas( vec2 v, float time ) +{ + float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 ); + return vec4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 ); +} + +#define time fGlobalTime +mat2 r2d(float a){float c=cos(a),s=sin(a);return mat2(c,s,-s,c);} + + +float re(float p,float d){return mod(p-d*.5,d)-d*.5;} +vec3 re(vec3 p,float d){return mod(p-d*.5,d)-d*.5;} +void amod(inout vec2 p, float m){float a=re(atan(p.x,p.y),m);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 sc(vec3 p, float d){p=abs(p);p=max(p,p.yzx);return min(p.x,min(p.y,p.z))-d;} + + +float g=0.; + +float de(vec3 p){ + +p.xy*=r2d(time*.4); + + + + + + +vec3 q = p; + + + + +q = re(q,7.); +amod(q.xy, 6.28/5.); +mo(q.xy, vec2(4)); +//q.xy+=1.; +float sc1 = sc(q,4.); + +q =p; + +amod(q.xy,6.28/2.); + +mo(q.xy, vec2(.4)); +float cyl = length(q.xy) - 1.; + +q=p; +//q.z+= +float od = dot(p,normalize(sign(p)))-.3; + +//return sc(q, .7); + +p.xy *=r2d(p.z*.2); + +amod(p.xy, 6.28/3.); + + + +p.x = abs(p.x)- 4.; + +p.xy*=r2d(p.z*.2); + +amod(p.xy, 6.28/3.); +mo(p.xy, vec2(1)); +p.x=abs(p.x)-1.; + + + + +float d= length(p.xy)-.2; +g+=.03/(.01+d*d); +d = min(d,sc1); + +g+=.003/(.01+d*d); +d = min(d,cyl); + +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); + + + + +float t1=time*7.; +float s = sin(t1)*.1+t1*.1; +uv+=vec2(sin(s*2.)*.2*cos(s), sin(s)*.2); + +uv*=r2d(time*.2); +//uv*=sin(time)*.1; + + + +vec3 ro=vec3(0,0,-4+time*10),rd=normalize(vec3(uv,.7-length(uv))),p; +float t=0.,i=0.; +for(;i<1;i+=.02){p=ro+rd*t;float d = de(p); +//if(d<.001)break; +d=max(abs(d),.002); +t+=d*.8;} + + +vec3 c=mix(vec3(.2, .3, .3), vec3(.15, .1, .1), length(uv*sin(time)*20.)+i); +c.g+=sin(p.z*.2)*.5; +c+=g*.45 * vec3(.2, .1, .24); + + out_color = vec4(c,1);texture(texChecker, uv);; +} \ No newline at end of file diff --git a/2018-12-01/04-eybor.glsl b/2018-12-01/04-eybor.glsl new file mode 100644 index 0000000..70daed7 --- /dev/null +++ b/2018-12-01/04-eybor.glsl @@ -0,0 +1,124 @@ +#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 PI 3.141592 + +float h(vec2 uv) +{ + float a = acos(cos(clamp(mod((atan(uv.x, -uv.y)+PI)*10., 14*PI)-2*PI, 0., 2*PI)))/PI; + return smoothstep(0.01, 0.015, abs(length(uv)-(.4+a*.2))); +} + +float e(vec2 uv, vec2 p) +{ + uv += p; + uv /= vec2(.2, .1); + float d = smoothstep(0.6, 0.7, length(uv)); + + uv += vec2(.25, -.25); + + d += smoothstep(0.2, 0.15, length(uv)); + + uv += vec2(-.2, .2); + + d += smoothstep(0.1, 0.05, length(uv)); + + return d; +} + +float n(vec2 uv) +{ + return smoothstep(0.04, 0.05, abs(uv.x)+mix(-uv.y, 1., smoothstep(-0.01, 0.2, uv.y))); +} + +float m(vec2 uv, vec2 p) +{ + uv += p; + + float h = 0.01; + + float d = mix(1., smoothstep(0.002, 0.007, abs(uv.y-(abs(uv.x)*.1+cos(uv.x*70.)*h))), step(-0.08, uv.x)*(1.-step(0.08, uv.x))); + + d *= mix(1., smoothstep(0.002, 0.007, abs(uv.x)), step(h, uv.y)*(1.-step(p.y, uv.y))); + + return d; +} + +vec2 rot(vec2 uv, float a) +{ + return mat2(cos(a), sin(a), -sin(a), cos(a))*uv; +} + +float s(vec2 uv, vec2 p, float r, float inv) +{ + uv += p; + + uv = rot(uv, r*(2.*inv-1.)); + + float f1 = mix(step(.05, uv.x), 1.-step(-0.05, uv.x), inv); + float f2 = mix(1.-step(0.25, uv.x), step(-0.25, uv.x), inv); + return mix(1., smoothstep(0.002, 0.007, abs(uv.y+uv.x*uv.x)), f1*f2); +} + +float MEGABASS() +{ + float m = 0.; + for(int i = 0; i < 64; ++i) + m = max(m, texture(texFFTSmoothed, i/1024).r); + + return m; +} + +void main(void) +{ + vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); + uv -= .5; + uv /= vec2(v2Resolution.y / v2Resolution.x, 1); + + float bass = MEGABASS(); + + vec3 c = vec3(1.); + + vec2 eOffset = vec2(.2, -.1); + vec2 fOffset = vec2(.0, .1); + vec2 mOffset = vec2(.0, .11); + + vec2 sOffset = vec2(.0, .05); + + uv *= bass*2000.; + + uv.y *= 1.5; + + uv = rot(uv, .2+(-1.+2.0*bass)*1000.); + + c *= h(uv); + + uv += fOffset; + + c *= e(uv, eOffset); + c *= e(uv, eOffset*vec2(-1., 1.)); + c *= n(uv); + c *= m(uv, mOffset); + c *= s(uv, sOffset, -0.25, 0.); + c *= s(uv, sOffset, -0.15, 0.); + c *= s(uv, sOffset, 0.1, 0.); + c *= s(uv, sOffset, -.2, 1.); + c *= s(uv, sOffset, -.1, 1.); + c *= s(uv, sOffset, .1, 1.); + + out_color = vec4(c, 1.); +} \ No newline at end of file diff --git a/2018-12-01/04-nusan.glsl b/2018-12-01/04-nusan.glsl new file mode 100644 index 0000000..923b3de --- /dev/null +++ b/2018-12-01/04-nusan.glsl @@ -0,0 +1,158 @@ +#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 perc=texture(texFFTIntegrated, 0).x; +#define time fGlobalTime + +float sph(vec3 p, float r) { + return length(p) - r; + +} + + +float cyl(vec3 p, float r) { + return length(p.xy) - r; + +} + +mat2 rot(float a) { + float ca=cos(a); + float sa=sin(a); + return mat2(ca,sa,-sa,ca); +} + +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) - k * (1-k) * h; +} + +float rnd(float t) { + return fract(sin(t*234.231)*7423.215); +} + +float curve(float t, float d) { + float g=t/d; + return mix(rnd(floor(g)), rnd(floor(g)+1), pow(smoothstep(0,1, fract(g) ), 10)); + +} + +float map(vec3 p) { + + float d = 10000; + float j = 10000; + + for(int i=0;i<8; ++i) { + + float t1 = time + i*2.354 + curve(time+85.24, 20.9*i+0.2)*3; + p.xy *= rot(t1); + p.yz *= rot(t1*0.7); + + d = smin(d, sph(p, 0.1 * i+.1), 0.2); + + p -= 0.2; + p = abs(p); + + p.xy *= rot(t1*1.3); + + d = smin(d, -cyl(p, 0.05), -0.3); + j = min(j, cyl(p.yzx, 0.05)); + } + + j = smin(j, sph(p, 1), 0.3); + + return min(j,d); +} + +vec3 norm(vec3 p) { + float base=map(p); + vec2 off=vec2(0.01,0); + return normalize( vec3(base-map(p-off.xyy), base-map(p-off.yxy), base-map(p-off.yyx) )); +} + +vec3 cam(vec3 p) { + float t2 = time + curve(time, 0.9)*3; + p.xy *= rot(t2); + p.xz *= rot(t2*1.2); + return p; +} + +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.x += (curve(time+85,0.8)-0.5) * 0.4; + uv.y += (curve(time+85,0.7)-0.5) * 0.3; + + vec3 ro = vec3(0,0,-3); + vec3 rd = normalize(vec3(-uv,0.1 + curve(time+52, 1.2))); + + ro=cam(ro); + rd=cam(rd); + + vec3 p = ro; + float dd = 0; + float at = 0; + for(int i=0;i<100; ++i) { + float d = map(p); + if(d<0.001) { + break; + } + if(dd>100) { + dd = 100; + break; + } + + p+=rd*d; + dd+=d; + at += exp(-d); + } + + + vec3 n = norm(p); + vec3 l = normalize(vec3(-1)); + vec3 h = normalize(l-rd); + + + vec3 col = vec3(0); + + float lum = max(0, dot(n, l)); + float amb = -n.y*0.5+0.5; + col += vec3(0.8,0.7,0.2) * lum; + col += vec3(0.2,0.3,1.0) * amb; + + col += vec3(0.8,0.9,1.0) * 0.4 * lum * pow(max(0,dot(n,h)), 10); + col += vec3(0.1,0.2,1.0) * 4.7 * amb * pow(1-max(0,dot(n,-rd)), 3); + + col *= 4/dd; + + col += pow(at*0.02,0.3) * 0.7; + + col += pow(abs(fract(at)-0.5) * (1-step(dd,50)), 5) * 10.2 * curve(time+81,1.4); + + float t3 = time + curve(time+85,1.5); + col.xy *= rot(t3); + col.yz *= rot(t3*1.2); + col.xz *= rot(t3*0.7); + col = abs(col); + + col *= pow(clamp(1-length(uv),0,1),2); + + out_color = vec4(col, 1); +} \ No newline at end of file diff --git a/2018-12-01/05-ponk.glsl b/2018-12-01/05-ponk.glsl new file mode 100644 index 0000000..3e95e64 --- /dev/null +++ b/2018-12-01/05-ponk.glsl @@ -0,0 +1,122 @@ +#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 repeat(p,r) (mod(p,r)-r/2.) + + +float sbox(vec3 p, float r) { + vec3 d = abs(p)-r; + return max(d.x, max(d.y, d.z)); +} +float sbox(vec3 p, vec3 r) { + vec3 d = abs(p)-r; + return max(d.x, max(d.y, d.z)); +} + +mat2 rot (float a) { + float c=cos(a),s=sin(a); + return mat2(c,s,-s,c); +} + +float smoothmin (float a, float b, float r) { + + float h = clamp(.5+.5*(a-b), .0, 1.); + return mix(b, a, r)-h*(1.-r)*r; +} + +float map (vec3 pos) { + float scene = 10.; + vec3 p = pos; + scene = max(-(length(pos.xy)-2.), 0.); + + p.z += time*4.; + p.xy *= rot(p.z * .1 + sin(p.z - time) * .1); + p = repeat(p, 1.); + scene = max(scene, -sbox(p, .4)); + p = repeat(p, .8); + scene = max(scene, -sbox(p, .2)); + p = repeat(p, .3); + scene = max(scene, -sbox(p, .1)); + + p = pos; + p.z += time*4.; + p.z = repeat(p.z, 4.); + scene = max(scene, abs(p.z)-1.5); + + p = pos; + p.xz *= rot(time*8.); + p.yz *= rot(time*4.); + //p.yx *= rot(sin(time*20.)*.5); + vec3 pp = p; + float shape = sbox(p, 0.3 + .1 * sin(time*4.) + 0.1 * sin(time*2.)); + p = repeat(p, .2);//+.1*sin(time*4.)); + shape = max(shape, sbox(p, .09)); + scene = min(scene, shape); + + p = pp; + + vec2 size = vec2(.1+.05*sin(time*40.), 4.); + float d = length(pp) * .5; + pp.xz *= rot(d); + pp.yz *= rot(d); + scene = min(scene, sbox(pp, size.xxy)); + scene = min(scene, sbox(pp, size.yxx)); + scene = min(scene, sbox(pp, size.xyx)); + + + const float count = 3.; + for (float i = count; i > 0.; --i) { + float r = i / count; + p.xz *= rot(time); + p.yz *= rot(time); + p = abs(p)-(.3-.2 * sin(time*8.))*r; + scene = min(scene, length(p)-.2*r); + } + + p = abs(p)-.5; + + scene = min(scene, sbox(p, .1)); + + 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); + + uv *= rot(time); + + vec3 eye = vec3(0,0,-4); + vec3 pos = eye; + vec3 ray = normalize(vec3(uv, .6 + .4 * sin(time*2.5))); + float shade = 0.; + const float count = 60.; + for (float i = count; i > 0.; --i) { + float dist = map(pos); + if (dist < .001) { + shade = i / count; + break; + } + pos += ray * dist * .5; + } + vec3 disco = vec3(.5)+vec3(1.)*sin(vec3(.1,.2,.3)*time*10. - pos.z * .5); + vec3 color = mix(disco, vec3(1,0,0), step(length(pos), 1.)); + out_color = vec4(color*shade, 1); +} \ No newline at end of file diff --git a/2018-12-01/05-wsmind.glsl b/2018-12-01/05-wsmind.glsl new file mode 100644 index 0000000..0be34c8 --- /dev/null +++ b/2018-12-01/05-wsmind.glsl @@ -0,0 +1,138 @@ +#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 hash(vec2 uv) +{ + return fract(sin(dot(uv, vec2(12.9898, 78.5354))) * 43758.5354); +} + +vec2 rotate(vec2 uv, float angle) +{ + float c = cos(angle); + float s = sin(angle); + return mat2(c, s, -s, c) * uv; +} + +float vmax(vec3 v) +{ + return max(max(v.x, v.y), v.z); +} + +float box(vec3 pos, vec3 size) +{ + vec3 diff = abs(pos) - size; + return length(max(diff, 0.0)) + vmax(min(diff, 0.0)); +} + +float map(vec3 pos) +{ + //return 5.0 - length(pos); + return max(max(-box(pos, vec3(3.0)), -box(pos, vec3(4.0, 1.0 + sin(fGlobalTime) + 1.0, 3.0))), -box(pos, vec3(2.0, sin(fGlobalTime) + 1.0, 4.0))); +} + +bool traceRay(inout vec3 pos, vec3 dir) +{ + for (int i = 0; i < 64; i++) + { + float d = map(pos); + if (d < 0.001) + return true; + pos += dir * d; + } + return false; +} + +vec3 computeNormal(vec3 pos) +{ + vec2 e = vec2(0.01, 0.0); + return normalize(vec3( + map(pos + e.xyy) - map(pos - e.xyy), + map(pos + e.yxy) - map(pos - e.yxy), + map(pos + e.yyx) - map(pos - e.yyx) + )); +} + +vec3 computeEmissive(vec3 pos) +{ + return step(3.9, pos.x) * vec3(1.0, 0.4, 0.0) * 4.0 + step(pos.x, -3.9) * vec3(0.6, 0.8, 0.9) * 4.0; +} + +vec3 computeAlbedo(vec3 pos) +{ + return vec3(0.8); +} + +vec3 cosineSampleHemisphere(vec2 rng) +{ + float radius = sqrt(rng.x); + float angle = 2.0 * 3.1415926535 * rng.y; + return vec3(radius * cos(angle), radius * sin(angle), sqrt(1.0 - rng.x)); +} + +vec3 samplePath(vec2 rng, vec3 pos, vec3 dir) +{ + vec3 radiance = vec3(0.0); + vec3 pathTransmittance = vec3(1.0); + + for (int i = 0; i < 4; i++) + { + if (!traceRay(pos, dir)) + break; + + vec3 normal = computeNormal(pos); + vec3 emissive = computeEmissive(pos); + vec3 albedo = computeAlbedo(pos); + + radiance += pathTransmittance * emissive; + pathTransmittance *= albedo; + + vec2 off = vec2(float(i)); + dir = cosineSampleHemisphere(vec2(hash(rng + off), hash(rng + off + 1.0))); + if (dot(dir, normal) < 0.0) + dir = -dir; + pos += dir * 0.2; + } + + return radiance; +} + +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.0, 0.0, 0.0); + vec3 dir = normalize(vec3(uv, 0.4)); + + dir.xy = rotate(dir.xy, fGlobalTime * 0.4); + dir.xz = rotate(dir.xz, fGlobalTime * 0.3); + + vec3 radiance = vec3(0.0); + for (int i = 0; i < 4; i++) + { + vec2 rng = vec2(hash(uv), hash(uv + 1.0)) + float(i); + radiance += samplePath(rng, pos, dir); + } + radiance /= 4.0; + + vec3 color = radiance; + color /= (color + 1.0); + color = pow(color, vec3(1.0 / 2.2)); + + out_color = vec4(color, 0.0); +} \ No newline at end of file diff --git a/2018-12-01/06-flopine.glsl b/2018-12-01/06-flopine.glsl new file mode 100644 index 0000000..1b4327f --- /dev/null +++ b/2018-12-01/06-flopine.glsl @@ -0,0 +1,122 @@ +#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 PI = 3.141592; +float time = fGlobalTime; + + +vec2 mo(vec2 p, vec2 d) +{ +p = abs(p)-d; +if (p.y>p.x) p.xy = p.yx; +return p; +} + +vec2 moda (vec2 p, float per) +{ + float a = atan(p.y,p.x); + float l = length(p); + a= mod(a-per/2., per) -per/2.; + return vec2 (cos(a), sin(a))*l; +} +mat2 rot(float a) +{return mat2(cos(a),sin(a),-sin(a), cos(a));} + + +float cylH (vec3 p, float r, float h) +{return max(length(p.xz)-r,abs(p.y)-h);} + + +float cyl (vec2 p, float r) +{return length(p)-r;} + + +float box (vec3 p, vec3 c) +{return length(max(abs(p)-c,0.));} + +float g1 = 0.; +float prim1 (vec3 p) +{ + p.y = fract(p.y) -0.5; + float d = cylH(p.yxz, 0.1, 1.); + g1 += 0.01/(0.01+d*d); + return d; +} + +float g2 = 0.; +float prim2(vec3 p) +{ + + p.xz = moda(p.xz, PI); + + p.x -= 1.; + float d = cyl(p.xz, 0.1); + g2 += 0.01/(0.01+d*d); + return d; +} + +float prim3 (vec3 p) +{ + float bounce = 0.05 + exp(-fract(time))*0.5; + p.xy = mo(p.xy, vec2 (2.)); + p.z += cos(p.x+time); + p.y += sin(p.x); + p.z += 1.5; + p.y = abs(p.y); + p.y -= 2.; + return box (p, vec3(1e9, bounce, bounce)); +} + +float SDF (vec3 p) +{ + + float b = prim3(p); + float per = 5.; + p.x = mod(p.x-per/2., per)-per/2.; + p.xz = mo(p.xz, vec2 (1.2)); + p.xz *= rot(time); + p.xz *= rot(p.y*0.5); + return min(min (prim1(p), prim2(p)), b); +} + + +void main(void) +{ + vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); + uv -= 0.5; + uv /= vec2(v2Resolution.y / v2Resolution.x, 1); + + uv += texture(texNoise, uv+time).rg * 0.09; + + vec3 ro = vec3(0.001+time*5.,0.001, -10.); vec3 p = ro; + vec3 rd = normalize(vec3(uv,1.)); + float shad = 0.; + + for (float i = 0.; i<64.; i++) +{ + float d = SDF(p); + if (d<0.001) +{ + shad = i/64.; + break; +} +p += d*rd*0.5; +} + + vec3 col = vec3(shad)*0.1; + col += (g1*vec3(0.1,0.5,0.6) + g2 *vec3(0.5,0.1,0.))*0.5; + out_color = vec4(pow(col, vec3(0.45)),1.); +} \ No newline at end of file diff --git a/2018-12-01/06-nusan.glsl b/2018-12-01/06-nusan.glsl new file mode 100644 index 0000000..6f05a4d --- /dev/null +++ b/2018-12-01/06-nusan.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 time fGlobalTime +#define PI 3.1415926535 + +float sph(vec3 p, float r) { + return length(p)-r; +} + +float cyl(vec2 p, float r) { + return length(p)-r; +} + +float rnd(float t) { + + return fract(sin(t*425.232)*7423.235); +} + +mat2 rot(float a) { + float ca=cos(a); + float sa=sin(a); + return mat2(ca,sa,-sa,ca); +} + +float curve(float t, float d) { + float g=t/d; + return mix(rnd(floor(g)), rnd(floor(g)+1), pow(smoothstep(0,1,fract(g)),10) ); +} + +vec3 tunnel(vec3 p) { + float t = p.z * 0.3 + curve(p.z, 2.9) + curve(p.z + 74, 0.9) * 0.2; + p.x += sin(t) * 0.3 + (curve(p.z+42,1)-0.5)*0.5; + p.y += sin(t*1.7 + 23)*0.4; + p.xy *= rot(p.z*0.1+curve(time, 0.8)*10.1); + return p; +} + +float map(vec3 p) { + + p = tunnel(p); + + vec3 rp = vec3(atan(p.x,-p.y)*PI, length(p.xy), p.z); + + float j = 2.1 + curve(p.z, 2.9)*2; + float t = texture(texNoise, rp.xz*vec2(0.2,1)*0.4).x; + float a = -cyl(p.xy,j); + + float c = t + 1-cyl(p.xy, 0.9); + + return min(a, min(c, -p.y+1.4 +t*0.3)); +} + +vec3 norm(vec3 p) { + float base=map(p); + vec2 off=vec2(0.01,0); + return normalize(vec3( base-map(p-off.xyy), base-map(p-off.yxy), base-map(p-off.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,-3); + vec3 rd = normalize(vec3(-uv, 1)); + + ro.z += time * 4; + ro = tunnel(ro); + + vec3 p = ro; + float dd=0; + float at = 0.0; + for(int i=0; i<100; ++i) { + float d = map(p); + if(d<0.001) { + break; + } + p+=rd*d*0.5; + dd+=d * 0.5; + at += exp(-d); + } + + vec3 n = norm(p); + vec3 l = normalize(vec3(-1)); + vec3 h = normalize(l-rd); + float lum = max(0, dot(l,n)); + + vec3 col = vec3(0); + col += vec3(0.8,0.7,0.2) * lum; + col += vec3(0.8,0.7,1.0) * 0.3 * lum * pow(max(0, dot(n,h)), 10); + col += vec3(0.2,0.3,0.7) * 0.02 * at; + + col += vec3(1,0.5,0.3) * 0.1 * exp(dd*0.1) * (1 + curve(time+7,0.2)) * 1; + + float t1 = time + curve(time+2,.9) - length(uv) ; + col.xy *= rot(t1); + col.yz *= rot(t1*1.2); + + col = abs(col); + + col *= 5/dd; + + + + out_color = vec4(col, 1); +} \ No newline at end of file diff --git a/2018-12-01/07-nusan.glsl b/2018-12-01/07-nusan.glsl new file mode 100644 index 0000000..1852a80 --- /dev/null +++ b/2018-12-01/07-nusan.glsl @@ -0,0 +1,152 @@ +#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 + +float sph(vec3 p, float r){ + return length(p)-r; +} + + +float cyl(vec2 p, float r){ + return length(p)-r; +} + +vec3 rep(vec3 p, float s) { + return (fract(p/s-0.5)-0.5)*s; +} + +mat2 rot(float a) { + float ca=cos(a); + float sa=sin(a); + return mat2(ca,sa,-sa,ca); +} + +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) - k * (1-k)*h; +} + +float rnd(float t){ + return fract(sin(t*423.23)*4568.232); +} + +float curve(float t, float d) { + float g = t/d; + return mix( rnd(floor(g)), rnd(floor(g)+1), pow(smoothstep(0,1, fract(g)), 10)); +} + +float map(vec3 p) { + + vec3 rp = rep(p, 0.1); + vec3 rp2 = rep(p, 0.12); + + float f = texture(texNoise, p.xz * 0.1).x; + + float v = clamp(length(p.xz)*0.5, 0, 1) * 1.5; + + float m = -p.y + 0.1 + f*2 + v; + + float o = -p.y + 2.1; + + float c = cyl(rp.xz, 0.02); + float c2 = cyl(rp2.xz, 0.02); + + float m2 = -p.y + 0.1 + f*2 + v; + + c = smin(m+.2 - f*2, c, -0.2); + c = smin(m+.2 - f*2+0.1, c2, -0.2); + + return min(c,min(m, o)); +} + + + +vec3 norm(vec3 p) { + float base = map(p); + vec2 off = vec2(0.01,0); + return normalize( vec3( base-map(p-off.xyy), base-map(p-off.yxy), base-map(p-off.yyx) )); +} + +vec3 cam(vec3 p) { + float t = time; + p.xz *= rot(t); + p.yz *= rot(sin(t + curve(time+5,1.2)*0.5) * 0.1); + return p; +} + +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.x += (curve(time+5, 0.7)-0.5) * 0.4; + uv.y += (curve(time+5, 0.8)-0.5) * 0.3; + + vec3 ro = vec3(0,1,-5); + vec3 rd = normalize(vec3(-uv, 0.1 + curve(time, 0.2) * 2)); + + ro = cam(ro); + rd = cam(rd); + + + vec3 p = ro; + float dd = 0; + for(int i=0; i<100; ++i) { + float d = map(p); + if(d<0.001) { + break; + } + if(dd>100) { + dd=100; + break; + } + p+=rd*d*0.5; + dd+=d*0.5; + } + + vec3 n = norm(p); + vec3 l = normalize(vec3(-1)); + vec3 h = normalize(l-rd); + + float lum = max(0, dot(n,l)); + float amb = -n.y*0.5+0.5; + + vec3 col = vec3(0); + + col += vec3(1,0.9,0.5) * lum * 0.5; + col += vec3(0.2,0.2,1.0) * amb * 0.2; + col += vec3(0.9,0.9,1.0) * lum * pow(max(0, dot(n,h)),30);; + + col *= 5/dd; + + col += vec3(1,0.5,0.2) * 0.1 * exp(dd*0.2); + + float t2 = time + curve(time+85, 0.8) + + curve(time+45, 1.3); + + + col.xy *= rot(t2); + col.zy *= rot(t2*0.7); + col.xz *= rot(t2*1.2); + + col = abs(col); + + col *= min(1,pow(1-length(uv*0.9),2) * 10); + + out_color = vec4(col, 1); +} \ No newline at end of file diff --git a/2018-12-01/07-ponk.glsl b/2018-12-01/07-ponk.glsl new file mode 100644 index 0000000..6b0e9d8 --- /dev/null +++ b/2018-12-01/07-ponk.glsl @@ -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 time fGlobalTime + +#define PI 3.1415 +#define TAU 6.28 +#define repeat(p,r) (mod(p,r)-r/2.) + +float sbox ( vec3 p, float r) { + vec3 d = abs(p)-r; + return max(d.x, max(d.y, d.z)); +} + +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); + a = mod(a, an)-an/2.; + p = vec2(cos(a),sin(a))*length(p); +} + + +float map (vec3 pos) { + float scene = 10.; + vec3 p = pos; + p.yz *= rot(time*1.); + p.yx *= rot(sin(time*.1)); + p.xz *= rot(time * 2. + p.y * .2); + p = abs(p)-2. + 1.*sin(time*2.); + amod(p.xz, 10. + 5. * sin(time * 4.)); + p.x -= 1.+.5*sin(time*8.+p.y); + scene = length(p.xz) - .05 + .02 * sin(time*16.); + p.y += time * 10.; + float cy = 16.; + float iy = floor(p.y/cy); + vec3 pp = p; + p.y += time * 4.; + p.y = repeat(p.y, cy); + scene = min(scene, length(p)-.2+.1 * sin(time*16.+iy*2.)); + + cy = 4.; + p = pp; + p.y += time * 4.; + p.y = repeat(p.y, cy); + scene = min(scene, sbox(p, .3+.2*sin(time))); + //scene = min(scene, length(p.yz) - .01); + + p = pp; + cy = 10.; + p.y += time * 4.; + p.y = repeat(p.y, cy); + scene = min(scene, max(-(length(p.xz)-8.), max(length(p.xz)-10., abs(p.y)-2.))); + //scene = max(scene, -(length(p)-.5)); + 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); + //uv *= rot(time); + vec3 eye = vec3(0,0,-5. + 1. * sin(time*8)); + vec3 ray = normalize(vec3(uv,.5 + .3*cos(time*8.))); + vec3 pos = eye; + float shade = 0.; + const float count = 30.; + for (float i = count; i > 0.; --i) { + float dist = map(pos); + if (dist < .001) { + shade = i / count; + break; + } + pos += ray * dist; + } + + vec3 color = vec3(.7)+vec3(.9)*sin(vec3(.2,.1,.3)*time * 40. + shade * 2. + pos.z * .5); + + vec2 p = uv*16.; + p.y -= sqrt(abs(p.x))*1.5-1.5; + p.x /= 1.2; + float invert = step(5., (length(p)-sin(time*10.)*3.)); + + color *= shade; + color = mix(color, 1.-color, invert); + + out_color = vec4(color, 1); +} \ No newline at end of file diff --git a/2018-12-01/Readme.md b/2018-12-01/Readme.md new file mode 100644 index 0000000..174f90c --- /dev/null +++ b/2018-12-01/Readme.md @@ -0,0 +1,37 @@ +# Shader Showdown Paris + +On November 30th & December 1st, 2018 during the [Cookie Demoparty](http://cookie.paris/) at [La Folie Numérique](http://folie-numerique.fr/). + +## Rounds + +1. Elie vs Wsmind +2. Ponk vs Evvvvil +3. Flopine vs Lsdlive +4. Eybor vs Nusan +5. Wsmind vs Ponk +6. Flopine vs Nusan +7. Ponk vs Nusan + +## Tournament view + +``` +Elie ---- + } Wsmind -- +Wsmind -- \ + } Ponk -- +Ponk ---- / \ + } Ponk ---- \ +Evvvvil - \ + } Nusan +Flopine - / + } Flopine - / +Lsdlive - \ / + } Nusan - +Eybor --- / + } Nusan --- +Nusan --- +``` + +## Software + +[Bonzomatic](https://github.com/Gargaj/Bonzomatic)