{
  "format": "field",
  "version": 1,
  "meta": {
    "name": "Pixel Art 8-Bit Dither Matrix",
    "author": "Infinite",
    "description": "Classic four-tone green Game Boy shader with Bayer ordered matrix dithering, block quantization, and CRT pixel grid scanlines.",
    "domain": "pixel"
  },
  "device": {
    "code": "param float pixelSize = 14.0 [4.0, 32.0];\nparam float waveSpeed = 0.65 [0.1, 2.0];\nparam float ditherDepth = 0.45 [0.1, 1.0];\nparam float scanlineDark = 0.15 [0.0, 0.5];\nparam float contrast = 1.4 [0.5, 2.5];\n\np = vec2((uv.x - 0.5) * aspect, uv.y - 0.5) * 2.4;\ntime = t * waveSpeed;\n\nblocks = 1080.0 / pixelSize;\nbx = floor(uv.x * blocks) / blocks;\nby = floor(uv.y * blocks) / blocks;\nbp = vec2((bx - 0.5) * aspect, by - 0.5) * 2.4;\n\nd = length(bp);\nang = atan2(bp.y, bp.x);\nw1 = sin(bp.x * 4.5 + time * 1.8);\nw2 = cos(bp.y * 4.0 - time * 1.4);\nw3 = sin(d * 8.0 - time * 2.2 + ang * 2.0);\nraw = (w1 * 0.35 + w2 * 0.35 + w3 * 0.3) * 0.5 + 0.5;\n\npx4 = floor(uv.x * 1080.0 / (pixelSize * 0.25)) % 4.0;\npy4 = floor(uv.y * 1080.0 / (pixelSize * 0.25)) % 4.0;\n\nbayer = if(py4 < 1.0, if(px4 < 1.0, 0.0, if(px4 < 2.0, 0.5, if(px4 < 3.0, 0.125, 0.625))), if(py4 < 2.0, if(px4 < 1.0, 0.75, if(px4 < 2.0, 0.25, if(px4 < 3.0, 0.875, 0.375))), if(py4 < 3.0, if(px4 < 1.0, 0.1875, if(px4 < 2.0, 0.6875, if(px4 < 3.0, 0.0625, 0.5625))), if(px4 < 1.0, 0.9375, if(px4 < 2.0, 0.4375, if(px4 < 3.0, 0.8125, 0.3125))))));\n\nv = clamp((raw - 0.5) * contrast + 0.5 + (bayer - 0.5) * ditherDepth, 0.0, 1.0);\n\nc0 = vec3(0.059, 0.220, 0.059);\nc1 = vec3(0.188, 0.384, 0.188);\nc2 = vec3(0.545, 0.675, 0.059);\nc3 = vec3(0.608, 0.737, 0.059);\n\ncol = if(v < 0.25, c0, if(v < 0.50, c1, if(v < 0.75, c2, c3)));\n\nscanline = sin(uv.y * 1080.0 * 3.14159) * 0.5 + 0.5;\ncol = col * (1.0 - scanline * scanlineDark);\nalpha = 1.0;\n",
    "params": {
      "pixelSize": 14.0,
      "waveSpeed": 0.65,
      "ditherDepth": 0.45,
      "scanlineDark": 0.15,
      "contrast": 1.4
    },
    "nodeSettings": {
      "width": 1080.0,
      "height": 1080.0,
      "animate": 1.0
    }
  }
}