Compare commits

..

No commits in common. '1d9e0772e81a9c34d021a0fa48400adfc6b18b93' and '0e23850ebcd8a0a3ebd394de54d64b33ca714905' have entirely different histories.

  1. 3
      2D/BoxTiling.glsl
  2. 2
      2D/HexTiling.glsl
  3. 6
      2D/Noise.glsl
  4. 34
      2D/indexed/indexed.glsl
  5. 87
      2D/indexed/indexed_dist.glsl
  6. 42
      2D/indexed/indexed_dither.glsl
  7. 53
      2D/pixel_art_sampling/pixel_art_sampling.glsl
  8. 83
      2D/rainyWindow/rainyWindow.glsl
  9. BIN
      2D/water/sand.jpg
  10. 0
      2D/water/sand2.jpg
  11. 7
      2D/water/water.glsl
  12. BIN
      Textures/colorful.jpg
  13. BIN
      Textures/forrest.jpg
  14. BIN
      Textures/palette_LUT_euclid.png
  15. BIN
      Textures/palette_LUT_nop.png
  16. BIN
      Textures/palette_LUT_opt.png
  17. BIN
      Textures/pixelart.png

@ -1,6 +1,9 @@
#iChannel0 "https://i.imgur.com/TnmUwCn.jpg"
float XNUM = 10.;
float YNUM = 10.;
vec4 BoxCoords(vec2 uv) {
vec2 gv = fract(uv);

@ -42,7 +42,7 @@ void mainImage ( out vec4 fragColor, in vec2 fragCoord) {
vec4 hc = HexCoords(uv);
//col.rg = hc(uv).xy;
col.rgb = texture(iChannel0, hc.xy+0.5).rgb;
col.rgb = texture(iChannel0, hc(uv).xy+0.5).rgb;
col.rgb *= vec3(smoothstep(0.09, 0.99, sin(hc.z+hc.w/17.+iTime) ));
fragColor = vec4(col, 1.0);

@ -39,9 +39,5 @@ float SmoothNoise2(vec2 uv, int ocataves) {
void mainImage ( out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord/iResolution.xy;
float x = SmoothNoise(uv*4.+mod(127.+iTime*2000.7, 337.));
float y = SmoothNoise(uv*4.+mod(111.+iTime*11110.7, 1337.));
float r = SmoothNoise2(vec2(x,y),1);
fragColor = vec4( vec3(SmoothNoise2(uv+r+iTime*2.,3)), 1.0 )*0.5;
fragColor -= vec4(r)*0.1;
fragColor = vec4( vec3(SmoothNoise2(uv*4.+iTime*2.,3)), 1.0 );
}

@ -1,34 +0,0 @@
#iChannel0 "file://./Textures/colorful.jpg"
#iChannel0::WrapMode "Mirror"
#iChannel1 "file://./Textures/palette_LUT_opt.png"
#iChannel1::MinFilter "Nearest"
#iChannel1::MagFilter "Nearest"
#iChannel1::WrapMode "Mirror"
#define S(a,b,c) smoothstep(a,b,c)
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
void mainImage ( out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord/iResolution.y);
vec4 col = vec4(0,0,0,1.0);
vec3 texCol = texture(iChannel0, uv).rgb;
vec2 coords;
coords.x = texCol.r;
//float g = floor(map(texCol.g, 0., 1., 0., 63.));
//float b = floor(map(texCol.b, 0., 1., 0., 63.));
//coords.y = map(g+b*64., 0., 4095., 0., 1.);
coords.y = (texCol.g*63.+floor(texCol.b*63.)*64.)/(4095.);
vec3 tmp = texture(iChannel1, coords).rgb;
col.rgb = tmp;
fragColor = col;
}

@ -1,87 +0,0 @@
#iChannel0 "file://./Textures/colorful.jpg"
#iChannel0::WrapMode "Mirror"
float pow2(float x) {
return x*x;
}
/* euclidian */
float colDist(vec3 col1, vec3 col2) {
return distance(col1, col2);
}
/* optimized L*a*b*-like */
float colDist2(vec3 col1, vec3 col2) {
float r_mean = (col1.r + col2.r) * 256./2.0;
float r = (col1.r - col2.r) * 256.;
float g = (col1.g - col2.g) * 256.;
float b = (col1.b - col2.b) * 256.;
//float dc = sqrt((2.0+r_mean/256.) * pow2(r)
// + 4.0*pow2(g)
// + (2.0 + (255.-r_mean)/256.) * pow2(b) );
float dc = sqrt( (512.+r_mean)*r*r/256.
+ 4.*g*g +
(767.-r_mean)*b*b/256.);
return dc;
}
vec3 bestColor(vec3 col, vec3 pal[22]) {
//col = pow(col, vec3(1./2.2));
//col.r = pow(col.r,1./1.7);
//col.g = pow(col.g,1./1.7);
//col.b = pow(col.b,1./2.2);
float mdist = colDist2(col, pal[0]);
vec3 bcolor = pal[0];
for(int i=0;i<22;i++) {
float d = colDist2(col, pal[i]);
if (d < mdist ) {
mdist = d;
bcolor = pal[i];
}
}
return bcolor;
}
void mainImage ( out vec4 fragColor, in vec2 fragCoord) {
vec3 pal[22];
pal[0]=vec3(0.953125,0.953125,0.953125);
pal[1] = vec3(0.578125,0.6875,0.7578125);
pal[2] = vec3(0.3359375,0.421875,0.5234375);
pal[3] = vec3(0.19921875,0.234375,0.33984375);
pal[4] = vec3(0.1015625,0.109375,0.171875);
pal[5] = vec3(0.99609375,0.80078125,0.45703125);
pal[6] = vec3(0.93359375,0.48828125,0.33984375);
pal[7] = vec3(0.55859375,0.3359375,0.23046875);
pal[8] = vec3(0.3984375,0.22265625,0.19140625);
pal[9] = vec3(0.65234375,0.9375,0.4375);
pal[10] = vec3(0.21875,0.71484375,0.390625);
pal[11] = vec3(0.14453125,0.44140625,0.47265625);
pal[12] = vec3(0.84765625,0.33984375,0.38671875);
pal[13] = vec3(0.921875,0.19921875,0.296875);
pal[14] = vec3(0.69140625,0.2421875,0.32421875);
pal[15] = vec3(0.4609375,0.2578125,0.5390625);
pal[16] = vec3(0.36328125,0.15234375,0.36328125);
pal[17] = vec3(0.26953125,0.15625,0.234375);
pal[18] = vec3(0.5859375,0.78125,0.93359375);
pal[19] = vec3(0.25390625,0.6484375,0.9609375);
pal[20] = vec3(0.23046875,0.36328125,0.78515625);
pal[21] = vec3(0.24609375,0.24609375,0.453125);
vec2 uv = (fragCoord/iResolution.y);
vec4 col = vec4(0,0,0,1.0);
vec3 texCol = texture(iChannel0, uv).rgb;
vec3 tmp = bestColor( texCol, pal);
col.rgb = tmp;
fragColor = col;
}

@ -1,42 +0,0 @@
#iChannel0 "file://./Textures/colorful.jpg"
#iChannel0::WrapMode "Mirror"
#iChannel1 "file://./Textures/palette_LUT_opt.png"
#iChannel1::MinFilter "Nearest"
#iChannel1::MagFilter "Nearest"
#iChannel1::WrapMode "Mirror"
mat4 bayerIndex = mat4(
vec4(00.0/16.0, 12.0/16.0, 03.0/16.0, 15.0/16.0),
vec4(08.0/16.0, 04.0/16.0, 11.0/16.0, 07.0/16.0),
vec4(02.0/16.0, 14.0/16.0, 01.0/16.0, 13.0/16.0),
vec4(10.0/16.0, 06.0/16.0, 09.0/16.0, 05.0/16.0));
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
void mainImage ( out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord/iResolution.y);
vec4 col = vec4(0,0,0,1.0);
vec3 texCol = texture(iChannel0, uv).rgb;
float bayerVal = bayerIndex[int(fragCoord.x) % 4][int(fragCoord.y) % 4];
texCol.r = step(bayerVal, texCol.r);
texCol.g = step(bayerVal, texCol.g);
texCol.b = step(bayerVal, texCol.b);
texCol = pow(texCol, vec3(2.2));
vec2 coords;
coords.x = texCol.r;
coords.y = (texCol.g*63.+floor(texCol.b*63.)*64.)/(4095.);
vec3 tmp = texture(iChannel1, coords).rgb;
col.rgb = tmp;
fragColor = col;
}

@ -1,53 +0,0 @@
#iChannel0 "file://./Textures/pixelart.png"
//#iChannel0::MinFilter "LinearMipMapLinear"
#iChannel0::WrapMode "Mirror"
// this work is licenced under a CC0 1.0 Universal License
// https://creativecommons.org/publicdomain/zero/1.0/
// https://www.shadertoy.com/view/MllBWf
#define PI 3.14159265359
#define rot(a) mat2(cos(a+PI*vec4(0,1.5,0.5,0)))
vec4 myTexture(vec2 uv) {
vec2 res = iChannelResolution[0].xy;
uv = uv*res + 0.5;
// tweak fractionnal value of the texture coordinate
vec2 fl = floor(uv);
vec2 fr = fract(uv);
vec2 aa = fwidth(uv)*0.75;
fr = smoothstep( vec2(0.5)-aa, vec2(0.5)+aa, fr);
uv = (fl+fr-0.5) / res;
return texture(iChannel0, uv);
}
vec4 nearest(vec2 uv) {
uv *= iChannelResolution[0].xy;
uv = floor(uv)+0.5;
uv /= iChannelResolution[0].xy;
return textureLod(iChannel0, uv, 0.0);
}
vec4 mipmap(vec2 uv) {
return texture(iChannel0, uv);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec2 uv = (fragCoord.xy - iResolution.xy*0.5) / iResolution.x;
vec2 prevUV = uv;
uv *= rot(iTime*0.2);
uv.x *= iChannelResolution[0].y / iChannelResolution[0].x;
uv *= exp2(iMouse.x*0.01);
fragColor = myTexture(uv).rgba;
if (prevUV.x < -0.25) fragColor = nearest(uv);
if (prevUV.x > 0.25) fragColor = mipmap(uv);
if (abs(prevUV.x+0.25) < 0.005) fragColor.rgb = vec3(0);
if (abs(prevUV.x-0.25) < 0.005) fragColor.rgb = vec3(0);
}

@ -1,83 +0,0 @@
#iChannel0 "file://./Textures/forrest.jpg"
#iChannel0::MinFilter "LinearMipMapLinear"
#iChannel0::WrapMode "Mirror"
#define S(a,b,c) smoothstep(a,b,c)
float size = 4.0;
vec2 aspect = vec2(2,1);
float N21(vec2 p) {
//return fract( sin(p.x*100.0+p.y*6574.0)*5647.0 );
p = fract(p*vec2(233.32, 851.73));
p += dot(p, p+23.45);
return fract(p.x*p.y);
}
vec4 BoxCoords(vec2 uv) {
vec2 gv = fract(uv);
vec2 id = floor(uv);
//standard uv
return vec4(gv.x, gv.y, id.x, id.y);
}
vec3 RainLayer(vec2 uv, float t) {
vec2 iuv = uv;
uv.y += t * 0.13;
uv *= size * aspect;
vec4 gv = BoxCoords(uv);
gv.xy -= 0.5;
float dt = N21(gv.zw);
t += dt*6.22134;
float w = (iuv.y) * 10.;
float x = (dt-0.5)*0.8;
x += (.4-abs(x))*sin(3.*w)*pow(sin(w),6.)*0.45;
float y = -sin(t+sin(t+sin(t)*0.5))*0.45;
y -= (gv.x-x)*(gv.x-x);
vec2 dropPos = (gv.xy-vec2(x,y))/aspect;
float drop = S(.05, 0.03, length(dropPos));
vec2 trailPos = (gv.xy-vec2(x,t * 0.25))/aspect;
trailPos.y = (fract(trailPos.y * 8.)-0.5) /8.;
float trail = S(.03, 0.01, length(trailPos));
float fogTrail = S(-.05, .05, dropPos.y);
fogTrail *= S(.5, y, gv.y);
trail *= fogTrail;
fogTrail *= S(0.05, 0.04, abs(dropPos.x));
vec2 offset = drop*dropPos + vec2(trail)*trailPos;
offset *= -2.;
return vec3(offset, fogTrail);
//return vec3(drop,1, fogTrail);
}
void mainImage ( out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord/iResolution.y);
float t = iTime; //mod(iTime, 7200.);
vec4 col = vec4(0,0,0,1.0);
vec3 rain = RainLayer(uv,t);
rain += RainLayer(uv*1.2+7.21,t+22.721);
rain += RainLayer(uv*1.35+111.21,t-102.);
rain += RainLayer(uv*1.55-232.21,t+10.);
float blur = 4.0*(1.-rain.z);
col.rgb = texture(iChannel0, uv + rain.xy, blur).rgb;
//col = vec4(rain.xxx,1.);
//if (gv.x > 0.48 || gv.y > 0.48) col = vec4(1,0,0,1);
//col.rgb = vec3(N21(uv.xy));
fragColor = col;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 196 KiB

@ -1,5 +1,5 @@
#iChannel0::WrapMode "Repeat"
#iChannel0 "file://./Textures/sand.jpg"
#iChannel0 "file://./sand2.jpg"
float N21(vec2 p) {
//return fract( sin(p.x*100.0+p.y*6574.0)*5647.0 );
@ -41,11 +41,12 @@ float SmoothNoise2(vec2 uv, int ocataves) {
void mainImage ( out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord-0.5*iResolution.xy)/iResolution.y;
uv = uv*4.;
float tmp;
float b = SmoothNoise2(uv*4.+iTime*0.5,2)*0.5+SmoothNoise2(uv*4.-iTime*0.2,2)*0.5;
float b = SmoothNoise2(uv+iTime*0.5,2)*0.5+SmoothNoise2(uv-iTime*0.2,2)*0.5;
tmp = smoothstep(0.5, 0.505, b);
b = tmp - smoothstep(0.505, 0.51, b);
fragColor = vec4( texture(iChannel0, uv*1.5+ SmoothNoise2(uv+iTime*0.5,2)*0.4 ).xyz+b, 1.0 );
fragColor = vec4( texture(iChannel0, uv+ SmoothNoise2(uv+iTime*0.5,2)*0.4 ).xyz+b, 1.0 );
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 905 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Loading…
Cancel
Save