live on https://babel.alfaoz.dev
an infinite gallery you can walk through. every room (section) has a monolith, every monolith has four paintings, and every painting is deterministic.
inspired by borges' the library of babel, but for images instead of text.
you navigate a 3d grid of rooms in first person. each room is an open 20m space with a monolith at its center. the monolith has four faces (north, south, east, west), each displaying a 64x64 rgb painting, 12,288 bytes, generated purely from the room coordinate and face index.
the grid is centered on (0, 0) and extends roughly 2^49,000 rooms in each direction, far more than atoms in the observable universe. every coordinate always produces the same painting. there is no randomness at render time.
rooms use signed coordinates displayed in hex with an explicit sign prefix:
+7F3A2, -12C
the first value is x (east-west), the second is z (north-south). coordinates can also be represented as compressed base64url tokens for sharing.
internally, signed values are encoded with a zigzag scheme: 0 -> 0, -1 -> 1, 1 -> 2, -2 -> 3, ... this keeps small coordinates compact regardless of sign.
the mapper is the core of the gallery of babel. given (roomX, roomZ, faceIndex), it produces exactly 12,288 bytes (64 * 64 * 3 rgb). the pipeline:
-
pack - encode the x coordinate into the first half of the byte array, z into the second half, and the face index (0-3) into the lowest 2 bits of the first byte.
-
diffuse - run 4 forward mixing rounds and 4 backward mixing rounds over the packed bytes. each round adds the previous byte plus a stepped tweak value, propagating small coordinate changes across the entire array. forward and backward passes ensure every byte depends on every other byte.
-
permute - rearrange all 12,288 bytes using a fixed permutation (coprime step walk).
-
affine transform - multiply each byte by a precomputed odd number and add a constant, all mod 256. the multipliers and addends are seeded deterministically from
0x0badc0deusing mulberry32 prng. using odd multipliers guarantee this invertibility.
given an image, the mapper can recover the exact coordinate it belongs to by running the pipeline backwards.
| key | action |
|---|---|
| wasd | move |
| mouse | look |
| shift | run |
| space | jump |
| r | random jump |
| ctrl+z | undo jump |
| c | copy coordinate |
| shift+c | toggle compact/raw format |
| f | flashlight |
| p | toggle hud |
| tab | navigator panel |
| click painting | inspect image |
three.js, esbuild, web audio api.
gnu gplv3