#https://www.shadertoy.com/view/4l2GzW

pixels = W:1024 H:1024

x = from 0 to 1023 W
y = from 0 to 1023 H

s = 36
dis = 2.0

ix = -1
iy = -1
px = floor(x/s) + ix
py = floor(y/s) + iy
tx = px*23.62-300.0+py*34.35
ty = px*45.13+256.0+py*38.89
rx = fract(cos(tx*89.42)*343.42)
ry = fract(cos(ty*89.42)*343.42)
rx = rx + ix - fract(x/s)
ry = ry + iy - fract(y/s)
d = sqrt(rx*rx + ry*ry)
dis = if(dis > d, d, dis)

ix = 0
iy = -1
px = floor(x/s) + ix
py = floor(y/s) + iy
tx = px*23.62-300.0+py*34.35
ty = px*45.13+256.0+py*38.89
rx = fract(cos(tx*89.42)*343.42)
ry = fract(cos(ty*89.42)*343.42)
rx = rx + ix - fract(x/s)
ry = ry + iy - fract(y/s)
d = sqrt(rx*rx + ry*ry)
dis = if(dis > d, d, dis)

ix = 1
iy = -1
px = floor(x/s) + ix
py = floor(y/s) + iy
tx = px*23.62-300.0+py*34.35
ty = px*45.13+256.0+py*38.89
rx = fract(cos(tx*89.42)*343.42)
ry = fract(cos(ty*89.42)*343.42)
rx = rx + ix - fract(x/s)
ry = ry + iy - fract(y/s)
d = sqrt(rx*rx + ry*ry)
dis = if(dis > d, d, dis)

ix = -1
iy = 0
px = floor(x/s) + ix
py = floor(y/s) + iy
tx = px*23.62-300.0+py*34.35
ty = px*45.13+256.0+py*38.89
rx = fract(cos(tx*89.42)*343.42)
ry = fract(cos(ty*89.42)*343.42)
rx = rx + ix - fract(x/s)
ry = ry + iy - fract(y/s)
d = sqrt(rx*rx + ry*ry)
dis = if(dis > d, d, dis)

ix = 0
iy = 0
px = floor(x/s) + ix
py = floor(y/s) + iy
tx = px*23.62-300.0+py*34.35
ty = px*45.13+256.0+py*38.89
rx = fract(cos(tx*89.42)*343.42)
ry = fract(cos(ty*89.42)*343.42)
rx = rx + ix - fract(x/s)
ry = ry + iy - fract(y/s)
d = sqrt(rx*rx + ry*ry)
dis = if(dis > d, d, dis)

ix = 1
iy = 0
px = floor(x/s) + ix
py = floor(y/s) + iy
tx = px*23.62-300.0+py*34.35
ty = px*45.13+256.0+py*38.89
rx = fract(cos(tx*89.42)*343.42)
ry = fract(cos(ty*89.42)*343.42)
rx = rx + ix - fract(x/s)
ry = ry + iy - fract(y/s)
d = sqrt(rx*rx + ry*ry)
dis = if(dis > d, d, dis)

ix = -1
iy = 1
px = floor(x/s) + ix
py = floor(y/s) + iy
tx = px*23.62-300.0+py*34.35
ty = px*45.13+256.0+py*38.89
rx = fract(cos(tx*89.42)*343.42)
ry = fract(cos(ty*89.42)*343.42)
rx = rx + ix - fract(x/s)
ry = ry + iy - fract(y/s)
d = sqrt(rx*rx + ry*ry)
dis = if(dis > d, d, dis)

ix = 0
iy = 1
px = floor(x/s) + ix
py = floor(y/s) + iy
tx = px*23.62-300.0+py*34.35
ty = px*45.13+256.0+py*38.89
rx = fract(cos(tx*89.42)*343.42)
ry = fract(cos(ty*89.42)*343.42)
rx = rx + ix - fract(x/s)
ry = ry + iy - fract(y/s)
d = sqrt(rx*rx + ry*ry)
dis = if(dis > d, d, dis)

ix = 1
iy = 1
px = floor(x/s) + ix
py = floor(y/s) + iy
tx = px*23.62-300.0+py*34.35
ty = px*45.13+256.0+py*38.89
rx = fract(cos(tx*89.42)*343.42)
ry = fract(cos(ty*89.42)*343.42)
rx = rx + ix - fract(x/s)
ry = ry + iy - fract(y/s)
d = sqrt(rx*rx + ry*ry)
dis = if(dis > d, d, dis)

r = 1.0 - dis
g = 1.0 - dis
b = 1.0 - dis
