mirror of
https://github.com/CookieCollective/Live-Coding-Sources.git
synced 2025-08-09 23:55:01 +02:00
Add 2017-10-26
This commit is contained in:
69
2017-10-26/01-eybor.glsl
Normal file
69
2017-10-26/01-eybor.glsl
Normal file
@ -0,0 +1,69 @@
|
||||
#version 410 core
|
||||
|
||||
#define M_PI 3.141592
|
||||
|
||||
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 texNogozon;
|
||||
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 cog(vec2 p)
|
||||
{
|
||||
float angle = fract((M_PI+atan(p.x, p.y))/(2.*M_PI)*8.)*4.;
|
||||
|
||||
float dist = sqrt(dot(p, p));
|
||||
float interpolationFactor = clamp(-1.+angle, 0., 1.) - clamp(-3.+angle, 0., 1.);
|
||||
|
||||
return smoothstep(.7+interpolationFactor*.25, .75+interpolationFactor*.25, dist);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
|
||||
uv *= 2.;
|
||||
uv -= 1.;
|
||||
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
|
||||
|
||||
uv *= 3.;
|
||||
|
||||
vec2 prerot = uv;
|
||||
|
||||
uv *= mat2(cos(fGlobalTime*.1), sin(fGlobalTime*.1), -sin(fGlobalTime*.1), cos(fGlobalTime*.1));
|
||||
|
||||
vec2 rot = uv * mat2(cos(fGlobalTime), sin(fGlobalTime), -sin(fGlobalTime), cos(fGlobalTime));
|
||||
|
||||
vec3 co = vec3(.5, .6, .8);
|
||||
|
||||
prerot *= mat2(cos(fGlobalTime), sin(fGlobalTime), -sin(fGlobalTime), cos(fGlobalTime));
|
||||
|
||||
co += smoothstep(0., 1., 1.-sqrt((prerot.x*prerot.x))*sqrt((prerot.y*prerot.y)))*.5;
|
||||
|
||||
co *= cog(rot);
|
||||
|
||||
rot = (uv+vec2(.5, 1.6)) * mat2(cos(-fGlobalTime), sin(-fGlobalTime), -sin(-fGlobalTime), cos(-fGlobalTime));
|
||||
|
||||
co *= cog(rot*.9);
|
||||
|
||||
rot = (uv-vec2(1.8, 0.)) * mat2(cos(-fGlobalTime), sin(-fGlobalTime), -sin(-fGlobalTime), cos(-fGlobalTime));
|
||||
|
||||
co *= cog(rot*.8);
|
||||
|
||||
out_color = vec4(co, 1.);
|
||||
}
|
60
2017-10-26/01-wsmind.glsl
Normal file
60
2017-10-26/01-wsmind.glsl
Normal file
@ -0,0 +1,60 @@
|
||||
#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 texNogozon;
|
||||
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 p, float a)
|
||||
{
|
||||
float c = cos(a);
|
||||
float s = sin(a);
|
||||
return mat2(c, s, -s, c) * 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);
|
||||
|
||||
float beat = exp(-fract(fGlobalTime) * 7.0);
|
||||
|
||||
uv *= pow(length(uv), sin(fGlobalTime) * 2.0 + 1.2);
|
||||
uv.x += sin(uv.y * 540.0) * beat * 0.1;
|
||||
|
||||
uv = rotate(uv, fGlobalTime * 0.2);
|
||||
|
||||
vec3 color = vec3(0.0);
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
float r = fract(sin(i * 1.478946));
|
||||
vec2 pos = vec2(cos(i + fGlobalTime * 0.8 * r), sin(i + fGlobalTime * 2.0)) * r;
|
||||
float d = smoothstep(0.04 * r, 0.0, length(pos - uv)) - smoothstep(0.01 * r, 0.0, length(pos - uv));
|
||||
color += d * vec3(1.0, r * 0.2, 0.0) * 10.0;
|
||||
}
|
||||
|
||||
|
||||
float b = pow(dot(normalize(abs(uv)), abs(vec2(cos(fGlobalTime), sin(fGlobalTime)))), 1040.0);
|
||||
color += clamp(b, 0.0, 1.0) * vec3(0.4, 0.8, 0.0) * 10.0;
|
||||
|
||||
color += texture(texNogozon, (uv + vec2(fGlobalTime * 0.1)) * 1.4).rgb * 0.02;
|
||||
|
||||
color *= beat * (1.0 - length(uv) * 0.4);
|
||||
|
||||
color = color / (1.0 + color);
|
||||
color = pow(color, vec3(1.0 / 2.2));
|
||||
|
||||
out_color = vec4(color, 1.0);
|
||||
}
|
84
2017-10-26/02-anton.glsl
Normal file
84
2017-10-26/02-anton.glsl
Normal file
@ -0,0 +1,84 @@
|
||||
#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 texNogozon;
|
||||
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
|
||||
mat2 rot(float a)
|
||||
{
|
||||
float c = cos(a);float s = sin(a);
|
||||
return mat2(c,-s,s,c);
|
||||
}
|
||||
|
||||
float rep(float p, float r)
|
||||
{
|
||||
return mod(p + r/2,r) - r/2;
|
||||
}
|
||||
|
||||
float map(vec3 p)
|
||||
{
|
||||
vec3 p2 = p;
|
||||
p2.yz *= rot( p2.z * .00005 + sin(p2.z *-.15- fGlobalTime * .2) * .1);
|
||||
|
||||
float f1 = 4-max(distance(p2.x,0),distance(p2.y,0));//distance(p,vec3(0,0,0)) -1;
|
||||
float f3 = 4-max(distance(p2.x,0),distance(p2.y,0));
|
||||
p2.z += fGlobalTime * 10;
|
||||
vec3 p3 = p2;
|
||||
p3.x = abs(p3.x);
|
||||
float f5 = (2 + sin(p3.z * .3)) - distance(p3.xy, vec2(4,0));
|
||||
p2.z = rep(p2.z, 10);
|
||||
p2.x = abs(p2.x );
|
||||
float f2 = distance(p2, vec3(0,-1 + abs(p .x),0)) - 1;
|
||||
float f4 = distance(p2.yz , vec2(-5,0)) - 1.5;
|
||||
f1 = max(f1,f5);
|
||||
return min(min(f1,f2),f4);
|
||||
}
|
||||
|
||||
vec3 norm(vec3 p)
|
||||
{
|
||||
vec2 e = vec2(.1,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 ro = vec3(0,1,-5);
|
||||
vec3 rd = normalize(vec3(uv.xy,1));
|
||||
float ST = 128;
|
||||
float st = 0.;
|
||||
float cd = 0;
|
||||
vec3 cp = ro;
|
||||
|
||||
for(;st < ST;st++)
|
||||
{
|
||||
cd = map(cp);
|
||||
if(cd < .001)
|
||||
break;
|
||||
cp += cd * rd * .5;
|
||||
}
|
||||
|
||||
vec3 light = vec3(0,0,25 + sin(fGlobalTime) * 10);
|
||||
vec3 lDir = normalize(cp - light);
|
||||
float lum = clamp(dot(norm(cp),lDir),0,1);
|
||||
float dist = distance(ro,cp);
|
||||
float f= dist / 50;
|
||||
out_color = vec4(lum);
|
||||
}
|
134
2017-10-26/02-lamogui.glsl
Normal file
134
2017-10-26/02-lamogui.glsl
Normal file
@ -0,0 +1,134 @@
|
||||
#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 texNogozon;
|
||||
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 ID_SPHERE 1.0
|
||||
#define ID_BLACK 2.0
|
||||
#define ID_LIGHT 3.0
|
||||
#define mmin(v, d, i) (v.x > d ? vec2(d, i) : v)
|
||||
|
||||
float sphere(vec3 p, vec3 pos, float id)
|
||||
{
|
||||
vec3 q = normalize(p - pos);
|
||||
return length(p - pos) - 1.0;
|
||||
}
|
||||
|
||||
float cylinder(vec3 p)
|
||||
{
|
||||
return length(p.xz) - 0.3;
|
||||
}
|
||||
|
||||
float modA(inout vec2 p, float n)
|
||||
{
|
||||
float l = length(p);
|
||||
float an = 3.141592 * 2.0 / n;
|
||||
float a = atan(p.y, p.x);
|
||||
float id = floor(a / an);
|
||||
a = mod(a, an) - 0.5 * an;
|
||||
p = vec2 (cos(a), sin(a)) * l;
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
vec2 map(vec3 p)
|
||||
{
|
||||
float sd = 10000.0;
|
||||
vec2 v = vec2(cylinder(p), ID_LIGHT);
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
vec3 q = p;
|
||||
float id = modA(q.xz, 10.0 + 5.0 * i);
|
||||
v = mmin(v, sphere(p, vec3(1.0 + 2.0 * i, 0.0, 0.0), id), ID_SPHERE);
|
||||
}
|
||||
|
||||
v = mmin(v, sphere(p, vec3(0.0), 1.0), ID_SPHERE);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
vec4 rm(vec3 ro, vec3 rd)
|
||||
{
|
||||
//float d = 10000.0;
|
||||
vec3 p = ro;
|
||||
float id = ID_BLACK;
|
||||
for (int i = 0 ; i < 64 ; ++i)
|
||||
{
|
||||
|
||||
vec2 d = map(p);
|
||||
if (abs(d.x) < 0.001)
|
||||
{
|
||||
id = d.y;
|
||||
break;
|
||||
}
|
||||
else if (d.x > 1000.0)
|
||||
break;
|
||||
p += rd * d.x * 0.8;
|
||||
}
|
||||
return vec4(p, id);
|
||||
}
|
||||
|
||||
|
||||
vec3 grad(vec3 p)
|
||||
{
|
||||
vec2 e = vec2(0.01, 0.0);
|
||||
return normalize(vec3(map(p + e.xyy).x - map(p - e.xyy).x, map(p + e.yxy).x - map(p - e.yxy).x, map(p + e.yyx).x - map(p - e.yyx).x));
|
||||
}
|
||||
|
||||
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, 0.0 ,-3.0);
|
||||
vec3 rd = vec3(uv, 1.0);
|
||||
|
||||
vec4 q = rm(ro, rd);
|
||||
vec3 p = q.xyz;
|
||||
float id = q.w;
|
||||
|
||||
vec3 n = grad(p);
|
||||
vec3 color = vec3(exp(-distance(ro, p) * 0.1)); //* (n * 0.5 + 0.5);
|
||||
|
||||
if (id == ID_LIGHT)
|
||||
color = vec3(1.0);
|
||||
else if (id == ID_SPHERE)
|
||||
color *= 0.1 * (n * 0.5 + 0.5);
|
||||
out_color = vec4(color, 1.0);
|
||||
|
||||
/*
|
||||
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;*/
|
||||
}
|
98
2017-10-26/03-flopine.glsl
Normal file
98
2017-10-26/03-flopine.glsl
Normal file
@ -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 texNogozon;
|
||||
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 rotate (vec2 p, float angle)
|
||||
{
|
||||
float c = cos(angle);
|
||||
float s = sin(angle);
|
||||
return mat2 (c,-s,s,c);
|
||||
}
|
||||
|
||||
float sphere (vec3 p, float r)
|
||||
{return length(p)-r;}
|
||||
|
||||
float box (vec3 p, vec3 c)
|
||||
{return length(max(abs(p)-c,0.));}
|
||||
|
||||
|
||||
vec2 moda (vec2 p)
|
||||
{
|
||||
float angle = atan(p.y,p.x);
|
||||
float len = length(p.xy);
|
||||
float period = 2.*3.14/5.;
|
||||
angle = mod(angle-period/2., period)/period/2.;
|
||||
return len*vec2(sin(angle),cos(angle));
|
||||
}
|
||||
|
||||
|
||||
float SDF(vec3 p)
|
||||
{
|
||||
float period = 5.;
|
||||
float rad = 1.;
|
||||
vec3 corn = vec3 (0.75);
|
||||
p.xy = moda(p.xy);
|
||||
p = p-sin(fGlobalTime);
|
||||
p.xz = mod(p.xz-period/2.,period)-period/2.;
|
||||
p.xy *= rotate(p.xy, sin(fGlobalTime));
|
||||
|
||||
return max(-sphere(p,rad),box(p,corn));
|
||||
}
|
||||
|
||||
vec3 normals (vec3 p)
|
||||
{
|
||||
vec2 eps = vec2(0.01,0.);
|
||||
return normalize(vec3 (SDF(p+eps.xyy) - SDF(p-eps.xyy),
|
||||
SDF(p+eps.yxy) - SDF(p-eps.yxy),
|
||||
SDF(p+eps.yyx) - SDF(p-eps.yyx))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
float lighting (vec3 norm_p, vec3 l)
|
||||
{return dot(norm_p,l)*0.5+0.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);
|
||||
vec3 pos = vec3(0.001,0.001,-3.);
|
||||
vec3 dir = normalize(vec3(uv,1.-length(uv)));
|
||||
vec3 light = normalize(vec3(0.1,1.,-1.));
|
||||
vec3 col = vec3(0.);
|
||||
|
||||
|
||||
for (int i = 0; i<60; i++)
|
||||
{
|
||||
float d = SDF(pos);
|
||||
if (d<0.01)
|
||||
{
|
||||
vec3 norm = normals(pos);
|
||||
col = vec3 (lighting(norm, light))*vec3(0.9,0.2,0.1)*4.;
|
||||
break;
|
||||
}
|
||||
pos += d*dir;
|
||||
}
|
||||
out_color = vec4(col,1.);
|
||||
}
|
63
2017-10-26/03-pouletvert.glsl
Normal file
63
2017-10-26/03-pouletvert.glsl
Normal file
@ -0,0 +1,63 @@
|
||||
#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 texNogozon;
|
||||
uniform sampler2D texNoise;
|
||||
uniform sampler2D texTex1;
|
||||
uniform sampler2D texTex2;
|
||||
uniform sampler2D texTex3;
|
||||
uniform sampler2D texTex4;
|
||||
|
||||
float lol = 5.;
|
||||
|
||||
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) {
|
||||
return smoothstep(0.5, 0.51, length(_uv));
|
||||
}
|
||||
|
||||
float untruc(vec2 _uv) {
|
||||
return step(.2, _uv.x) - step(.2 - _uv.x, _uv.x);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
vec4 backgroundColor = vec4(1., sin(uv.y), .0, .0);
|
||||
|
||||
vec4 squareColor = vec4(.5, .5, .5, 1.);
|
||||
|
||||
|
||||
vec4 sunColor = vec4(0., 0., 1., 0.);
|
||||
|
||||
uv += sin(fGlobalTime) * .25;
|
||||
|
||||
uv *= mat2(cos(fGlobalTime * lol), sin(fGlobalTime * lol), -sin(fGlobalTime * lol), cos(fGlobalTime * lol));
|
||||
uv.x += sin(uv.y * 33. + fGlobalTime) * .033;
|
||||
|
||||
vec2 blob = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
|
||||
uv.y += sin(blob.x * 10. * fGlobalTime) * .1;
|
||||
vec4 finalColor = mix(backgroundColor, sunColor, circle(uv));
|
||||
for(int i=0; i<10 ; i++) {
|
||||
finalColor += mix(finalColor, sunColor, circle(uv + vec2(i * .5, i + .33)));
|
||||
}
|
||||
|
||||
finalColor = mix(finalColor, squareColor, untruc(uv));
|
||||
|
||||
out_color = finalColor;
|
||||
}
|
155
2017-10-26/04-lamogui.glsl
Normal file
155
2017-10-26/04-lamogui.glsl
Normal file
@ -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 texNogozon;
|
||||
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 sphere(vec3 p, vec3 pos, float id)
|
||||
{
|
||||
vec3 q = normalize(p - pos);
|
||||
return length(p - pos) - 1.0;
|
||||
}
|
||||
|
||||
float cylinder(vec3 p)
|
||||
{
|
||||
return length(p.xz) - 0.3;
|
||||
}
|
||||
|
||||
#define ID_LIGHT 2.0
|
||||
#define ID_SPHERE 1.0
|
||||
#define ID_BLACK 3.0
|
||||
|
||||
float modA(inout vec2 p, float n)
|
||||
{
|
||||
float an = 3.141592 * 2.0 / n;
|
||||
float a = atan(p.y, p.x);
|
||||
float id = floor(a / an);
|
||||
a = mod(a, an) - 0.5 * an;
|
||||
p = vec2(cos(a), sin(a)) * length(p);
|
||||
return id;
|
||||
}
|
||||
|
||||
#define mmin(v, d, i) (v.x > d ? vec2(d,i) : v)
|
||||
|
||||
mat3 rotY(float a)
|
||||
{
|
||||
float c = cos(a);
|
||||
float s = sin(a);
|
||||
return mat3 (c, 0.0, -s, 0.0, 1.0, 0.0, s, 0.0, c);
|
||||
}
|
||||
|
||||
vec2 map(vec3 p)
|
||||
{
|
||||
vec2 v = vec2(cylinder(p), ID_LIGHT);
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
vec3 q = p;
|
||||
q = rotY(fGlobalTime * 0.4 + i * fGlobalTime * 0.5) * q;
|
||||
float id = modA(q.xz, 20.0 + 5.0 * i);
|
||||
v = mmin(v, sphere(q, vec3(5.0 + i * 0.5, sqrt(i * 0.5), 0.0), 1.0), ID_SPHERE);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
vec4 rm(vec3 ro, vec3 rd)
|
||||
{
|
||||
float id = ID_BLACK;
|
||||
vec3 p = ro;
|
||||
for (int i = 0 ; i < 64; ++i)
|
||||
{
|
||||
vec2 d = map(p);
|
||||
if (abs(d.x) < 0.01)
|
||||
{
|
||||
id = d.y;
|
||||
break;
|
||||
}
|
||||
else if (d.x > 100.0)
|
||||
break;
|
||||
p += rd * d.x * 0.8;
|
||||
}
|
||||
return vec4(p, id);
|
||||
}
|
||||
|
||||
vec3 grad(vec3 p)
|
||||
{
|
||||
vec2 e = vec2(0.001, 0.0);
|
||||
return normalize(vec3(map(p + e.xyy).x - map(p - e.xyy).x, map(p + e.yxy).x - map(p - e.yxy).x, map(p + e.yyx).x - map(p - e.yyx).x));
|
||||
}
|
||||
|
||||
mat3 rotX(float a)
|
||||
{
|
||||
float c = cos(a);
|
||||
float s= sin(a);
|
||||
return mat3(1.0, 0.0 ,0.0 , 0.0, c, -s, 0.0, s, c);
|
||||
}
|
||||
|
||||
mat3 rotZ(float a)
|
||||
{
|
||||
float c = cos(a);
|
||||
float s= sin(a);
|
||||
return mat3(c, -s, 0.0, s, c, 0.0, 0.0, 0.0 ,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);
|
||||
|
||||
vec3 ro = vec3(0.0, 5.0, -6.0);
|
||||
vec3 rd = vec3(uv, 1.0);
|
||||
rd = rotX(-0.3) *rd;
|
||||
rd = rotZ(0.3 + 0.1 * sin(fGlobalTime)) *rd;
|
||||
vec4 q = rm(ro, rd);
|
||||
vec3 p = q.xyz;
|
||||
vec3 color = vec3(exp(-distance(ro, p) * 0.1));
|
||||
float id = q.w;
|
||||
vec3 n = grad(p);
|
||||
|
||||
|
||||
if (id == ID_LIGHT)
|
||||
color = vec3(1.0);
|
||||
else if (id == ID_SPHERE)
|
||||
{
|
||||
color = 0.3 * (n * 0.5 + 0.5);
|
||||
vec4 qq = rm(p + n * 0.1, reflect(rd, n));
|
||||
vec3 pp = q.xyz;
|
||||
// id = qq.w;
|
||||
if (id == ID_LIGHT)
|
||||
color += 0.5;
|
||||
|
||||
}
|
||||
|
||||
out_color = vec4(color, 1.0);
|
||||
/*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;*/
|
||||
}
|
95
2017-10-26/04-omar.glsl
Normal file
95
2017-10-26/04-omar.glsl
Normal file
@ -0,0 +1,95 @@
|
||||
#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 texNogozon;
|
||||
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 circle(vec2 p, float r)
|
||||
{
|
||||
return 0.0;
|
||||
// length(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);
|
||||
|
||||
/*
|
||||
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;
|
||||
*/
|
||||
|
||||
vec4 c = vec4(1.0,0.5,0.0,1.0);
|
||||
|
||||
float bx = uv.x;
|
||||
bx += uv.x*uv.y * sin(mod(fGlobalTime*0.01,0.2));
|
||||
c.y += (mod(bx + fGlobalTime*0.01, 0.10)) < 0.06 ? 0.2 : 0.0;
|
||||
//c.z += (mod(uv.y + fGlobalTime*0.01, 0.10)) < 0.06 ? 0.2 : 0.0;
|
||||
|
||||
float r = 0.3;
|
||||
r += texture(texFFTSmoothed, 0.1).x * 1.0;
|
||||
|
||||
if (length(uv.xy) < r)
|
||||
if (length(uv.xy - vec2(1.2,0.6)) < 1.4)
|
||||
uv.y -= texture(texTex2, uv.xy + vec2(fGlobalTime*uv.y-2,uv.x)).r * 0.2;
|
||||
|
||||
if (length(uv.xy) < r)
|
||||
{
|
||||
c.x = 0.0;
|
||||
c.y += texture(texNoise, uv.xy).r;
|
||||
}
|
||||
|
||||
for (float z = 0.0; z < 1.0; z += 0.1)
|
||||
{
|
||||
float len = length(uv.xy-vec2(0.09/(z+z),0.09*z+sin(fGlobalTime)*0.05));
|
||||
float s = 0.0;//sin(texture(texTex1,vec2(0.1,uv.y)).x);
|
||||
if (len > r*(1.4 + s*0.0) && len < r*1.5)
|
||||
{
|
||||
c.z += 0.3;
|
||||
c.y += 0.8;
|
||||
}
|
||||
|
||||
if (length(uv.xy - vec2(1.2,0.6)) < 1.4)
|
||||
{
|
||||
c.x += 0.8;
|
||||
}
|
||||
|
||||
c.z += uv.x * 0.2;
|
||||
}
|
||||
|
||||
//circle(vec2(0.5,0.5), 0.1);
|
||||
|
||||
out_color = c;
|
||||
}
|
35
2017-10-26/05-lock0.glsl
Normal file
35
2017-10-26/05-lock0.glsl
Normal file
@ -0,0 +1,35 @@
|
||||
#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 texNogozon;
|
||||
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.3 + sin( v.x *55.)/(v.x+v.y) * 20.0*1/log(time) ;
|
||||
return vec4( sin(c * cos(time)), c * 0.72, cos( c * 0.1 + time /.3 ) ,1.0 );
|
||||
}
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
|
||||
//uv -= 0.4;
|
||||
|
||||
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
|
||||
out_color = (vec4(0.9,0.8,0.7,1.)*plas(uv,fGlobalTime)) + vec4(sin(fGlobalTime*0.5*3.14), cos(fGlobalTime*0.5*3.14),sin(fGlobalTime*0.5*3.14),0.0);
|
||||
|
||||
out_color *= texture(texNoise,uv);
|
||||
}
|
104
2017-10-26/05-xt95.glsl
Normal file
104
2017-10-26/05-xt95.glsl
Normal file
@ -0,0 +1,104 @@
|
||||
#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 texNogozon;
|
||||
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 o(vec3 p)
|
||||
{
|
||||
return cos(p.x) + cos(p.y*.5) + cos(p.z) + cos(p.y*20. + fGlobalTime)*.1 + texture(texNoise, p.xy*.1).r*2. ;
|
||||
}
|
||||
float water( vec3 p)
|
||||
{
|
||||
|
||||
float d = p.y + texture(texNoise, p.xz*.1+vec2(fGlobalTime*.01)).r*.1+ texture(texNoise, p.xz*.1-vec2(fGlobalTime*.05)).r*.1;
|
||||
d = min(d, mix(length(p-vec3(0.,1.,fGlobalTime+5.)) - 1., length(p.xy-vec2(sin(p.z),1.+cos(p.z))) - .5, cos(fGlobalTime)*.5+.5));
|
||||
return d;
|
||||
}
|
||||
float map( vec3 p)
|
||||
{
|
||||
float d = min(o(p), water(p));
|
||||
return d;
|
||||
}
|
||||
|
||||
vec3 rm( vec3 ro ,vec3 rd)
|
||||
{
|
||||
vec3 p = ro;
|
||||
for(int i=0; i<64; i++)
|
||||
{
|
||||
float d = map(p);
|
||||
p += rd *d;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
vec3 normal( vec3 p)
|
||||
{
|
||||
vec2 eps = vec2(0.01, 0.);
|
||||
vec3 n;
|
||||
n.x = map(p) - map(p+eps.xyy);
|
||||
n.y = map(p) - map(p+eps.yxy);
|
||||
n.z = map(p) - map(p+eps.yyx);
|
||||
return normalize(n);
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
vec3 shade( vec3 ro, vec3 rd, vec3 n, vec3 p)
|
||||
{
|
||||
vec3 col = vec3(0.);
|
||||
col += vec3(1.) * max(0., dot(n, normalize(vec3(1.,1.,1.))))*.5;
|
||||
vec3 fog = mix(vec3(cos(fGlobalTime)*.5+.5, .7, .5), vec3(0.,.7,1.5), rd.x) * (length(p-ro)*.05 );;
|
||||
|
||||
col += fog;
|
||||
return col;
|
||||
}
|
||||
|
||||
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);
|
||||
uv -= 0.5;
|
||||
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
|
||||
|
||||
vec3 ro = vec3( 0., 1., fGlobalTime);
|
||||
vec3 rd = normalize( vec3(uv, 1.) );
|
||||
rd.xy = rot(fGlobalTime*.1) * rd.xy;
|
||||
vec3 p = rm(ro ,rd);
|
||||
vec3 n = normal(p);
|
||||
|
||||
vec3 col = shade(ro,rd,n,p);
|
||||
for(int i=0; i<3; i++)
|
||||
if(water(p)<.1)
|
||||
{
|
||||
rd = reflect( rd, n);
|
||||
p += rd*.1;
|
||||
ro = p;
|
||||
p = rm(ro,rd);
|
||||
n = normal(p);
|
||||
col = vec3(0.5,.7,1.) * shade(ro,rd,n,p);
|
||||
}
|
||||
|
||||
out_color = vec4(col, 1.);
|
||||
}
|
111
2017-10-26/06-koltes.glsl
Normal file
111
2017-10-26/06-koltes.glsl
Normal file
@ -0,0 +1,111 @@
|
||||
#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 texNogozon;
|
||||
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 rand(x) fract(sin(x)*1e4)
|
||||
|
||||
float C,S;
|
||||
#define rot(a) mat2(C=cos(a),S=sin(a),-S,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 );
|
||||
}
|
||||
|
||||
struct M{
|
||||
float d,md;
|
||||
vec3 c;
|
||||
};
|
||||
|
||||
vec3 camera(vec3 p) {
|
||||
float t=mod(fGlobalTime*.2,2),
|
||||
a=smoothstep(0.,.8,t)+smoothstep(1.,1.8,t);
|
||||
p.xz*=rot(a*3.14159);
|
||||
return p;
|
||||
}
|
||||
|
||||
vec3 cIn=vec3(1,.7,0),
|
||||
cOut=vec3(1,.5,.5);
|
||||
float f;
|
||||
|
||||
float pl(vec3 p,vec3 o,vec3 d) {
|
||||
return dot(p-o,normalize(d));
|
||||
}
|
||||
|
||||
M map(vec3 p){
|
||||
p.x=abs(p.x);
|
||||
p.y+=.4+sin(fGlobalTime)*.2;
|
||||
float d=max(pl(p,vec3(0,0,.5),vec3(1,1,1)),pl(p,vec3(0,.05,0),vec3(0,1,0)));
|
||||
d=min(d,max(pl(p,vec3(0,0,-.1),vec3(1,1,1)),pl(p,vec3(0,.1,0),vec3(0,1,0))));
|
||||
d=max(d,pl(p,vec3(0.2,0,0),vec3(3,1,0)));
|
||||
d=max(d,pl(p,vec3(0.2,0,0),vec3(1,-3,0)));
|
||||
d=max(d,pl(p,vec3(0,0,-.5),vec3(0,1,-5)));
|
||||
|
||||
M m;
|
||||
m.d=d;
|
||||
m.c=mix(cIn,cOut,f/30.);
|
||||
m.md=.01;
|
||||
return m;
|
||||
}
|
||||
|
||||
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 co = camera(vec3(0, 0, -3)),
|
||||
cd = camera(normalize(vec3(uv, 1)));
|
||||
|
||||
float acc=0;
|
||||
for (f=0;f<128;++f) {
|
||||
float r=rand(f)*128+fGlobalTime,fr=fract(r),fl=floor(r);
|
||||
vec4 rr=rand(fl+vec4(0,3,5,8));
|
||||
vec3 ro=vec3(vec2(1,0)*rot(rr.x*6.2835)*(2+12*rr.y),0),
|
||||
rd=vec3(0,0,1),
|
||||
coro=co-ro,
|
||||
n=normalize(cross(cd,rd)),
|
||||
nc=cross(n,cd),
|
||||
nr=cross(n,rd);
|
||||
float d=dot(coro,n),
|
||||
tc=-dot(coro,nr)/dot(cd,nr),
|
||||
tr=dot(coro,nc)/dot(rd,nc);
|
||||
acc+=.05/d/d*step(0,tc)*smoothstep(5,0,abs(tr-mix(50,-50,fr)));
|
||||
}
|
||||
|
||||
vec3 bgC=acc*vec3(.5,.5,1);
|
||||
|
||||
vec3 mp=co,foC=vec3(0);
|
||||
float md=10;
|
||||
for (f=0;f<30;++f){
|
||||
M m=map(mp);
|
||||
md=min(md,m.d);
|
||||
if(m.d<.01)
|
||||
foC+=m.c;
|
||||
mp+=cd*max(m.d,m.md);
|
||||
}
|
||||
|
||||
foC/=10;
|
||||
|
||||
vec3 c=mix(
|
||||
foC,
|
||||
mix(cOut,bgC,smoothstep(0.,0.1,md)),
|
||||
step(0,md));
|
||||
|
||||
out_color = vec4(c,1);
|
||||
}
|
123
2017-10-26/06-ponk.glsl
Normal file
123
2017-10-26/06-ponk.glsl
Normal file
@ -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 texNogozon;
|
||||
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 STEP 1./100.
|
||||
|
||||
float sphere(vec3 p, float r) { return length(p)-r; }
|
||||
|
||||
float cylinder(vec2 p, float r) { return length(p)-r; }
|
||||
|
||||
float amod (inout vec2 p, float count) {
|
||||
|
||||
float an = 3.14159*2./count;
|
||||
float a = atan(p.y,p.x)+an/2.;
|
||||
a = mod(a,an)-an/2.;
|
||||
p = vec2(cos(a),sin(a))*length(p);
|
||||
return 0.;
|
||||
}
|
||||
|
||||
#define time fGlobalTime
|
||||
|
||||
mat2 rot (float a) {
|
||||
|
||||
float c=cos(a),s=sin(a);
|
||||
return mat2(c,-s,s,c);
|
||||
}
|
||||
|
||||
float repeat (float v, float c) { return mod(v,c)-c/2.; }
|
||||
|
||||
float smin (float a, float b, float r) {
|
||||
float h = clamp(.5+.5*(b-a)/r,0.,1.);
|
||||
return mix(b,a,h)-r*h*(1.-h);
|
||||
}
|
||||
|
||||
void orbit (inout vec3 p) {
|
||||
|
||||
p.xz *= rot(fGlobalTime);
|
||||
p.yz *= rot(fGlobalTime*.7);
|
||||
p.xy *= rot(fGlobalTime*.4);
|
||||
p.xy *= rot(length(p)*.2);
|
||||
p.xz *= rot(length(p)*.5);
|
||||
p.yz *= rot(length(p)*.3);
|
||||
}
|
||||
|
||||
float rand (vec2 s) { return fract(sin(dot(s, vec2(55.,100.)))*440545.); }
|
||||
|
||||
float map (vec3 pos) {
|
||||
float scene = 1000.;
|
||||
vec3 p = pos;
|
||||
orbit(p);
|
||||
p.xz *= rot(p.y*.3);
|
||||
amod(p.xz, 12.);
|
||||
|
||||
float wave = sin(time+p.y*2.);
|
||||
p.x -= 1. + .2*wave;
|
||||
//p.x = repeat(p.x, 1.);
|
||||
scene = min(scene, cylinder(p.xz, .1));
|
||||
p.y = repeat(p.y + time, .2);
|
||||
scene = smin(scene, cylinder(p.xy, .02), .1);
|
||||
scene = smin(scene, cylinder(p.yz, .02), .1);
|
||||
|
||||
p = pos;
|
||||
orbit(p);
|
||||
p.xz *= rot(p.y*5.);
|
||||
amod(p.xz, 5.);
|
||||
p.x -= .2 + wave * .2;
|
||||
|
||||
p.y = repeat(p.y, .5);
|
||||
scene = smin(scene, sphere(p, .2 + .1 * wave), .1);
|
||||
p = pos;
|
||||
|
||||
amod(p.xz, 5.);
|
||||
orbit(p);
|
||||
p.x = repeat(p.x, 1.);
|
||||
p.y = repeat(p.y, .5);
|
||||
scene = smin(scene, sphere(p, .2 + .1 * wave), .1);
|
||||
return scene;
|
||||
}
|
||||
|
||||
vec3 getNormal (vec3 p) {
|
||||
vec2 e = vec2(.01,.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 eye = vec3(0,0,-4);
|
||||
vec3 ray = normalize(vec3(uv, .2));
|
||||
vec3 pos = eye;
|
||||
float shade = 0.;
|
||||
for (float i =0.; i <= 1.; i += STEP) {
|
||||
float dist = map(pos);
|
||||
if (dist < .1) {
|
||||
shade += 1./STEP;
|
||||
}
|
||||
if (shade >= 1.) break;
|
||||
dist = max(dist, .001);
|
||||
dist *= .6 + .1 * rand(uv);
|
||||
pos += ray * dist;
|
||||
}
|
||||
vec3 color = vec3(1);
|
||||
vec3 normal = getNormal(pos);
|
||||
color = normal*.5+.5;
|
||||
color *= shade;
|
||||
out_color = vec4(color, 1);
|
||||
}
|
19
2017-10-26/Readme.md
Normal file
19
2017-10-26/Readme.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Shader Showdown Paris #2
|
||||
|
||||
On October 26th, 2017 at [Nogozon](https://www.facebook.com/nogozon/).
|
||||
|
||||
[Video on YouTube](https://youtu.be/w_VUkax9nGs)
|
||||
|
||||
## Rounds
|
||||
|
||||
1. Eybor vs wsmind
|
||||
2. Anton vs Lamogui
|
||||
3. Flopine vs Poulet Vert
|
||||
4. Lamogui vs Omar
|
||||
5. Lock0 vs XT95
|
||||
6. Koltes vs Ponk
|
||||
|
||||
## Extras
|
||||
|
||||
- Shader exquis #1
|
||||
- Shader exquis #2
|
42
2017-10-26/extra-shex-1.glsl
Normal file
42
2017-10-26/extra-shex-1.glsl
Normal file
@ -0,0 +1,42 @@
|
||||
#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 texNogozon;
|
||||
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 rand(x) fract(sin(x)*1e4)
|
||||
|
||||
float dis(vec2 pos, float f)
|
||||
{
|
||||
return pow(pow(abs(pos.x), f)+pow(abs(pos.y), f),1./f);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
|
||||
uv *= 2;
|
||||
uv -= 1.;
|
||||
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
|
||||
float a=fract(atan(uv.y,uv.x)/6.28358) * sin(fGlobalTime);
|
||||
vec4 r=rand(fGlobalTime+vec4(0,3,5,8));
|
||||
vec3 co = vec3(smoothstep(.7, .8 + .2 * sin(fGlobalTime+mod(fGlobalTime,1.0)), dis(uv, 2.+sin(fGlobalTime))));
|
||||
vec3 co2 = vec3(smoothstep(.7, .8 + .2 * sin(1.64*fGlobalTime * a), dis(uv, 2.+sin(fGlobalTime*1.64))));
|
||||
vec3 co3 = vec3(smoothstep(.7, .8 + .2 * sin(1.23*fGlobalTime * a * 2.) , dis(uv, 2.+sin(fGlobalTime*1.2))));
|
||||
float val = texture2D(texNoise,uv * (sin(fGlobalTime*1.0)+1.0)).x;
|
||||
|
||||
|
||||
|
||||
out_color = vec4(co.x,co2.y,co3.z, 1.) * (1.0-length(uv) * 0.5);
|
||||
}
|
66
2017-10-26/extra-shex-2.glsl
Normal file
66
2017-10-26/extra-shex-2.glsl
Normal file
@ -0,0 +1,66 @@
|
||||
#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 texNogozon;
|
||||
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 plane(vec3 pos)
|
||||
{
|
||||
return pos.y;
|
||||
}
|
||||
|
||||
float map(vec3 pos)
|
||||
{
|
||||
float p = plane(pos);
|
||||
|
||||
pos = mod(pos + vec3(5.0), vec3(10.0)) - vec3(5.0);
|
||||
|
||||
return min(length(pos) - 2.0, p);
|
||||
}
|
||||
|
||||
vec3 normal(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)
|
||||
));
|
||||
}
|
||||
|
||||
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 dir = normalize(vec3(uv, 1.0));
|
||||
vec3 pos = vec3(cos(fGlobalTime) * 50.0, sin(fGlobalTime * 0.4) * 4.0 + 5.0, -5.0);
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
float d = map(pos);
|
||||
pos += dir * d;
|
||||
}
|
||||
|
||||
vec3 n = normal(pos);
|
||||
vec3 light = normalize(vec3(1.0));
|
||||
float diffuse = max(dot(n, light), 0.0);
|
||||
|
||||
float fog = exp((-pos.z + 5.0) * 0.1);
|
||||
vec3 color = vec3(diffuse)*vec3(0.8,0.9,0.1);
|
||||
color = mix(vec3(0.6,0.0,0.4), color, fog);
|
||||
|
||||
out_color = vec4(color, 0.0);
|
||||
}
|
Reference in New Issue
Block a user