diff --git a/2019-01-30/Nusan_300119.glsl b/2019-01-30/Nusan_300119.glsl new file mode 100644 index 0000000..ea7f97f --- /dev/null +++ b/2019-01-30/Nusan_300119.glsl @@ -0,0 +1,155 @@ +#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 box(vec3 p, vec3 s){ + vec3 ap=abs(p)-s; + return length(max(vec3(0), ap)) + min(0, max(ap.x, max(ap.y,ap.z))); +} + +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*456.232)*8956.233); +} + +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 mat = 0; +float map(vec3 p) { + + vec3 bp=p; + + p.y += pow(abs(sin(time))*3,2); + vec3 rp = p; + + + float scale = abs(curve(time, 0.8)-0.5)*2; + scale = smoothstep(0,1,scale); + scale += 0.3; + for(int i=0; i<5; ++i) { + rp = p; + float t1 = time * 0.7; + p -= 0.2*scale+i*0.2*scale; + p.xy *= rot(t1*0.7); + p -= 0.3*scale+i*0.3*scale; + p.yz *= rot(t1); + p=abs(p); + p -= 0.4*scale+i*0.5*scale; + } + + float b = box(p, vec3(0.5,0.3,0.7)); + float b2 = box(rp, vec3(0.5,0.5,10.0)*1); + float b3 = max(b, -b2); + + float ground = 1-bp.y; + ground=smin(ground, -b3, -5.5); + + mat = b3100) { + none=0; + break; + } + p+=r*d; + at += 0.3*exp(-d*1.9); + } + col += none * vec3(0.2,0.2,0.5); + col += at*0.008*vec3(1,0.7,0.2); + + col *= 5; + col = 1-exp(-col); + col = pow(col, vec3(1.2)); + + out_color = vec4(col, 1); +} \ No newline at end of file diff --git a/2019-01-30/anatole 1.glsl b/2019-01-30/anatole 1.glsl new file mode 100644 index 0000000..82f58b9 --- /dev/null +++ b/2019-01-30/anatole 1.glsl @@ -0,0 +1,87 @@ +#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 +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) { + float d = dot( cos(p.xyz), sin(p.zxy)) + cos(p.y*20.)*.01+.75; + d = min(d, length(p.xy+vec2(cos(p.z)-1., sin(p.z)))-.1); + return d; +} + +mat2 rot(float v) +{ + float a = cos(v); + float b = sin(v); + + return mat2(a,b,-b,a); +} + +void main(void) +{ + vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); + vec2 v = uv; + uv -= 0.5; + uv /= vec2(v2Resolution.y / v2Resolution.x, 1); + uv = uv*2.; + float impuls = pow(texture2D(texNoise, vec2(0., time*1.1)).r, 10.)*5000.; + uv.x += impuls * (texture2D(texNoise, vec2(uv.y, time*.1)).g*2.-1.)*.3; + + uv = abs(uv); + uv = rot(time*.5) * uv; + uv = abs(uv); + uv = rot(-time*.25) * uv; + uv = abs(uv); + uv += vec2(cos(time)*.1); + uv = rot(-time*.175) * uv; + uv = abs(uv); + uv = rot(time*.175) * uv; + uv = abs(uv); + uv = rot(-time*.25) * uv; + uv = abs(uv); + + uv = mix(uv, v*2.-1., max(0.,cos(time*.1))); + + vec3 ro = vec3(1., 0., fGlobalTime); + vec3 rd = normalize( vec3(uv, 1.)); + + vec3 p = ro; + + for(int i=0; i<64; i++) { + p += rd * map(p); + } + vec3 col = vec3(1.,.7,.3) * max(0.,map(p)-map(p+vec3(-1.,-.7,.25)*.5))*3.; + col += vec3(v.x*cos(time),1.+uv.y*.5*sin(time)-v.x*.5,.5) * (1.-exp(-length(ro-p)*.1)); + col *= 2.*mix(vec3(cos(uv.x+time*.1),cos(uv.y+uv.x+time),sin(time))*.5+.5, vec3(1.), 1.-5.*impuls) * exp(-length(ro-p)*.1); + + if( abs(cos(length(uv)-time*.82)) < .1) { + col = col.brg; + } + if( abs(sin(length(uv+.5)+time*.82)) < .1) { + col = col.gbr; + } + + col *= pow(v.x*v.y*(1.-v.x)*(1.-v.y), .15); + + out_color = vec4(col, 1.); +} \ No newline at end of file diff --git a/2019-01-30/anatole 2.glsl b/2019-01-30/anatole 2.glsl new file mode 100644 index 0000000..85b5240 --- /dev/null +++ b/2019-01-30/anatole 2.glsl @@ -0,0 +1,135 @@ +#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 +mat2 rot(float v) +{ + float a = cos(v); + float b = sin(v); + + return mat2(a,b,-b,a); +} + + +float fbm( vec2 p ) +{ + float d = texture2D(texNoise, p).r *.5; + d += texture2D(texNoise, p*2.).r *.25; + d += texture2D(texNoise, p*4.).r *.125; + + return d; + +} + +float flotte(vec3 p) +{ + //p.xy = rot(p.z)*p.xy; + return -abs(p.y)+.7 + fbm(p.xz*.1)*.1; +} + +float terrain( vec3 p ) +{ + p.xy = rot(p.z)*p.xy; + float d = -abs(p.y)-1.; + d += fbm(p.xz*.05)*10.; + + return d; +} + +float map(vec3 p) +{ + + float d = min(terrain(p), flotte(p)); + + return d*.6; +} + + +vec3 normal(vec3 p) +{ + vec2 eps = vec2(0.01, 0.); + float d = map(p); + vec3 n; + n.x = d - map(p-eps.xyy); + n.y = d - map(p-eps.yxy); + n.z = d - map(p-eps.yyx); + + return normalize(n); +} +vec3 raymarch(vec3 ro, vec3 rd) +{ + + vec3 p = ro; + + for(int i=0; i<64; i++) + { + p += rd * map(p); + } + + return p; +} + +vec3 shade(vec3 ro, vec3 rd, vec3 p , vec3 n) +{ + + vec3 ld = normalize(vec3(0.5,1.,1.)); + vec3 albedo = mix(vec3(.2,.1,.1)*2., vec3(0.5,1.,0.), pow(abs(n.y), 4.)); + + float shad = step(1.,length(raymarch(p+ld*.1, ld)-p)); + vec3 dif = vec3(1.,.7,.1) * max( dot(n, ld), 0.) ; + vec3 amb = vec3(0.,0.,.1); + + vec3 col = albedo * (dif+amb); + + + return col; + +} + + +void main(void) +{ + vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y); + uv -= 0.5; + uv *= 2.; + uv /= vec2(v2Resolution.y / v2Resolution.x, 1); + + vec3 ro = vec3(0.,0.,time); + vec3 rd = normalize( vec3(uv, 1.)); + + rd.xy = rot(time*.1) * rd.xy; + vec3 p = raymarch(ro,rd); + vec3 n = normal(p); + vec3 col = shade(ro,rd,p,n); + if(flotte(p) 100.) { + break; + } + } + + return d; +} + +vec3 GetNormal(vec3 p) { + vec2 e = vec2(0.01, 0); + + vec3 n = GetDist(p) - vec3( + GetDist(p - e.xyy), + GetDist(p - e.yxy), + GetDist(p - e.yyx) + ); + + return normalize(n); +} + +float GetLight(vec3 p) { + vec3 light = vec3(0, 3, iTime * SPEED + 1); + vec3 toLight = light - p; + vec3 n = GetNormal(p); + float dif = dot(n, normalize(toLight)); + + return dif; +} + +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 *= 2.; + vec3 col = vec3(0.); + + vec3 ro = vec3(0, sin(iTime), iTime * SPEED); + + vec3 rd = normalize(vec3(uv.x, uv.y, 1)); + + float d = RayMarch(ro, rd); + vec3 p = ro + d * rd; + float dif = GetLight(p); + col = vec3(dif * palette(p.z / 100.)); +// col = n; + out_color = vec4(col, 1.); +} + +/* 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 = f + t;*/ \ No newline at end of file diff --git a/2019-01-30/lamogui 1.glsl b/2019-01-30/lamogui 1.glsl new file mode 100644 index 0000000..14dbcc9 --- /dev/null +++ b/2019-01-30/lamogui 1.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 + +float h(vec2 p) +{ + return cos(p.x + sin(0.1* p.x + cos( p.x))) + 0.1 * sin( 2.6 * p.y); +} + +float g(vec3 q, vec3 p) +{ + q.y += 10.0 * texture(texFFTIntegrated, 0.01).x; + float per = 3.0; + vec2 id = q.xz / per + per * 0.5; + q = mod(q, per) - 0.5 * per; + return 1.0 - length(q); +} + + +float map(vec3 p) +{ + float d = p.y + 2.0 - h(p.xz); + d = min(d, g(p, p)); + return d; + return cos(p.x) + cos(p.y) + cos(p.z); +} + +vec3 rm(vec3 ro, vec3 rd, out float st) +{ + st = 1.0; + vec3 p = ro; + for (float i = 0.0; i < 64.0; i++) + { + float d = map(p); + if (abs(d) < 0.01) + { + st = i / 64.0; + break; + } + p += d * rd * 0.9; + } + return p; +} + +vec3 shade(vec3 ro, vec3 p, float st) +{ + float t = exp(-distance(ro, p) * 0.1); + vec3 c = vec3(t) * (1.0 - st); + c *= mix(texture(texChecker, p.xz).xyz, c, 1.0 -t); + c = mix(vec3(0.0, 2.0, 2.0), c, 2.0* t); + //c = vec3(exp(-distance(ro, p) * 0.1)); + return c; +} + +vec3 n(vec3 p) +{ + vec2 e = vec2(0.001, 0.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.x *= v2Resolution.x/v2Resolution.y; + + + vec3 ro = vec3(0.0, 0.0, fGlobalTime); + vec3 rd = normalize(vec3(uv, 1.0)); + float st = 1.0; + vec3 p = rm(ro, rd, st); + vec3 c = shade(ro, p , st); + + vec3 n = n(p); + vec3 rd2 = reflect(rd, n); + vec3 ro2 = p + 0.1 * n; + vec3 p2 = rm(ro, rd2, st); + c = shade(ro, p2, st); + //c = mix(c, shade(ro, p2, st), 0.8); +//c = mix(c, vec3(0.0, 1.0 ,1.0), distance(ro, p)); + + out_color = vec4(c, 1.0); +} \ No newline at end of file diff --git a/2019-01-30/shader - volumetric light scattering.glsl b/2019-01-30/shader - volumetric light scattering.glsl new file mode 100644 index 0000000..81a41ef --- /dev/null +++ b/2019-01-30/shader - volumetric light scattering.glsl @@ -0,0 +1,154 @@ +#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 box(vec2 p, float s) { + vec2 ap=abs(p)-s; + return min(0,max(ap.x,ap.y)); +} + +float cyl(vec2 p, float r) { + return length(p)-r; +} + +mat2 rot(float a) { + float ca=cos(a); + float sa=sin(a); + return mat2(ca,sa,-sa,ca); +} + +float map(vec3 p) { + + float a=abs(sph(p,1.0))-0.2; + + float c=10000; + for(int i=0; i<5; ++i) { + + float t1=time+i; + p.xy *= rot(t1); + p.yz *= rot(t1*0.7); + //p.xy=abs(p.xy); + //p-=0.1+i*0.1; + + c=min(c,cyl(p.xz, 0.2+0.7*exp(-fract(time*0.2)))); + + } + + return max(a, -c); +} + +vec3 norm(vec3 p) { + vec2 off=vec2(0.01,0); + return normalize(map(p)-vec3(map(p-off.xyy), map(p-off.yxy), map(p-off.yyx))); +} + +float rnd(vec2 t) { + return fract(dot(sin(t*vec2(745.232,456.278)+t.yx*vec2(423.251,895.655)), vec2(7458.232))); +} + +float rnd(float t) { + return fract(sin(t*445.789)*8956.555); +} + +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)); +} + +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, 1.7)-0.5)*0.5; + uv.y += (curve(time, 1.2)-0.5)*0.3; + + vec3 s=vec3(0,0, -7); + vec3 r=normalize(vec3(-uv, 0.2+curve(time, 0.7))); + + vec3 p=s; + float dd=0; + for(int i=0; i<50; ++i) { + float d=map(p); + if(d<0.001) { + break; + } + if(dd>60) break; + p+=r*d; + dd+=d; + } + + vec3 pl=vec3(0); + vec3 l=normalize(vec3(pl-p)); + + int steps=30; + float maxdist=25; + float stepsize=maxdist/steps; + vec3 rd=r*stepsize; + vec3 np =s + rd * (rnd(uv)+2); + float at=0; + + float rand = rnd(uv+17.52); + for(int i=0; idd) break; + np+=rd; + } + + vec3 n=norm(p); + + + vec3 col = vec3(0); + col += max(0, dot(n,l)); + col += at * vec3(1,.5,0.7)*2; + + + float t2 = time*0.7 + curve(time, 0.9)*2.0; + col.xy *= rot(t2); + col.yz *= rot(t2*1.3); + col.xz *= rot(t2*0.7); + + col = abs(col); + col *= 10; + col = 1-exp(-col); + col = pow(col, vec3(1.5)); + + out_color = vec4(col, 1); +} \ No newline at end of file