mirror of
https://github.com/CookieCollective/Live-Coding-Sources.git
synced 2025-03-07 02:31:20 +01:00
Added la fabrique a cookie 4 and fixed markdown issue after renaming folders.
This commit is contained in:
parent
3b115102ac
commit
8e7f33d7d7
2022-11-09_FabriqueACookie02
2022-12-07_FabriqueACookie03
2023-01-18_FabriqueACookie04
@ -5,11 +5,11 @@ On November 9, 2022 on [La fabrique à cookie 02](https://fb.me/e/5gBR5qyVB).
|
||||
## Shaders
|
||||
|
||||
1. z0rg
|
||||

|
||||

|
||||
2. lsdlive
|
||||

|
||||

|
||||
3. SAM
|
||||

|
||||

|
||||
|
||||
|
||||
## Software
|
||||
|
@ -1,17 +1,17 @@
|
||||
# Performances
|
||||
|
||||
On November 9, 2022 on [La fabrique à cookie 03](https://fb.me/e/2legCGjjq).
|
||||
On December 7th 2022 on [La fabrique à cookie 03](https://fb.me/e/2legCGjjq).
|
||||
|
||||
## Shaders
|
||||
|
||||
1. z0rg
|
||||

|
||||

|
||||
2. leon
|
||||

|
||||

|
||||
3. cosamentale
|
||||

|
||||

|
||||
4. NuSan
|
||||

|
||||

|
||||
5. Flopine
|
||||
I'm so sorry we lost the source :(, this was a beautiful isometric landscape full of tiny little cubes and lovely colors :)
|
||||
|
||||
|
BIN
2023-01-18_FabriqueACookie04/Bleuje.png
Normal file
BIN
2023-01-18_FabriqueACookie04/Bleuje.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 1.7 MiB |
BIN
2023-01-18_FabriqueACookie04/Flopine1.png
Normal file
BIN
2023-01-18_FabriqueACookie04/Flopine1.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 3.4 MiB |
BIN
2023-01-18_FabriqueACookie04/Flopine2.png
Normal file
BIN
2023-01-18_FabriqueACookie04/Flopine2.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 1.2 MiB |
BIN
2023-01-18_FabriqueACookie04/Leon.png
Normal file
BIN
2023-01-18_FabriqueACookie04/Leon.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 2.6 MiB |
19
2023-01-18_FabriqueACookie04/Readme.md
Normal file
19
2023-01-18_FabriqueACookie04/Readme.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Performances
|
||||
|
||||
On January 18th 2023 on [La fabrique à cookie 04](https://fb.me/e/31iQKl5nU).
|
||||
|
||||
## Shaders
|
||||
|
||||
Flopine
|
||||

|
||||

|
||||
Leon
|
||||

|
||||
Bleuje
|
||||

|
||||
z0rg
|
||||

|
||||
|
||||
|
||||
## Software
|
||||
- [Bonzomatic](https://github.com/TheNuSan/Bonzomatic/)
|
173
2023-01-18_FabriqueACookie04/bleuje.glsl
Normal file
173
2023-01-18_FabriqueACookie04/bleuje.glsl
Normal file
@ -0,0 +1,173 @@
|
||||
#version 410 core
|
||||
|
||||
uniform float fGlobalTime; // in seconds
|
||||
uniform vec2 v2Resolution; // viewport resolution (in pixels)
|
||||
uniform float fFrameTime; // duration of the last frame, in seconds
|
||||
|
||||
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 texPreviousFrame; // screenshot of the previous frame
|
||||
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 time;
|
||||
|
||||
float sdSphere(vec3 p,float r)
|
||||
{
|
||||
return length(p)-r;
|
||||
}
|
||||
|
||||
float sdBox(vec3 p,vec3 b)
|
||||
{
|
||||
vec3 q = abs(p)-b;
|
||||
return length(max(q,0.))+min(0.,max(q.x,max(q.y,q.z)));
|
||||
}
|
||||
|
||||
struct MapData
|
||||
{
|
||||
float dist;
|
||||
float type;
|
||||
vec2 UV;
|
||||
};
|
||||
|
||||
float objectSize = 0.3;
|
||||
float spacing = 5.0;
|
||||
|
||||
mat2 rot(float angle)
|
||||
{
|
||||
float c = cos(angle);
|
||||
float s = sin(angle);
|
||||
return mat2(c,-s,s,c);
|
||||
}
|
||||
|
||||
#define PI 3.141592
|
||||
|
||||
vec3 rollPosition(vec3 q,float param, float delay)
|
||||
{
|
||||
param -= delay;
|
||||
float stp = floor(param);
|
||||
float transition = param-stp;
|
||||
|
||||
transition = pow(transition,3.0);
|
||||
|
||||
q -= vec3(-objectSize*0.5+0.25,0.,0.);
|
||||
q -= vec3(2.0*objectSize*(stp-param),0.,0.);
|
||||
q -= vec3(objectSize,0.,-objectSize);
|
||||
q.xz *= rot(PI/2.0*transition);
|
||||
q += vec3(objectSize,0.,-objectSize);
|
||||
q.xz *= rot(-PI/2.0*stp);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
MapData map(vec3 p)
|
||||
{
|
||||
MapData res;
|
||||
|
||||
p.yz *= rot(-0.25*PI);
|
||||
|
||||
vec3 q = p;
|
||||
|
||||
float repLen = objectSize*spacing;
|
||||
|
||||
vec2 qi = floor((q.xy+vec2(repLen)/2.0)/repLen);
|
||||
|
||||
float type = mod(qi.x+qi.y,2.0);
|
||||
|
||||
p.z += 0*0.25*sin(2.*PI*(time-0.1*length(qi)));
|
||||
|
||||
p.xy = mod(p.xy+repLen/2.0,repLen)-repLen/2.0;
|
||||
|
||||
float delay = 0.2*length(qi);
|
||||
|
||||
if(false && type==0.)
|
||||
{
|
||||
p = rollPosition(p,2.*time+0.5,delay);
|
||||
res.dist = sdBox(p,vec3(objectSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
p = rollPosition(p,2.*time,delay);
|
||||
res.dist = sdBox(p,vec3(objectSize));
|
||||
vec2 UV;
|
||||
UV = p.xy/objectSize;
|
||||
res.UV = UV;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
vec3 getNormal(vec3 p)
|
||||
{
|
||||
vec2 off = vec2(0.001,0);
|
||||
return normalize(map(p).dist-vec3(map(p+off.xyy).dist,map(p+off.yxy).dist,map(p+off.yyx).dist));
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
time = 0.5*fGlobalTime;
|
||||
|
||||
vec3 ro = vec3(0.,0.,-10.);
|
||||
vec3 rd = normalize(vec3(uv*1.,1.0));
|
||||
|
||||
MapData res;
|
||||
float t = 0.;
|
||||
bool hit = false;
|
||||
vec3 pos;
|
||||
for(float i=0.;i<1.0;i+=1.0/60.)
|
||||
{
|
||||
pos = ro + t*rd;
|
||||
res = map(pos);
|
||||
if(res.dist<0.001)
|
||||
{
|
||||
hit = true;
|
||||
break;
|
||||
}
|
||||
t += 0.8*res.dist;
|
||||
}
|
||||
|
||||
vec3 col = vec3(0.);
|
||||
|
||||
if(hit)
|
||||
{
|
||||
vec3 col1 = 0.5*getNormal(pos)+0.5;
|
||||
vec3 col2 = col1.yzx;
|
||||
float len = length(res.UV)*4;
|
||||
float mxer = sin(PI*2.*len)*0.5+0.5;
|
||||
col = mix(col1,col2,mxer);
|
||||
}
|
||||
|
||||
out_color = vec4(col,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;
|
||||
*/
|
||||
}
|
90
2023-01-18_FabriqueACookie04/flopine.glsl
Normal file
90
2023-01-18_FabriqueACookie04/flopine.glsl
Normal file
@ -0,0 +1,90 @@
|
||||
#version 410 core
|
||||
|
||||
uniform float fGlobalTime; // in seconds
|
||||
uniform vec2 v2Resolution; // viewport resolution (in pixels)
|
||||
uniform float fFrameTime; // duration of the last frame, in seconds
|
||||
|
||||
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 texPreviousFrame; // screenshot of the previous frame
|
||||
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 n(u) fract(sin(dot(vec2(232.1, 314.7),u))*167.5)
|
||||
#define rot(a) mat2(cos(a),sin(a), -sin(a), cos(a))
|
||||
|
||||
#define PI acos(-1.)
|
||||
#define TAU (2.*PI)
|
||||
|
||||
|
||||
float truchet(vec2 uv)
|
||||
{
|
||||
vec2 id = floor(uv);
|
||||
uv = fract(uv)-.5;
|
||||
|
||||
if (n(id*.2)<.5) uv.x *= -1.;
|
||||
float s = (uv.x>-uv.y)?1.:-1.;
|
||||
|
||||
uv -= s*.5;
|
||||
|
||||
return abs(length(uv)-.5);
|
||||
return step(0.025, abs(length(uv)-.5));
|
||||
}
|
||||
|
||||
float extrude (vec3 p, float d, float h)
|
||||
{
|
||||
vec2 q = vec2(d, abs(p.z)-h);
|
||||
return min(0.,max(q.x,q.y))+length(max(q, 0.));
|
||||
}
|
||||
|
||||
float SDF (vec3 p)
|
||||
{
|
||||
float speed = 7.;
|
||||
p.z += floor(fGlobalTime*speed) + pow(fract(fGlobalTime*speed), .1)+n(p.xy)*.5;
|
||||
p.xy *= rot(p.z*.1);
|
||||
float per = 2.;
|
||||
float id = floor(p.z/per);
|
||||
p.xy *= (mod(id, 2.)<.5) ? rot(PI/4.) : rot(PI/2.);
|
||||
p.z = mod(p.z, per)-per*.5;
|
||||
float r = mix(0.001, 0.2, sin(length(p.xy)-fGlobalTime*2.));
|
||||
return extrude(p, truchet(p.xy), 0.1)-r;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = (2.*gl_FragCoord.xy - v2Resolution.xy)/ v2Resolution.y;
|
||||
// uv *= 2.;
|
||||
|
||||
//uv = abs(uv)-.05;
|
||||
|
||||
vec3 ro = vec3(0.01, 0.01, -4.),rd=normalize(vec3(uv, 1.)), p=ro,
|
||||
col=vec3(truchet(uv));
|
||||
|
||||
bool hit=false; float shad;
|
||||
for(float i=0.; i<64.; i++)
|
||||
{
|
||||
float d= SDF(p);
|
||||
if (d<0.01)
|
||||
{
|
||||
hit=true; shad = i/64.; break;
|
||||
}
|
||||
p += d*rd;
|
||||
}
|
||||
float t = length(p-ro);
|
||||
if (hit)
|
||||
{
|
||||
col = vec3(shad*.85);
|
||||
}
|
||||
|
||||
col = mix(col, vec3(.4, .7, .9), 1.-exp(0.005*t*t));
|
||||
|
||||
out_color = vec4(sqrt(col), 1.);
|
||||
//out_color = texture(texFFT, abs(uv.x)+abs(uv.y)).xxxx*100.;
|
||||
}
|
107
2023-01-18_FabriqueACookie04/flopine02.glsl
Normal file
107
2023-01-18_FabriqueACookie04/flopine02.glsl
Normal file
@ -0,0 +1,107 @@
|
||||
#version 410 core
|
||||
|
||||
uniform float fGlobalTime; // in seconds
|
||||
uniform vec2 v2Resolution; // viewport resolution (in pixels)
|
||||
uniform float fFrameTime; // duration of the last frame, in seconds
|
||||
|
||||
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 texPreviousFrame; // screenshot of the previous frame
|
||||
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 acos(-1.)
|
||||
#define TAU (2.*PI)
|
||||
#define rot(a) mat2(cos(a),sin(a), -sin(a),cos(a))
|
||||
|
||||
float box2d(vec2 p, float c)
|
||||
{
|
||||
vec2 q = abs(p)-c;
|
||||
return min(0., max(q.x, q.y))+length(max(q, 0.));
|
||||
}
|
||||
|
||||
float tore (vec3 p, vec2 d, float speed)
|
||||
{
|
||||
vec2 q = vec2(length(p.xy)-d.x, p.z);
|
||||
float a = atan(p.x,p.y);
|
||||
//q *= rot(cos(a));
|
||||
|
||||
q.y = abs(abs(q.y)-.2)-0.1;
|
||||
|
||||
return box2d(q, d.y);
|
||||
}
|
||||
|
||||
float SDF (vec3 p)
|
||||
{
|
||||
p.yz *= rot(-atan(1./sqrt(2.)));
|
||||
p.xz *=rot(PI/4.0);
|
||||
|
||||
vec3 pp = p;
|
||||
|
||||
vec2 per = vec2(2.25);
|
||||
vec2 id = floor(p.xz/per);
|
||||
float py = p.y+sin(length(id)-fGlobalTime*2.)*.2;
|
||||
p.xz = mod(p.xz, per)-per*.5;
|
||||
float d = tore(vec3(p.x, p.z, py),vec2(1., .04), length(id+.1)*.5);
|
||||
|
||||
p = pp;
|
||||
vec2 nid = floor((p.xz-per*.5)/per);
|
||||
p.y += sin(length(nid)-fGlobalTime*1.5)*.5;
|
||||
|
||||
p.xz = mod(p.xz-per*.5, per)-per*.5;
|
||||
d = min(d, length(p)-.5);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
vec3 gn (vec3 p)
|
||||
{
|
||||
vec2 eps = vec2(0.001, 0.);
|
||||
return normalize(SDF(p)-vec3(SDF(p-eps.xyy),SDF(p-eps.yxy),SDF(p-eps.yyx)));
|
||||
}
|
||||
|
||||
|
||||
float AO (vec3 p, vec3 n, float e)
|
||||
{return clamp(SDF(p+e*n)/e,0., 1.);}
|
||||
|
||||
|
||||
float spec (vec3 rd, vec3 l, vec3 n)
|
||||
{return pow( max(dot(n,normalize(l-rd)),0.), 25. );}
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = (2.*gl_FragCoord.xy - v2Resolution.xy) / v2Resolution.y;
|
||||
|
||||
vec3 ro = vec3(uv*5., -20.), rd=normalize(vec3(0.,0., 1.)), p=ro,
|
||||
col = vec3(0.), l=vec3(0.8, 1., -1.);
|
||||
|
||||
bool hit=false; float shad;
|
||||
for(float i=0.; i<64.; i++)
|
||||
{
|
||||
float d = SDF(p);
|
||||
if (d<0.01)
|
||||
{
|
||||
hit = true; shad=i/64.; break;
|
||||
}
|
||||
p += d*rd*.6;
|
||||
}
|
||||
if (hit)
|
||||
{
|
||||
vec3 n = gn(p);
|
||||
float ao = AO(p,n,0.05)+AO(p,n,0.15)+AO(p,n,0.25);
|
||||
float sp = spec(rd, l, n);
|
||||
col = vec3(1-shad*1.5);
|
||||
col *= ao/3.;
|
||||
col += sp;
|
||||
|
||||
}
|
||||
out_color = vec4(col, 1.);
|
||||
}
|
108
2023-01-18_FabriqueACookie04/leon.glsl
Normal file
108
2023-01-18_FabriqueACookie04/leon.glsl
Normal file
@ -0,0 +1,108 @@
|
||||
#version 410 core
|
||||
|
||||
uniform float fGlobalTime; // in seconds
|
||||
uniform vec2 v2Resolution; // viewport resolution (in pixels)
|
||||
uniform float fFrameTime; // duration of the last frame, in seconds
|
||||
|
||||
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 texPreviousFrame; // screenshot of the previous frame
|
||||
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
|
||||
#define repeat(p,r) (mod(p,r)-r/2.)
|
||||
|
||||
float gyroid (vec3 p) { return dot(sin(p), cos(p.yzx)); }
|
||||
|
||||
mat2 rot (float a) { float c=cos(a),s=sin(a); return mat2(c,-s,s,c); }
|
||||
|
||||
float random (vec2 s) { return fract(sin(dot(s,vec2(1321.1241,125.2134))*74.57)); }
|
||||
|
||||
vec3 cam;
|
||||
float rng;
|
||||
|
||||
float noise (vec3 p)
|
||||
{
|
||||
float result = 0., a =.5;
|
||||
for (float i = 0.; i < 3.; ++i)
|
||||
{
|
||||
result += abs(gyroid(p/a))*a;
|
||||
a /= 2.;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
float map(vec3 p)
|
||||
{
|
||||
float dist = 100.;
|
||||
vec3 q = p;
|
||||
|
||||
float grid = 1.5;
|
||||
//p.z -= time * .1;
|
||||
//p = repeat(p+grid/2., grid);
|
||||
float t = time*1.1;// + q.z;
|
||||
t += rng*.1;
|
||||
p.xz *= rot(t);
|
||||
p.yz *= rot(t);
|
||||
t = pow(fract(t), 0.4) + floor(t);
|
||||
float a = 1.;
|
||||
float r = .4+.2*sin(time*1.-length(p)*3.0);
|
||||
const float count = 5.;
|
||||
for (float i = 0.; i < count; ++i)
|
||||
{
|
||||
p.xy *= rot(t/a);
|
||||
p.xz *= rot(t/a);
|
||||
p.xz = abs(p.xz)-r*a;
|
||||
dist = min(dist, length(p)-.05*a);
|
||||
a /= 1.8;
|
||||
}
|
||||
|
||||
//dist -= noise(q*3.)*.1;
|
||||
dist = max(abs(dist)-.01, -(length(q-cam)-.5));
|
||||
|
||||
|
||||
return dist;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / v2Resolution.xy;
|
||||
vec2 p = (2.*gl_FragCoord.xy-v2Resolution.xy)/v2Resolution.y;
|
||||
cam = vec3(0,0,2);
|
||||
vec3 pos = cam;
|
||||
vec3 ray = normalize(vec3(p, -4.));
|
||||
rng = random(uv);
|
||||
|
||||
const float count = 30.;
|
||||
float total = 0.;
|
||||
float shade = 0.;
|
||||
for (float i = count; i > 0.; --i)
|
||||
{
|
||||
float dist = map(pos);
|
||||
if (dist < .001 || total > 20.)
|
||||
{
|
||||
shade = i/count;
|
||||
break;
|
||||
}
|
||||
total += dist;
|
||||
pos += ray * dist;
|
||||
}
|
||||
vec3 color = vec3(0);
|
||||
if (total < 20.)
|
||||
{
|
||||
color = vec3(1);
|
||||
color = .5+.5*cos(vec3(1,2,3)*5.5+length(pos)+shade*8.);
|
||||
color *= 2.;
|
||||
color *= shade;
|
||||
}
|
||||
|
||||
out_color = vec4(color, 1);
|
||||
}
|
198
2023-01-18_FabriqueACookie04/z0rg.glsl
Normal file
198
2023-01-18_FabriqueACookie04/z0rg.glsl
Normal file
@ -0,0 +1,198 @@
|
||||
#version 410 core
|
||||
|
||||
uniform float fGlobalTime; // in seconds
|
||||
uniform vec2 v2Resolution; // viewport resolution (in pixels)
|
||||
uniform float fFrameTime; // duration of the last frame, in seconds
|
||||
|
||||
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 texPreviousFrame; // screenshot of the previous frame
|
||||
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 n(u) fract(sin(dot(vec2(232.1, 314.7),u))*167.5)
|
||||
#define rot(a) mat2(cos(a),sin(a), -sin(a), cos(a))
|
||||
#define FFT(a) pow(sat(texture(texFFT, a).x*500.), .5)
|
||||
#define PI acos(-1.)
|
||||
#define TAU (2.*PI)
|
||||
#define sat(a) clamp(a, 0., 1.)
|
||||
float _seed;
|
||||
|
||||
float hash(float seed)
|
||||
{
|
||||
return fract(sin(seed*123.456)*123.456);
|
||||
}
|
||||
float rand()
|
||||
{
|
||||
return hash(_seed++);
|
||||
}
|
||||
float _cucube(vec3 p, vec3 s, vec3 th)
|
||||
{
|
||||
vec3 l = abs(p)-s;
|
||||
float c = max(l.x,max(l.y, l.z));
|
||||
l = abs(l)-s*th;
|
||||
float x = max(max(l.x, c),l.y);
|
||||
float y = max(max(l.z, c),l.y);
|
||||
float z = max(max(l.x, c),l.z);
|
||||
return min(min(x, y), z);
|
||||
}
|
||||
|
||||
float truchet(vec2 uv)
|
||||
{
|
||||
vec2 id = floor(uv);
|
||||
uv = fract(uv)-.5;
|
||||
|
||||
if (n(id*.2)<.5) uv.x *= -1.;
|
||||
float s = (uv.x>-uv.y)?1.:-1.;
|
||||
|
||||
uv -= s*.5;
|
||||
|
||||
return abs(length(uv)-.5);
|
||||
return step(0.025, abs(length(uv)-.5));
|
||||
}
|
||||
|
||||
float extrude (vec3 p, float d, float h)
|
||||
{
|
||||
vec2 q = vec2(d, abs(p.z)-h);
|
||||
return min(0.,max(q.x,q.y))+length(max(q, 0.));
|
||||
}
|
||||
|
||||
vec2 _min(vec2 a, vec2 b)
|
||||
{
|
||||
if (a.x < b.x)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
vec2 SDF (vec3 p)
|
||||
{
|
||||
|
||||
vec2 acc = vec2(1000., -1.);
|
||||
vec3 op =p;
|
||||
p.z += fGlobalTime;
|
||||
vec3 pg = p*1.-vec3(0.,-fGlobalTime,0.);
|
||||
|
||||
float gyr = dot(sin(pg.xyz), cos(pg.yzx))+1.2+FFT(.5);
|
||||
|
||||
gyr = max(gyr, abs(p.x)-3.);
|
||||
float shape = max(gyr, (length(op)-10.));
|
||||
acc = _min(acc, vec2(shape, 0.));
|
||||
|
||||
|
||||
float ground = -p.y+
|
||||
(sin(p.x+fGlobalTime)*.2+sin(p.z+fGlobalTime)*.2
|
||||
+sin(length(p.xz)+fGlobalTime)*.5)*.2;
|
||||
acc = _min(acc, vec2(ground, 1.));
|
||||
|
||||
float cucube=_cucube(op, vec3(5.), vec3(.1));
|
||||
acc = _min(acc, vec2(cucube, 2.));
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
vec3 getCam(vec3 rd, vec2 uv)
|
||||
{
|
||||
uv *= 1.-sat(length(uv)*.5);
|
||||
vec3 r = normalize(cross(rd, vec3(0.,1.,0.)));
|
||||
vec3 u = normalize(cross(rd, r));
|
||||
return normalize(rd+r*uv.x+u*uv.y);
|
||||
}
|
||||
vec3 accCol;
|
||||
vec3 trace(vec3 ro, vec3 rd, int steps)
|
||||
{
|
||||
accCol =vec3(0.);
|
||||
vec3 p=ro;
|
||||
for (int i = 0; i < steps && distance(p, ro) < 20.; ++i)
|
||||
{
|
||||
vec2 res = SDF(p);
|
||||
if (res.x < 0.01)
|
||||
return vec3(res.x, distance(p,ro), res.y);
|
||||
p+=res.x*rd;
|
||||
accCol += vec3(1., .3, .5)*(1.-sat(res.x/1.5))*.01;
|
||||
}
|
||||
return vec3(-1.);
|
||||
}
|
||||
vec3 getNorm(vec3 p, float d)
|
||||
{
|
||||
vec2 e=vec2(0.01,0.);
|
||||
return normalize(vec3(d)-vec3(SDF(p-e.xyy).x, SDF(p-e.yxy).x, SDF(p-e.yyx).x));
|
||||
}
|
||||
vec3 getmat(vec3 p)
|
||||
{
|
||||
vec3 col;
|
||||
col = vec3(.8, .4, .6); // Code pas indenté t"'as vu ?!
|
||||
col.xy *= rot(p.z*5.);
|
||||
return col;
|
||||
}
|
||||
|
||||
// VOILA MOI C Z0RG !
|
||||
// Le code C COOL :)
|
||||
vec3 rdr(vec2 uv){
|
||||
uv *= rot(fGlobalTime*.1);
|
||||
//uv = abs(uv)-.05;
|
||||
float t = fGlobalTime*.2;
|
||||
float d = 15.;
|
||||
vec3 ro = vec3(0.01+sin(t)*d, -2., cos(t)*d);
|
||||
ro.xy += (vec2(rand(), rand())-.5)*.2;
|
||||
vec3 ta = vec3(0.,-2.,0.);
|
||||
vec3 rd=normalize(ta-ro);
|
||||
|
||||
rd = getCam(rd, uv);
|
||||
|
||||
|
||||
vec3 col=vec3(truchet(uv))*.0;
|
||||
|
||||
float depth = 100.;
|
||||
vec3 res = trace(ro, rd, 64);
|
||||
if (res.y > 0.)
|
||||
{
|
||||
vec3 p = ro+rd*res.y;
|
||||
vec3 norm = getNorm(p, res.x);
|
||||
depth = res.y;
|
||||
if (res.z == 0.)
|
||||
{
|
||||
col = getmat(p);
|
||||
}
|
||||
if (res.z == 1.)
|
||||
{
|
||||
vec3 refl = normalize(reflect(rd, norm));
|
||||
vec3 resrefl = trace(p+norm*0.01, refl, 64);
|
||||
if (resrefl.y > 0.)
|
||||
{
|
||||
vec3 prefl = p+norm*0.01+refl*resrefl.y;
|
||||
col += getmat(prefl).zxy;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
col = mix(col, vec3(.9, .1, .1)*.2, 1.-sat(exp(0.2*depth)));
|
||||
col += accCol;
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 ouv = gl_FragCoord.xy/v2Resolution.xy;
|
||||
vec2 uv = (2.*gl_FragCoord.xy - v2Resolution.xy)/ v2Resolution.y;
|
||||
_seed = texture(texNoise, uv).x+fGlobalTime;
|
||||
// uv *= 2.;
|
||||
|
||||
float stp = .05;
|
||||
if (abs(uv.x)> .5)
|
||||
uv = floor(uv/stp)*stp;
|
||||
vec3 col = rdr(uv);
|
||||
vec2 off = (vec2(rand(), rand())-.5)*.05;
|
||||
col = sat(col);
|
||||
col = mix(col, texture(texPreviousFrame, ouv+off).xyz*1.5, .5);
|
||||
// col += rdr(uv+(vec2(rand(), rand())-.5)*.1);
|
||||
out_color = vec4(col, 1.);
|
||||
//out_color = texture(texFFT, abs(uv.x)+abs(uv.y)).xxxx*100.;
|
||||
}
|
BIN
2023-01-18_FabriqueACookie04/z0rg.png
Normal file
BIN
2023-01-18_FabriqueACookie04/z0rg.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 5.9 MiB |
Loading…
Reference in New Issue
Block a user