diff --git a/2018-04-07/.vedarc b/2018-04-07/.vedarc new file mode 100644 index 0000000..92e7bac --- /dev/null +++ b/2018-04-07/.vedarc @@ -0,0 +1,12 @@ +{ + "IMPORTED": { + "guinness": { + "PATH": "./guinness.png", + }, + }, + "pixelRatio": 1, + "audio": true, + "camera": true, + "keyboard": false, + "midi": false, +} diff --git a/2018-04-07/01-elie.frag b/2018-04-07/01-elie.frag new file mode 100644 index 0000000..5e8d22d --- /dev/null +++ b/2018-04-07/01-elie.frag @@ -0,0 +1,56 @@ +precision mediump float; + +uniform float time; +uniform vec2 resolution; +uniform sampler2D camera; +uniform sampler2D key; +uniform sampler2D samples; +uniform sampler2D spetrum; + +mat2 rot(float a) +{ + float c = cos(a), s = sin(a); + return mat2(c, s, -s, c); +} + +vec3 circle(vec2 uv, vec2 pos,float r, float s){ +vec3 res = vec3 (smoothstep(r,r+s,length(uv-pos))); +return res; +} + +void main () { + vec2 uv = gl_FragCoord.xy / resolution.xy; + vec2 uv0 = uv; + + uv.x += sin(uv.y) / uv.y * exp(sin(time * 0.3)) * 0.5; + uv.y += sin(uv.x) / uv.x * 0.1; + + uv -= .5; + uv.x *= resolution.x / resolution.y; + float a = atan(uv.y, uv.x), + d = length(uv); + a=a/6.2831+.5; + d-=time*.1; + + float a0 = a + fract(d); + float r1 = sin(time) + sin(a * 31.4); + float r2 = sin(time + 3.14) + sin(a0 * 31.4 + 1.51 * pow(sin(time + a0 * 32.), 2.)); + float r3 = sin(time + 3.14) + sin(-a0 * 31.4 + 1.51 * pow(sin(-time - a0 * 32.), 2.)); + vec3 c1 = circle (uv0.xy, vec2(0.5,0.5),r1,0.35); + vec3 c2 = circle (uv0.xy, vec2(0.5,0.5),r2,0.5); + vec3 c3 = circle (uv0.xy, vec2(0.5,0.5),r3,0.5); + c1-=c2; + + vec3 color = texture2D(camera, vec2(a, fract(d))).rgb; + vec3 color2 = texture2D(camera, vec2(a, fract(d)) * 2.).rgb; + + //color -= color2 * 0.5; + + color.x*=1./(c1.x); + color.y *= 1./c2.x; + color.b *= c3.r; + + //color -= color2 * 2.; + + gl_FragColor = vec4(color,1.); +} diff --git a/2018-04-07/02-koltes.frag b/2018-04-07/02-koltes.frag new file mode 100644 index 0000000..12957f8 --- /dev/null +++ b/2018-04-07/02-koltes.frag @@ -0,0 +1,89 @@ +/* +{"IMPORTED": { + "guinness": { + "PATH": "./guinness.png", + }, + }, + "pixelRatio": 1.5, + "audio": true, + "camera": true, + "keyboard": true, + "midi": true, +} +*/ +precision mediump float; + +uniform float time; +uniform vec2 resolution; +uniform sampler2D camera; +uniform sampler2D key; +uniform sampler2D samples; +uniform sampler2D spetrum; + +uniform sampler2D guinness; + +mat2 rot(float a) +{ + float c = cos(a), s = sin(a); + return mat2(c, s, -s, c); +} + +struct D { + float d; + vec3 c; + float m; +}; + +D map(vec3 p){ + p.xy *= rot(time * .3 + p.z * .01); + p.yz *= rot(time * .5); + float rp=4. + sin(time) * 2.; + vec3 idx=floor((p+rp)/rp/2.); + p = mod(p + rp, 2.*rp) - rp; + + p.xy *= rot(time * sin(idx.x)); + p.yz *= rot(time * sin(idx.y)); + + D d; + float r = mix(.8,1.,smoothstep(-1.,1.,p.y)-.5); + d.d= length(p.xz) - r; + d.d = max(d.d, abs(p.y)-1.5); + float a=(atan(p.z,p.x)/6.2831+.5)*2.; + vec4 logo = texture2D(guinness, vec2(a, p.y * 1.)); + logo.rgb=mix(logo.rgb, 1.-logo.rgb, 1.-length(logo.rgb)); + vec3 blk=mix(vec3(.1), logo.rgb, logo.a); + d.c=mix(blk,vec3(1),step(1.2,p.y)); + + d.m = mix(.01, .05, step(0., length(p.xz) - r - .2)); + return d; +} + +vec3 pal(float t, vec3 a, vec3 b, vec3 c, vec3 d){ + return a+b*cos(6.2831*(c*t+d)); +} + +void main () { + vec2 uv = gl_FragCoord.xy / resolution.xy; + uv -= .5; + uv.x *= resolution.x / resolution.y; + + vec3 ro=vec3(0,0,-8), + rd=normalize(vec3(uv,1.-length(uv*.5))), + mp=ro + rd * 6.; + float ff; + D d; + vec3 c; + for (float f=0.;f<50.;f+=1.){ + ff = f; + d=map(mp); + if (abs(d.d)<.001)break; + if (d.d<.5) + c += d.c; + mp+=max(d.d, d.m)*rd; + } + c *= .05; + //c *= 1. - ff/50.; + vec3 green = pal(time*.2 - length(uv), vec3(.2, .8, .3), vec3(.2), vec3(1., 3., 2.), vec3(0.)); + //c = mix(green, c, 1.-smoothstep(45., 49., ff)); + gl_FragColor = vec4(c,1); + } diff --git a/2018-04-07/03-elie.frag b/2018-04-07/03-elie.frag new file mode 100644 index 0000000..8d93e85 --- /dev/null +++ b/2018-04-07/03-elie.frag @@ -0,0 +1,93 @@ +/* +{"IMPORTED": { + "guinness": { + "PATH": "./guinness.png", + }, + }, + "pixelRatio": 1, + "audio": true, + "camera": false, + "keyboard": true, + "midi": true, +} +*/ +precision mediump float; + +uniform float time; +uniform vec2 resolution; +uniform sampler2D camera; +uniform sampler2D key; +uniform sampler2D samples; +uniform sampler2D spetrum; + +uniform sampler2D guinness; + +mat2 rot(float a) +{ + float c = cos(a), s = sin(a); + return mat2(c, s, -s, c); +} + +struct D { + float d; + vec3 c; +}; + +D map(vec3 p){ + p.xy *= rot(time * .3 + p.z * .01); + p.yz *= rot(time * .5); + D d; + d.d= length(p.xz) - 0.5; + d.c=vec3(1); + + float t = time * 0.01; + float t2 = time * 1.; + p.yz *= sin(exp((sin(t2) * sin(t2) + sin(t2 * 1.41) * sin(t2 * 1.41)) * 0.5) * 0.2 * p.x); + + for (float z = 0. ; z < 5. ; z += 1.) { + float c = cos(t + 0.1 + z * 0.2); + float s = sin(t + 0.1 + z * 0.2); + p.xy *= mat2(c, s, -s, c); + d.d = min(d.d, length(p.yz) - 0.5); + } + + + return d; +} + +vec3 pal(float t, vec3 a, vec3 b, vec3 c, vec3 d){ + return a+b*cos(6.2831*(c*t+d)); +} + +void main () { + vec2 uv = gl_FragCoord.xy / resolution.xy; + uv -= .5; + uv.x *= resolution.x / resolution.y; + + vec3 ro=vec3(0,0,-8), + rd=normalize(vec3(uv,1.-length(uv*.5))), + mp=ro + rd * 6.; + float ff; + D d; + vec3 c; + for (float f=0.;f<50.;f+=1.){ + ff = f; + d=map(mp); + if (abs(d.d)<.001)break; + if (d.d<.5) + c += d.c; + mp+=d.d*rd; + } + c *= .05; + + vec3 b = vec3(1.0); + float tt = step(mod(time * 10., 5.), 4.); + float ttt = step(mod(time * 5., 5.), 4.); + b = mix(vec3(1.0, ttt / 5., 0.0), b, 0.8 + tt * 0.1); + c = pal(ff/30., vec3(1.0), b, vec3(0.5, 0.3, 0.1), vec3(0.5)); + + //c *= mix(c, 1. - c, pow(normalize(length(c)), 0.2)); + c *= mix(c, 1. - c, c.g * 3.); + + gl_FragColor = vec4(c,1); + } diff --git a/2018-04-07/04-elie.frag b/2018-04-07/04-elie.frag new file mode 100644 index 0000000..93e7f1a --- /dev/null +++ b/2018-04-07/04-elie.frag @@ -0,0 +1,51 @@ +/* +{"IMPORTED": { + "guinness": { + "PATH": "./guinness.png", + }, + }, + "pixelRatio": 1, + "audio": true, + "camera": false, + "keyboard": true, + "midi": true, +} +*/ +precision mediump float; + +uniform float time; +uniform vec2 resolution; +uniform sampler2D camera; +uniform sampler2D key; +uniform sampler2D samples; +uniform sampler2D spetrum; + +uniform sampler2D guinness; + +mat2 rot(float a) +{ + float c = cos(a), s = sin(a); + return mat2(c, s, -s, c); +} + +vec3 pal(float t, vec3 a, vec3 b, vec3 c, vec3 d){ + return a+b*cos(6.2831*(c*t+d)); +} + +void main () { + vec2 uv = gl_FragCoord.xy / resolution.xy; + //uv -= .5; + // + uv.x *= resolution.x / resolution.y; + + float d = length(uv - vec2(0.5, 0.5)); + + + uv.x += sin(2. * time + uv.x * 10.) * sin(exp(sin(time * 1. + uv.x * 10.)) + uv.y * 10.); + + vec3 c = vec3(uv, 0.); + + c *= 1. - step(d, .05); + + gl_FragColor = vec4(c,1); + } diff --git a/2018-04-07/05-adrian.frag b/2018-04-07/05-adrian.frag new file mode 100644 index 0000000..25e6a51 --- /dev/null +++ b/2018-04-07/05-adrian.frag @@ -0,0 +1,71 @@ +/* +{"IMPORTED": { + "guinness": { + "PATH": "./guinness.png", + }, + }, + "pixelRatio": 1, + "audio": true, + "camera": false, + "keyboard": true, + "midi": true, +} +*/ +precision mediump float; + +uniform float time; +uniform vec2 resolution; +uniform sampler2D camera; +uniform sampler2D key; +uniform sampler2D samples; +uniform sampler2D spetrum; + +uniform sampler2D guinness; + +mat2 rot(float a) +{ + float c = cos(a), s = sin(a); + return mat2(c, s, -s, c); +} + +vec3 pal(float t, vec3 a, vec3 b, vec3 c, vec3 d){ + return a+b*cos(6.2831*(c*t+d)); +} + +void main () { + vec2 uv = gl_FragCoord.xy / resolution.xy; + //uv -= .5; + // + float width = resolution.x / resolution.y; + uv.x *= resolution.x / resolution.y; + + //float xCircle = vec2((0.5+0.5*sin(1.*time)) * width * 0.5; + // + float timeOffset = 0.; + float minDist = 10000.; + for (int i = 0; i < 40; i += 1) + { + timeOffset += 0.024; + vec2 happy = vec2((0.5+0.2*sin(2.7*(time+timeOffset))) * width, (0.5+0.2*cos(0.2+1.9*(time+timeOffset)))); + minDist = min(minDist, length(uv - happy) + (0.016*40. - timeOffset) * .1 ); + } + float d = length(uv - vec2((0.5+0.3*sin(1.*time)) * width, (0.5+0.3*cos(0.2+1.3*time)))); + //float d1 = length(uv - vec2((0.5+0.2*sin(2.7*time)) * width, (0.5+0.2*cos(0.2+1.9*time)))); + + + + uv.x += sin(2. * time + uv.x * 10.) * sin(exp(sin(time * 1. + uv.x * 10.)) + uv.y * 10.); + + vec3 c = vec3(uv, 0.); + + //c *= 1. - (step(min(minDist, d), .05)); + c *= 1. - (smoothstep(min(minDist, d), .015, 0.075)); + + float t = sin(time) * sin(time) + sin(3.14 * time * uv.y) * sin(3.14 * time); + c = pal(c.x, vec3(0.5), vec3(0.5, 1.0, 0.3), vec3(1.0, 0.5, 0.4 + t * 0.2), vec3(0.5)); + + + + vec4 almost = vec4(c,1) * (uv.x * cos(mod(time, 3.14 * 2.)) - uv.y * sin(mod(-time, 3.14 * 2.))); + gl_FragColor = almost ; + } diff --git a/2018-04-07/06-jeanmichel.frag b/2018-04-07/06-jeanmichel.frag new file mode 100644 index 0000000..e20621a --- /dev/null +++ b/2018-04-07/06-jeanmichel.frag @@ -0,0 +1,97 @@ +/* +{"IMPORTED": { + "guinness": { + "PATH": "./guinness.png", + }, + }, + "pixelRatio": 2, + "audio": true, + "camera": false, + "keyboard": true, + "midi": true, +} +*/ +precision mediump float; + +uniform float time; +uniform vec2 resolution; +uniform sampler2D camera; +uniform sampler2D key; +uniform sampler2D samples; +uniform sampler2D spetrum; + +uniform sampler2D guinness; + +mat2 rot(float a) +{ + float c = cos(a), s = sin(a); + return mat2(c, s, -s, c); +} + +vec3 circle(vec2 uv, vec2 pos, float r, float s){ + +vec3 res = vec3(smoothstep(r,r-s,length(uv+pos)-r)); +return res; +} + + +void main () { + + vec2 uv = gl_FragCoord.xy / resolution.xy; + uv-=0.5; + uv.x *= resolution.x / resolution.y; + + vec3 res; + + + for (float i=0.; i<100.;i+=1.){ + vec2 pos=vec2(0.5*sin(time+i),0.5*cos(0.5*time+i)); + vec3 col =circle (uv.xy,pos,0.02,0.01); + col.x*=i; + res+= col; + + } + + for (float i=0.; i<100.;i+=1.){ + vec2 pos=vec2(0.5*sin(time+i),0.5*cos(0.5*time+i)); + + res-= circle (uv.xy,pos,0.01,0.01); + } + + for (float i=0.; i<100.;i+=1.){ + vec2 pos=vec2(0.5*sin(time+i+3.14),0.5*cos(0.5*time+i)); + vec3 col =circle (uv.xy,pos,0.02,0.01); + col.x*=i; + res+= col; + + } + + for (float i=0.; i<100.;i+=1.){ + vec2 pos=vec2(0.5*sin(time+i+3.14),0.5*cos(0.5*time+i)); + + res-= circle (uv.xy,pos,0.01,0.01); + } + + + for (float i=0.; i<100.;i+=1.){ + vec2 pos=vec2(0.5*sin(time+i+3.14*0.5),0.5*cos(0.5*time+i)); + vec3 col =circle (uv.xy,pos,0.02,0.01); + col.x*=i; + res+= col; + + } + + for (float i=0.; i<100.;i+=1.){ + vec2 pos=vec2(0.5*sin(time+i+3.14*0.5),0.5*cos(0.5*time+i)); + + res-= circle (uv.xy,pos,0.01,0.01); + } + + + + + + + + gl_FragColor=vec4(res,1.); + } diff --git a/2018-04-07/07-koltes.frag b/2018-04-07/07-koltes.frag new file mode 100644 index 0000000..2d5364f --- /dev/null +++ b/2018-04-07/07-koltes.frag @@ -0,0 +1,69 @@ +/* +{"IMPORTED": { + "guinness": { + "PATH": "./guinness.png", + }, + }, + "pixelRatio": 2, + "audio": true, + "camera": false, + "keyboard": true, + "midi": true, +} +*/ +precision mediump float; + +uniform float time; +uniform vec2 resolution; +uniform sampler2D camera; +uniform sampler2D key; +uniform sampler2D samples; +uniform sampler2D spetrum; + +uniform sampler2D guinness; + +mat2 rot(float a) +{ + float c = cos(a), s = sin(a); + return mat2(c, s, -s, c); +} + +#define rand(x) fract(sin(x)*1e4) + +float map(vec3 p){ + p.z -= time * 5.; + p.xy *= rot(p.z * .05); + vec3 idx=floor((p)/6.); + p = mod(p, 6.) - 3.; + p.xz *= rot(time * .5 + sin(idx.x)); + p.xy *= rot(time * .8 + sin(idx.y)); + p.yz *= rot(time * .8 + sin(idx.z)); + //p.xy += -2. + 4.*rand(idx.xy + vec2(0., 3.)); + float a=atan(p.y,p.x)/6.2831; + a+=1./8.; + a=floor(a*4.)/4.; + p.xy*=rot(a*6.2831); + p.x-=abs(p.y)*.8+.9; + p.y*=1.2; + p.z=sqrt(abs(p.z)*3.); + return length(p)-1.; +} + + +void main () { + + vec2 uv = gl_FragCoord.xy / resolution.xy; + uv-=0.5; + uv.x *= resolution.x / resolution.y; + + vec3 ro=vec3(0,0,-5),rd=normalize(vec3(uv,1.-length(uv)*.5)),mp=ro+rd*3.; + float ff; + for (float f=0.;f<30.;++f){ + ff=f; + float d=map(mp); + if (d<0.01)break; + mp+=rd*d; + } + vec3 c=mix(vec3(0,1,0) *(1. -ff/30.), vec3(0), smoothstep(25.,30.,ff)); + gl_FragColor=vec4(c,1.); + } diff --git a/2018-04-07/Readme.md b/2018-04-07/Readme.md new file mode 100644 index 0000000..ebab1a8 --- /dev/null +++ b/2018-04-07/Readme.md @@ -0,0 +1,19 @@ +# Shader Showdown Paris #7 + +On April 7th, 2018 at [O'Regans, Laval, France](https://www.facebook.com/ORegans-135863436463053/). + +[Video on YouTube](https://youtu.be/6ul-jeLTQbM) + +## Exquisite Shader + +1. Elie +2. Koltes +3. Elie +4. Elie +5. Adrian +6. Jean-Michel +7. Koltes + +## Software + +- [VEDA](https://veda.gl/) (`.frag`) diff --git a/2018-04-07/guinness.png b/2018-04-07/guinness.png new file mode 100644 index 0000000..b6e3134 Binary files /dev/null and b/2018-04-07/guinness.png differ