From b93f9bafdceeada5a2630df25c3ebcabc340b607 Mon Sep 17 00:00:00 2001 From: NuSan Date: Mon, 2 Dec 2019 09:21:37 +0100 Subject: [PATCH] Friendly shader showdown at GROW 2019 One half of the shaders --- 2019-11-30/01-anton.glsl | 132 +++++++++++++++++++++++++ 2019-11-30/02-kidou_greckow.glsl | 57 +++++++++++ 2019-11-30/03-nicoptere.glsl | 70 +++++++++++++ 2019-11-30/04-sixclone.glsl | 64 ++++++++++++ 2019-11-30/05-flopine.glsl | 122 +++++++++++++++++++++++ 2019-11-30/06-nusan.glsl | 162 +++++++++++++++++++++++++++++++ 2019-11-30/07-novac.glsl | 47 +++++++++ 2019-11-30/08-anton.glsl | 123 +++++++++++++++++++++++ 2019-11-30/09-ponk.glsl | 78 +++++++++++++++ 2019-11-30/Readme.md | 25 +++++ 10 files changed, 880 insertions(+) create mode 100644 2019-11-30/01-anton.glsl create mode 100644 2019-11-30/02-kidou_greckow.glsl create mode 100644 2019-11-30/03-nicoptere.glsl create mode 100644 2019-11-30/04-sixclone.glsl create mode 100644 2019-11-30/05-flopine.glsl create mode 100644 2019-11-30/06-nusan.glsl create mode 100644 2019-11-30/07-novac.glsl create mode 100644 2019-11-30/08-anton.glsl create mode 100644 2019-11-30/09-ponk.glsl create mode 100644 2019-11-30/Readme.md diff --git a/2019-11-30/01-anton.glsl b/2019-11-30/01-anton.glsl new file mode 100644 index 0000000..98211bb --- /dev/null +++ b/2019-11-30/01-anton.glsl @@ -0,0 +1,132 @@ +#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 mat = 0.; + +mat2 rot(float a) +{ + float ca = cos(a); + float sa = sin(a); + + return mat2(ca,-sa,sa,ca); + } + + +float map(vec3 p) +{ + vec3 cp = p; + float r = 15.; + + p.xy *= rot(p.z * .02 + fGlobalTime * .1); + + for(float i = 1.; i < 5. ; ++i) + { + p -= fGlobalTime * .01; + p.xy *= rot(fGlobalTime * .025); + p * 1.1; + p = abs(p); + + } + p = mod(p + r/ 2., r) - r/2.; + + p.x = abs(p.x) ; + p.y -= p.x* abs(sin(fGlobalTime * 3.)+ .7); + float dist = length(p) - 1.; + + + p = cp; + + p.xy *= rot(p.z * .02); + + float tunnel =max(p.x,p.y) - 6.; + if(tunnel < .01) + { + mat = 1.; + } + + dist = min(-tunnel, dist); + + + p = cp; + + for(float i = 1.; i < 5. ; ++i) + { + p.xz -= fGlobalTime * .01; + p.xz *= rot(fGlobalTime * .025); + p.xz * 1.1; + p.xz = abs(p.xz); + + } + p.y += (sin(p.z) + cos(p.x)); + float s = p.y + 5.; + + dist = min(dist, s); + return dist; + } + + vec3 normal(vec3 p) + { + vec2 e = vec2(.01,.0); + float d = map(p); + return normalize(vec3(d - map(p + e.xyy),d - map(p + e.yxy),d - map(p + e.yyx))); + } + +float ray(inout vec3 cp, vec3 rd, out float st) +{ + float cd = 0.; + st = 0.; + for(;st < 1.; st += 1./128.) + { + cd = map(cp); + if(cd < .01) + break; + cp += rd * cd * .5; + } + + return cd; +} + +void main(void) +{ + vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); + uv -= 0.5; + uv /= vec2(v2Resolution.y / v2Resolution.x, 1); + + vec3 ro = vec3(0.,0.,-10.); + vec3 rd = normalize(vec3(uv,1.)); + vec3 cp = ro; + float st; + float cd = ray(cp, rd, st); + + if(cd < .01) + { + vec3 ld = vec3(-1.,-1.,1.); + if(mat == 1.) + { +// ld = - normalize(vec3(0.) - cp); + } + + float sound = texture(texFFTSmoothed, .025).r; + + vec3 norm = normal(cp); + float li = abs(dot(ld, norm)); + cp.xy *= rot(cp.z * .1 + fGlobalTime + sound); + out_color = vec4(cp, 0.) * li; + } + + + } \ No newline at end of file diff --git a/2019-11-30/02-kidou_greckow.glsl b/2019-11-30/02-kidou_greckow.glsl new file mode 100644 index 0000000..9eb515c --- /dev/null +++ b/2019-11-30/02-kidou_greckow.glsl @@ -0,0 +1,57 @@ +#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 circle(vec2 uv, float r) { + + return step(length(uv), r); + + } + +void main(void) +{ + vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); + + vec2 cv = uv -.5; + cv.x *= v2Resolution.x/v2Resolution.y; + + vec2 st= cv; + + vec2 qr = st; + + cv.x *= fGlobalTime * cv.y; + cv *= fract(cv*sin(fGlobalTime)); + + st.x += cos(fGlobalTime*2.)*.5; + + //for(int i=0; i <10.; i++){ + + // st*= i ; + // } + qr += fGlobalTime*.2; + + float noiseCol = texture(texNoise, qr).r; + + vec4 col = vec4(circle(st, 0.5*noiseCol)*noiseCol); + + + + + col.r = circle(cv, .5); + + out_color = col; +} \ No newline at end of file diff --git a/2019-11-30/03-nicoptere.glsl b/2019-11-30/03-nicoptere.glsl new file mode 100644 index 0000000..f85be82 --- /dev/null +++ b/2019-11-30/03-nicoptere.glsl @@ -0,0 +1,70 @@ +#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 PI acos( -1. ) +float n (vec3 p ){ + vec4 a = vec4( 0,57,21,78) + dot( vec3( 1,57,21), floor( p) ); +vec4 a1 = a+1.; + vec3 f = .5 - .5 * cos( fract( p ) * PI ) ; + a = mix( sin(cos( a)*a), sin(cos( a1) * a1 ), f.x ); + a.xy = mix( a.xz, a.yw, f.y ); + return mix( a.x, a.y, f.z ); + } + float fbm (vec3 p){ + float r = 0.; + float a = 1.; + for (int i =0; i <3; i++)r += (a*=.5) * n(p*=2.); + return r; + } + +float map( vec3 p ){ + + float t=fGlobalTime, a=t ,ca =cos( a), sa=sin( a); + + float st = sin( fGlobalTime * 2.); + mat2 m = mat2( ca, -st, st, ca ); + p.xz *= m; + p.yz *= m; + float pl = dot( p, vec3( 0,1.,0.)) + st ; + float sp = length( p ) - 1.5 + fbm( p + fGlobalTime ) * ( sin( t * 3. ) ) ; + return max( pl, sp); + } +void main(void) +{ + float ti = fGlobalTime; + vec2 uv = gl_FragCoord.xy / v2Resolution * 2. - 1.; + + uv.x *= v2Resolution.x / v2Resolution.y; + + float t, a=ti ,ca =cos( a), sa=sin( a); + vec3 c = vec3( 0, 0, -3), d = normalize( vec3( uv, 1.) ), p = c + d; + for( int i =0; i < 32; i++ ){ + t += map( p ); + p = c + t * d; + } + t = log( t - 1. ); + uv = gl_FragCoord.xy / v2Resolution; + uv *= n( p); + vec3 col = .5+ .5 * cos( ti + uv.xyx + vec3( 0,2,4 ) ); + out_color = vec4(col * t, 1.); +} \ No newline at end of file diff --git a/2019-11-30/04-sixclone.glsl b/2019-11-30/04-sixclone.glsl new file mode 100644 index 0000000..2a313f7 --- /dev/null +++ b/2019-11-30/04-sixclone.glsl @@ -0,0 +1,64 @@ +#version 410 core + +uniform float fGlobalTime; // in seconds +uniform vec2 v2Resolution; // viewport resolution (in pixels) +#define P 3.1415 + +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 circlesdf(vec2 uv) { + return distance(uv, vec2(0.5)); +} + +void main(void) +{ + vec2 uv = 2.0 * gl_FragCoord.xy / v2Resolution.xy - 1.0; + uv -= 0.5; + uv /= vec2(v2Resolution.y / v2Resolution.x, 1); + uv += 0.5; + + float t = fGlobalTime; + + vec3 color = vec3(0.0); + + float mixer = mix( + 0.5, 1.0, + mod(t, 2.5) + ); + float mixer2 = mix( + 0.5, 2.5, + mod(t, 1.0) + ); + float n = 7.5 + 2.0 * sin(2.5 * t + uv.x); + uv *= mixer * n; + vec2 gv = fract(uv); + vec2 id = floor(uv); + + float p1 = sin(5.0 * t + id.x + gv.x) * + cos(-t + id.y + cos(5.0 * t + uv.x * uv.y) - 5.0 * sin(-t + uv.x + uv.y)) + * 0.25 + 0.25; + float p2 = sin(5.0 * t + id.x + gv.x) * + cos(t + id.y + cos(5.0 * t + uv.x - uv.y) - 5.0 * sin(-t + uv.x + uv.y)) + * 0.25 + 0.25; + + color += smoothstep(p1, p2, circlesdf(gv)); + color.b += smoothstep(p2, p1, circlesdf(gv)); + + out_color = vec4(color, 0.0); +} \ No newline at end of file diff --git a/2019-11-30/05-flopine.glsl b/2019-11-30/05-flopine.glsl new file mode 100644 index 0000000..373376d --- /dev/null +++ b/2019-11-30/05-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 + +#define PI 3.141592 +#define time fGlobalTime + +mat2 rot(float a) +{return mat2(cos(a),sin(a),-sin(a),cos(a));} + +void moda (inout vec2 p, float rep) +{ + float per = 2.*PI/rep; + float a = atan(p.y,p.x); + float l = length(p); + a = mod(a-per*0.5,per)-per*0.5; + p = vec2(cos(a),sin(a))*l; + } + +float cyl (vec2 p, float r) +{return length(p)-r;} + +float g1 = 0.; +float spike (vec3 p, float w) +{ + float per = .5; + float id = floor(p.y/per); + p.xz *= rot(id); + p.y = mod(p.y, per)-per*0.5; + float d = max(cyl(p.yz, 0.02-p.x*0.2),abs(p.x)-.5); + g1 += 0.01/(0.01+d*d); + return d; + } + +float prim1 (vec3 p) +{ + vec3 pp = p; + p.xz*= rot(time); + p.xz *= rot(p.y*1.2); + moda(p.xz, 5.); + p.x-=0.12; + float d = cyl(p.xz, 0.07); + + p = pp; + return min(d, spike(p,0.08)); + } + + float grid (vec3 p) + { + float per = 3.; + p.xy *= rot(p.z*0.1); + p = mod(p, per)-per*0.5; + p.y += 0.5; + float pr = prim1(p); + p.yz *= rot(PI/2.); + float pr2 = prim1(p); + p.xy *= rot(PI/2.); + return min(min(pr,pr2),prim1(p)); + } + + float g2 = 0.; + float prim2 (vec3 p) + { + p.z -= time*4.; + + p.xy *= rot(time); + p.xy = abs(p.xy)-1.+sin(time)*0.3; + p.xz *= rot(time); + float od = dot(p,normalize(sign(p)))-.2; + g2 += 0.01/(0.01+od*od); + return od; + } + + float sdf (vec3 p) + { + return min(prim2(p),grid(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 += texture(texNoise,uv).r*0.1; + vec3 ro = vec3(0.001,0.001,-4.+time*4.), p=ro,rd=normalize(vec3(uv,1.)), col = vec3(0.); + + float shad = 0; + bool hit = false; + for (float i=0.; i<100.; i++) + { + float d = sdf(p); + if (d<0.001) + { + hit = true; + shad = i/100.; + break; + } + p += d*rd*0.6; + } + if (hit) + { + col = vec3(shad); + + } + col += g1*vec3(0.2,0.5,0.2)*0.08; + col += g2*vec3(0.3,0.,0.2); + out_color = vec4(col, 1.); +} \ No newline at end of file diff --git a/2019-11-30/06-nusan.glsl b/2019-11-30/06-nusan.glsl new file mode 100644 index 0000000..1485349 --- /dev/null +++ b/2019-11-30/06-nusan.glsl @@ -0,0 +1,162 @@ +#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=mod(fGlobalTime, 120); + +float box(vec3 p, vec3 s) { + p=abs(p)-s; + return max(p.x, max(p.y,p.z)); +} + +mat2 rot(float a) { + float ca=cos(a); + float sa=sin(a); + return mat2(ca,sa,-sa,ca); + } + +float tick(float t, float d) { + float g=t/d; + float c=fract(g); + c=smoothstep(0,1,c); + c=pow(c, 10); + return (c + floor(g))*d; +} + +vec3 fractal(vec3 p, float t1) { + + for(int i=0; i<3; ++i) { + float t=tick(t1, 0.3 + i*0.2)+i; + p.xz *= rot(t); + p.zy *= rot(t*1.3); + + p=abs(p); + p-=1.2 + sin(time*0.7)*0.6; + p.x += sin(time*0.3)*1; + } + return p; +} + + +float map(vec3 p) { + + vec3 bp=p; + + + float t=tick(time,1.3)*0.3; + p.xy *= rot(t); + p.zy *= rot(t*1.3); + + + + vec3 p2 = fractal(p, time*0.3); + + vec3 p3 = fractal(p+vec3(1,0,0.4), time*0.2); + + + float d=box(p2, vec3(0.4)); + + float d2=box(p3, vec3(2,0.3,0.6)); + + d=max(abs(d),abs(d2))-0.8; + + d=max(d, -bp.z-10); + d=max(d, bp.z-5); + + 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 *=rot(time*0.2 + tick(time,1.3)); + + vec3 s=vec3(0,0,-16); + float fov=0.9+sin(tick(time+0.2,0.5) + time * 0.2)*0.3; + vec3 r=normalize(vec3(-uv, fov)); + + vec3 p=s; + float at=0; + bool inside=false; + for(int i=0; i<100; ++i) { + float d=map(p); + if(d<0.001) { + inside=true; + break; + } + if(d>100) { + break; + } + p+=r*d; + at += 1.2/(1.2+abs(d)); + } + + if(inside) { + vec2 off=vec2(0.01,0); + vec3 n=normalize(map(p)-vec3(map(p-off.xyy), map(p-off.yxy), map(p-off.yyx))); + r=refract(r,n,0.5); + + } + + float dd=length(p-s); + vec2 uv2 = p.xy / (dd*r.z); + + vec3 col=vec3(0); + vec2 grid=step(fract(uv2*6),vec2(0.5)); + vec2 grid2 = abs(fract(uv2*12)-0.5)*2; + + float val=min(grid.x,grid.y); + val += 1-max(grid.x,grid.y); + + float anim=mod(time*0.5 - length(uv)*0.3, 4); + float pop=floor(anim); + + if(pop==1) { + val = step(0.9,max(grid2.x, grid2.y)); + } + + if(pop==3) { + val = step(0.2,sin(max(grid2.x, grid2.y)*13)); + } + + if(inside) { + val =1-val; + } + + col += val; + col *= at * 0.06; + + col*=1.3; + + col *= 1.2-length(uv); + + float t3 = pop*1.3 + time*0.2; + col.xy *= rot(t3); + col.yz *= rot(t3*0.7); + col=abs(col); + + col += max(vec3(0), col.yzx-1); + col += max(vec3(0), col.zxy-1); + + col = pow(col, vec3(0.4545)); + + + + out_color = vec4(col, 1); +} \ No newline at end of file diff --git a/2019-11-30/07-novac.glsl b/2019-11-30/07-novac.glsl new file mode 100644 index 0000000..4372a9f --- /dev/null +++ b/2019-11-30/07-novac.glsl @@ -0,0 +1,47 @@ +#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 d(vec2 uv, float ff){ + uv.x += sin(fGlobalTime*2); + uv.y += sin(fGlobalTime); + uv.x *= fract(uv.x *10 * cos(fGlobalTime )); + uv.y *= fract(uv.y *10 * sin(fGlobalTime )); + + uv.x += (1 + sin(fGlobalTime)) * 2 * ff; + uv.y += (1 + cos(fGlobalTime)) * 2 * ff; + + return step(length(uv), 0.2); +} + +void main(void) +{ + vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); + float texFFT = texture(texNoise, uv).r; + float rfft = texFFT; + uv -= 0.5; + uv /= vec2(v2Resolution.y / v2Resolution.x, 1); + float dd = d(uv, rfft); + vec4 color = vec4(dd,dd,dd,1); + color+=rfft; + out_color = color; +} \ No newline at end of file diff --git a/2019-11-30/08-anton.glsl b/2019-11-30/08-anton.glsl new file mode 100644 index 0000000..e04ce72 --- /dev/null +++ b/2019-11-30/08-anton.glsl @@ -0,0 +1,123 @@ +#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 ); +} + +mat2 rot(float a) +{ + float ca =cos(a); + float sa = sin(a); + return mat2(ca,-sa,sa,ca); + } + + #define PI 3.14159 + + + float m = 0; + +float map(vec3 p) +{ + float ft = fract(fGlobalTime); + float time = floor(fGlobalTime) + ft * ft; + + p *= 1. + sin(p.z * .1 + fGlobalTime) * .5; + + vec3 cp = p; + + p.z -= time * .01; + p.xy *= rot(p.z * (.1 + pow(sin(time * .1),2.) * .05 )); + + + p.z -= time * .01; + p.y = -abs(p.y); + + float amp = 1.; + + for(float i = 1.; i < 5.; ++i) + { + p.y += sin(p.x) * sin(p.z) * amp ; + amp *= .25; + p.xz *= rot(.4545 + time * .1 + i * 5.); + } + float dist = p.y + 2.; + + if(dist < .01) m = 1; +p = cp; + + p.xy *= rot(p.z * .2); + + p.x = abs(p.x); + p.x -= 2. + sin(p.z +time); + float cyl = length(p.xy) - .25; + if(cyl < .01) m = 2; + dist = min(dist, cyl); + + return dist; + } + +void ray(inout vec3 p, vec3 rd, out float st) +{ + for(st = 0.; st < 1.; st += 1. / 128.) + { + float cd = map(p); + if(cd < .01) + {break; + } + p += rd * cd * .5; + } + } + +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); + + for(float i = 1.; i < 5.; ++i) + { + uv.y = abs(uv.y); + uv -= .25; + uv *= rot(1. + fGlobalTime * .1); + } + float st; + vec3 ro = vec3(0.,0.,-10.); + vec3 rd = normalize(vec3(uv, 1.)); + vec3 cp = ro; + + ray(cp, rd, st); + + + if(st < 1.) + { + vec3 c = vec3(1.); + if( m == 1) c = vec3(.9,.3,.4); + if( m == 2) c = vec3(.04,.56,.8); + out_color = vec4(c, 0.) * st; + + out_color = pow(out_color, vec4(.4545)); + + out_color.rg *= rot(cp.z); + out_color.gb *= rot(cp.z * .25); + out_color.br *= rot(cp.z * .5); + out_color = abs(out_color); + + } + } \ No newline at end of file diff --git a/2019-11-30/09-ponk.glsl b/2019-11-30/09-ponk.glsl new file mode 100644 index 0000000..5183020 --- /dev/null +++ b/2019-11-30/09-ponk.glsl @@ -0,0 +1,78 @@ +#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 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 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 pos) { + pos.z = repeat(pos.z + time *2., 4.); + float scene = 1.; + vec3 p = pos; + const float count = 8.; + float range = 0.5; + float falloff = 1.5; + float a = 1.; + for (float index = count; index >0.; index--) { + pos = abs(pos)-range*a; + pos.xz *= rot(.1*time/a); + pos.yz *= rot(sin(16.*time/a)*.1); + scene = min(scene, max(pos.x, max(pos.y, pos.z))); + a /= falloff; + } + //scene = max(scene, -1.); + scene = abs(scene-.01); + scene = max(scene, length(p)-4.); + scene = max(scene, -length(p)+.5); + scene = max(scene, -length(p.xy)+.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); + vec3 eye = vec3(0,.0,-.2); + vec3 ray = normalize(vec3(uv, .1)); + ray.xy *= rot(sin(time)*.1); + ray.xz *= rot(sin(time*.2)*1.8); + vec3 pos = eye; + + + float shade = 0.; + const float count = 40.; + for (float index = count; index > 0.; index--) { + float d = map(pos); + if (d < 0.001) { + shade = index / count; + break; + } + pos += ray * d; + } + color.rgb += vec3(.8)+vec3(.9)*cos(vec3(.1,.2,.3)*(time*5.+shade*10.)); + color *= vec4(shade); +} \ No newline at end of file diff --git a/2019-11-30/Readme.md b/2019-11-30/Readme.md new file mode 100644 index 0000000..899df54 --- /dev/null +++ b/2019-11-30/Readme.md @@ -0,0 +1,25 @@ +# Friendly Shader Showdown @ GROW Paris 2019 + +On November 30th, 2019 during the [GROW Festival](https://www.grow.paris/) at [Le Tank](https://letank.fr/). + +## Rounds + +1. Anton vs +2. Kidou & Greckow vs +3. Nicoptere vs +4. SixClone vs +5. flopine vs +6. nusan vs +7. novac vs +8. anton vs +9. ponk vs + +## Tournament view + +``` +All duel where friendly with no judgment, only cheers. +``` + +## Software + +[Bonzomatic](https://github.com/Gargaj/Bonzomatic)