Lang Jam #0002, a hackathon for designing themed programming languages, was held
in December 2021, with a theme of "patterns". I participated in the jam and
created and submitted mosaic
, an esoteric programming language designed around
manipulating visualized mosaic patterns.
Programs in mosaic
operate by applying replacement patterns to the mosaic,
which is an infinite grid of tiles, each with an associated color and symbol.
Their source code consists of a initial mosaic and a list of instructions. The
primary type of instructions are replacement patterns, which substitute NxM grids
of tiles in the mosaic.
The core of the implementation is an interpreter written in Rust. I demonstrated
that the language is Turing complete by writing an interpreter for a Turing
complete language (BF) in mosaic
. My submission consisted of these with the
addition of an interactive playground with 3D visualizations. The playground uses
the Rust interpreter via WASM, and displays the progression of the mosaic in 3D
using three.js.
Each mosaic tile in the playground is unique.
For each tile, the piece shapes are generated using two unique random Voronoi patterns, which are composited through BSP-based 2D CSG operations to create the letter outline. Then, each shapes' vertices are perturbed randomly. This modification results in a grout effect after the pieces have been extruded into 3D stones with a slightly varied angle. Each stone has bespoke color and shine to create an effect of natural variation.
The variation in the mosaic is best observed by zooming into a single tile, using the low angle and sunlight reflection to more clearly distinguish all of the differences.
Because rendering all of the tiles in 3D is very computationally expensive, far away tiles are replaced with a 2D plane with custom normal, albedo, and material maps to simulate the 3D tile surface.
mosaic
won the top spot in both the community vote and the official winners
video.