Skip to main content

checkerTile: Binary Checkerboard Pattern Tiling

Alternating binary pattern generation​

The checker tiling function generates alternating 0/1 patterns from tile coordinates. For tile indices (z,w)(z, w), the function computes the checkerboard value using modular arithmetic:

c=(z mod 2,w mod 2)c = (z \bmod 2, w \bmod 2) checker=∣cx−cy∣\text{checker} = |c_x - c_y|

This produces a binary output where adjacent tiles have opposite values, creating the classic checkerboard pattern.

Binary Output Mapping​

Tile Index (z,w)(z,w)z mod 2z \bmod 2w mod 2w \bmod 2$c_x - c_y$Pattern
(0,0)(0,0)000000Black
(1,0)(1,0)110011White
(0,1)(0,1)001111White
(1,1)(1,1)111100Black

High Contrast Checkerboard​

Live Editor

const fragment = () => {
      const pattern = checkerTileVec2(uv.mul(8))
      const color = vec3(pattern)
      return vec4(color, 1)
}
Result
Loading...