#https://www.shadertoy.com/view/XdB3Wy

pixels = W:1024 H:1024

x = from -6.0 to 6.0 W
y = from -6.0 to 6.0 H

px = floor(x)
py = floor(y)
fx = fract(x)
fy = fract(y)

d = 8.0

bx = -1
by = -1
gx = fract(sin((px+bx) * 591.32 + (py+by) * 154.077))
gy = fract(cos((px+bx) * 391.32 + (py+by) * 49.077))
rx = bx - fx + gx
ry = by - fy + gy
k = max(abs(rx), abs(ry))
d = min(d, k)

bx = -1
by = 0
gx = fract(sin((px+bx) * 591.32 + (py+by) * 154.077))
gy = fract(cos((px+bx) * 391.32 + (py+by) * 49.077))
rx = bx - fx + gx
ry = by - fy + gy
k = max(abs(rx), abs(ry))
d = min(d, k)

bx = -1
by = 1
gx = fract(sin((px+bx) * 591.32 + (py+by) * 154.077))
gy = fract(cos((px+bx) * 391.32 + (py+by) * 49.077))
rx = bx - fx + gx
ry = by - fy + gy
k = max(abs(rx), abs(ry))
d = min(d, k)


bx = 0
by = -1
gx = fract(sin((px+bx) * 591.32 + (py+by) * 154.077))
gy = fract(cos((px+bx) * 391.32 + (py+by) * 49.077))
rx = bx - fx + gx
ry = by - fy + gy
k = max(abs(rx), abs(ry))
d = min(d, k)

bx = 0
by = 0
gx = fract(sin((px+bx) * 591.32 + (py+by) * 154.077))
gy = fract(cos((px+bx) * 391.32 + (py+by) * 49.077))
rx = bx - fx + gx
ry = by - fy + gy
k = max(abs(rx), abs(ry))
d = min(d, k)

bx = 0
by = 1
gx = fract(sin((px+bx) * 591.32 + (py+by) * 154.077))
gy = fract(cos((px+bx) * 391.32 + (py+by) * 49.077))
rx = bx - fx + gx
ry = by - fy + gy
k = max(abs(rx), abs(ry))
d = min(d, k)


bx = 1
by = -1
gx = fract(sin((px+bx) * 591.32 + (py+by) * 154.077))
gy = fract(cos((px+bx) * 391.32 + (py+by) * 49.077))
rx = bx - fx + gx
ry = by - fy + gy
k = max(abs(rx), abs(ry))
d = min(d, k)

bx = 1
by = 0
gx = fract(sin((px+bx) * 591.32 + (py+by) * 154.077))
gy = fract(cos((px+bx) * 391.32 + (py+by) * 49.077))
rx = bx - fx + gx
ry = by - fy + gy
k = max(abs(rx), abs(ry))
d = min(d, k)

bx = 1
by = 1
gx = fract(sin((px+bx) * 591.32 + (py+by) * 154.077))
gy = fract(cos((px+bx) * 391.32 + (py+by) * 49.077))
rx = bx - fx + gx
ry = by - fy + gy
k = max(abs(rx), abs(ry))
d = min(d, k)

r = d
g = d
b = d
