From 508151a20d23342235e3210015a331b6c6b5a8cc Mon Sep 17 00:00:00 2001 From: Julien De Loor Date: Mon, 2 Dec 2019 22:04:15 +0100 Subject: [PATCH] Added livecoding 2019-11-30 shader from lamogui laptop --- 2019-11-30/01-lamogui.glsl | 107 +++++++++++++++++++++ 2019-11-30/02-ponk.glsl | 93 ++++++++++++++++++ 2019-11-30/03-franzybily.glsl | 71 ++++++++++++++ 2019-11-30/04-col1.glsl | 91 ++++++++++++++++++ 2019-11-30/05-gaxil.dx11.hlsl | 86 +++++++++++++++++ 2019-11-30/06-lsdlive.glsl | 135 +++++++++++++++++++++++++++ 2019-11-30/07-monollonom-bg.glsl | 53 +++++++++++ 2019-11-30/08-hotdogstudio.glsl | 43 +++++++++ 2019-11-30/09-balec-aldwin.dx11.hlsl | 73 +++++++++++++++ 9 files changed, 752 insertions(+) create mode 100644 2019-11-30/01-lamogui.glsl create mode 100644 2019-11-30/02-ponk.glsl create mode 100644 2019-11-30/03-franzybily.glsl create mode 100644 2019-11-30/04-col1.glsl create mode 100644 2019-11-30/05-gaxil.dx11.hlsl create mode 100644 2019-11-30/06-lsdlive.glsl create mode 100644 2019-11-30/07-monollonom-bg.glsl create mode 100644 2019-11-30/08-hotdogstudio.glsl create mode 100644 2019-11-30/09-balec-aldwin.dx11.hlsl diff --git a/2019-11-30/01-lamogui.glsl b/2019-11-30/01-lamogui.glsl new file mode 100644 index 0000000..b42e227 --- /dev/null +++ b/2019-11-30/01-lamogui.glsl @@ -0,0 +1,107 @@ +#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 t = 0.0; + +mat3 rot(vec3 v, float a){ + float c = cos(a); + float s = sin(a); + float _c = 1.0 - c; + return mat3( c + _c * v.x * v.x, _c * v.x * v.y + s * _c * v.z, _c * v.x * v.z - s *v.y, + _c * v.x * v.y - s * v.z, c +_c * v.y * v.y, _c * v.x * v.z + s * v.y, +_c * v.x * v.z + s * v.y, _c * v.y * v.z - s * v.x, c + _c * v.z *v.z ); +} + + +float coscoscos(vec3 p ) +{ + vec3 g = rot(vec3(0.0,.0,1.0), p.z * 0.1) * p; + return cos(g.x) + cos(g.y) + cos(g.z); +} + + +float grass( vec3 p ){ + float id = textureLod(texNoise, floor(p.xz)/512.0, 0).r; + p.xz = mod(p.xz, 3.0) - 1.5; + + float h= p.y; + p = rot(vec3(0.,1.,0.),60. * id + 360.0 * fract(texture(texFFTIntegrated, 0.1).x * 0.01)) * p; + p = rot(vec3(1.,.0,.0), p.y * 0.2) * p; + return length(p.xz) - id + pow(h * 0.2, 4.0); + +} + +float map(vec3 p) { + float d = 1000000.0; + + d = min(d, p.y); + + d = min(d,coscoscos(p)); + float gs = 80.0; + vec3 pg = p * gs; + d = min(d, grass(pg) / gs); + d = min(d, grass(pg + vec3( 5.15856418916, 0.0, 7.4781)) / gs); + d = min(d, grass(pg - vec3( 3.018, 0.0, 2.0015)) / gs); + + return d; +} +vec3 grad( vec3 p ){ + vec2 e =vec2(0.01, 0.0); + float d = map(p); + return normalize(vec3(d-map(p+e.xyy), d -map(p+e.yxy), d - map(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 t = texture(texFFTIntegrated, 0.3).r; + vec3 ro = vec3(0.0,0.2,fGlobalTime * 0.3); + vec3 rd = normalize(vec3(uv, 0.7 - length(uv))); + float st = 1.0; + vec3 p = ro; + for (float i = 0.0; i < 256.0; ++i){ + float d = map(p); + if ( abs (d) < 0.001) { + st = i/256.0; + break; + } + p += rd * 2.0 *d * i / 256.0; +} + vec3 color = mix(vec3(0.4,1.0,0.6) * st, vec3(1.0), 0.01 * distance(ro, p)) ; + +if ( abs(coscoscos(p)) < 0.1) { + + float st2 = 1.0; +vec3 n = grad(p); +vec3 rd2 = reflect(rd, n); +vec3 ro2 = p + rd2 * 0.1; + vec3 p2 = ro2; + for (float i = 0.0; i < 256.0; ++i){ + float d = map(p2); + if ( abs (d) < 0.001) { + st = i/256.0; + break; + } + p2 += rd2 * 2.0 *d * i / 256.0; +} +color += mix(vec3(0.4,1.0,0.6) * st, vec3(1.0), 0.01 * distance(ro, p2)); +} + +//color = pow(color, vec3(1.0/1.8)); + out_color = vec4(color, 1.0); +} \ No newline at end of file diff --git a/2019-11-30/02-ponk.glsl b/2019-11-30/02-ponk.glsl new file mode 100644 index 0000000..d92a630 --- /dev/null +++ b/2019-11-30/02-ponk.glsl @@ -0,0 +1,93 @@ +#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 + +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 ); + + +} + +mat2 rot (float a) { + float c=cos(a); + float s = sin(a); + return mat2(c,s,-s,c); +} + +#define repeat(p,r) (mod(p,r)-r/2.) + +float map (vec3 p) { + p.z = repeat(p.z+time*1., 4.); + float scene = 10.; + float wave = sin(time*4.)*.5+.5; + float wave2 = sin(time*12.)*.5+.5; + const float count = 6.; + float range = 1.; + float a = 1.; + float falloff = 1.8; + vec3 op = p; + for (float i = count; i > 0.; i--) { + p.xz *= rot(time*.1); + p.yz *= rot(time*.2); + p.yx *= rot(time*.3); + //p.yx *= rot(sin(time*8.)*.1); + p = abs(p)-(range)*a; + scene = min(scene, length(p.xy)-(.4-.01*wave2)*a); + scene = min(scene, length(p)-(.9-.01*wave2)*a); + a /= falloff; + } + scene = abs(scene) - .001; + scene = max(scene, -length(op.xy)+.4); + return scene; +} + +vec3 getNormal (vec3 p) { + vec2 e = vec2(.001,0); + return normalize(vec3(map(p+e.xyy)-map(p-e.xyy), map(p+e.yxy)-map(p-e.yxy), map(p+e.yyx)-map(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); + + vec3 eye = vec3(0,0,-2); + float wave = sin(time*8.)*.5+.5; + vec3 ray = normalize(vec3(uv,.3)); + ray.xz *= rot(sin(time*.6)*.2); + ray.yz *= rot(sin(time*.3)*.1); + vec3 pos = eye; + float shade = 0.; + const float count = 40.; + for (float index = count; index > 0.; index--) { + float d = map(pos); + if (d < 0.01) { + shade = (index / count); + break; + } + pos += ray * d; + } + vec3 normal = getNormal(pos); + //color.rgb = normal * .5 + .5; + color.rgb += vec3(.2,.8,.9) * clamp(dot(normal, -ray), 0., 1.); + color.rgb += vec3(2) * pow(clamp(dot(normal, vec3(0,0,-1))*.5+.5, 0., 1.), 24.); + color *= shade; +} \ No newline at end of file diff --git a/2019-11-30/03-franzybily.glsl b/2019-11-30/03-franzybily.glsl new file mode 100644 index 0000000..1ae5e3f --- /dev/null +++ b/2019-11-30/03-franzybily.glsl @@ -0,0 +1,71 @@ +#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 RND(float n){ + + float r = sin(n+12345.67)+sin(n*4.+3256.); + return fract(r); + +} + +float randd(float n){ + + float c = fract(n); + return mix(RND(n),RND(n+1),c); +} + +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 ); +} +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 *= 2.; + float t = fGlobalTime*2.; + t = floor(t) + smoothstep(0.,1.,fract(t)); + + + float V = 0.; + vec3 C = vec3(0); + int count = 10; + for(int i = 0; ip.x)p=p.yx; +} + + +void amod(inout vec2 p,float a){ + float m=re(atan(p.x,p.y),a); + p = vec2(cos(m),sin(m))*length(p); +} + + +float g; +float g1; +float de(vec3 p){ + // p.xz*=r2d(time); + //p.xy*=r2d(time*.5); + + p.z=re(p.z,1.5 + ); + + + p.x=abs(p.x)-2.; + p.xy*=r2d(time); + + amod(p.xy, 6.28/5.); + + //p.xy*=r2d(p.z*.5); + //p.x=abs(p.x)-8.; + + + vec3 q=p; + //p.xy*=r2d(p.z*.3); + p.x=abs(p.x)-4; + amod(p.xy, 6.28/7.); + mo(p.xz, vec2(1, 2)); + mo(p.xy, vec2(1.2, 2.)); + amod(p.xy, 6.28/3.); + p.xy*=r2d(p.z*.3); + p.x = abs(p.x) - 1; + p.xy*=r2d(3.14*.25); + + float d1 = sc(p,.2); + + g1+=.01/(.01+d1*d1); + + + p=q; + + re(p.z,2.); +amod(p.xy, 6.28/8.); +mo(p.xy, vec2(7)); + amod(p.xy, 6.28/3.); + mo(p.xy, vec2(1, 2)); + float d2 = dot(p,normalize(sign(p)))-.5; + + float d = min(d2,d1); + + + g+=.01/(.01+d2*d2); + + p=q; + + p.xy*=r2d(p.z*.1); + p.x=abs(p.x)-8.; + d = min(d,length(p.xy)-1.); + g+=.01/(.01+d2*d2); + + return d; + + return length(p)-.5 - sin(time); +} + +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*=sin(time); + uv*=r2d(time*2); + + + vec3 ro=vec3(0,0,-3 + time * 12.),rd=normalize(vec3(uv,.3-length(uv) + tan(sin(time*2.)))),p; + + float t=0,i=0.; + for(;i<1;i+=.01){ + p=ro+rd*t;; + float d=de(p); + //if(d<.001) break; + d=max(abs(d),.001); + t+=d*.3; + } +vec3 c=mix(vec3(.9, .3, .2), vec3(.4,.12,.1), length(7.*uv.x)+i); + + c+=g*.04; + c+=g1*.1*vec3(.1, .5, .5); + out_color = vec4(c,1); +} \ No newline at end of file diff --git a/2019-11-30/07-monollonom-bg.glsl b/2019-11-30/07-monollonom-bg.glsl new file mode 100644 index 0000000..3f9f6da --- /dev/null +++ b/2019-11-30/07-monollonom-bg.glsl @@ -0,0 +1,53 @@ +#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 + +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 circle(vec2 uv, float id) { + return smoothstep(length(uv - 0.5), cos(time * 5 + id) * 0.1 + 0.2, cos(time * 5 + id) * 0.1 + 0.21); +} +void main(void) +{ + // on connait rien en shader + // soyez sympa + // on est deux parce que... + + vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); + uv -= 0.5; + uv /= vec2(v2Resolution.y / v2Resolution.x, 1); + + uv.y += sin(time); + uv += vec2(cos(time * 0.1), 0.0); + float angle = time * 0.1; + mat2 autreTruc = mat2(cos(angle), sin(angle), -sin(angle), cos(angle)); + + uv *= autreTruc; + + // il est sympa il nous aide + vec2 truc = floor(uv * 10); + float id = dot(truc, vec2(1.0, 5.0)); + uv = fract(uv * 10); + + // on est chaud + out_color = vec4(circle(uv, id), circle(uv, id), circle(uv, id) * cos(time) * .5 + .5, 1.0); + out_color = 1.0 - out_color; +} \ No newline at end of file diff --git a/2019-11-30/08-hotdogstudio.glsl b/2019-11-30/08-hotdogstudio.glsl new file mode 100644 index 0000000..65b5eb2 --- /dev/null +++ b/2019-11-30/08-hotdogstudio.glsl @@ -0,0 +1,43 @@ +#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 ); +} +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 = fract(uv.x * uv.y * 30.); + uv.y = fract(uv.x * uv.y * 20.); + + vec4 tex = texture(texNoise, uv); + + float d = length(uv * sin(fGlobalTime)) - 0.5; + + if (d < 0) { + tex = 1. - tex; + } else { + tex = vec4(0.0); + } + + out_color = tex; +} \ No newline at end of file diff --git a/2019-11-30/09-balec-aldwin.dx11.hlsl b/2019-11-30/09-balec-aldwin.dx11.hlsl new file mode 100644 index 0000000..8746240 --- /dev/null +++ b/2019-11-30/09-balec-aldwin.dx11.hlsl @@ -0,0 +1,73 @@ +Texture2D texChecker; +Texture2D texNoise; +Texture2D texTex1; +Texture2D texTex2; +Texture2D texTex3; +Texture2D texTex4; +Texture1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq +Texture1D texFFTSmoothed; // this one has longer falloff and less harsh transients +Texture1D texFFTIntegrated; // this is continually increasing +SamplerState smp; + +cbuffer constants +{ + float fGlobalTime; // in seconds + float2 v2Resolution; // viewport resolution (in pixels) +} + +float4 plas( float2 v, float time ) +{ + float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 ); + return float4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 ); +} + +float Spaget(float2 pos, float offset) +{ + + float2 uvPos = 0.5 + float2(sin(pos.x * 6.28f)*0.03, cos(pos.x * 6.28f)*0.03); + + float val = texNoise.Sample(smp, uvPos+float2(0.0f, offset)); +// float val = texNoise.Sample(smp, float2(pos.x, 0.0f)); + + return val; + +} + + + +float4 main( float4 position : SV_POSITION, float2 TexCoord : TEXCOORD ) : SV_TARGET +{ + float2 uv = TexCoord; + uv -= 0.5; + + uv /= float2(v2Resolution.y / v2Resolution.x, 1); + + float4 col1 = float4(0.1, 0.3, 0.6, 1); + float4 col2 = float4(0.8, 0.2, 0.1, 1); + + float4 col=col1; + +// col = lerp(col, float4(0.8, 0.7, 0.0, 1.0), smoothstep(0.2, 0.3, length(uv)); + + + for (int i=0;i<10;i++) + { + float2 finalUV = uv + float2(fGlobalTime*(i+3)*0.05, 0.0); + finalUV.x *= 0.5; + + float val = Spaget(finalUV, i*0.05)-0.25-i*0.02; + val *=2; + float3 locColor = lerp(col1, col2, i*0.18); + locColor *= smoothstep(-1.0,0.5, uv.y); + + + + + col.rgb = lerp(col.rgb, locColor, (smoothstep(-1,val, uv.y)) * (smoothstep(val+0.15,val+0.145, uv.y))); + + } + + + + return col; +} \ No newline at end of file