Rhombus tiling generator
A 2-dimensional plane P in n-dimensional space can be approximated by a surface made up of axis-parallel 1×1 squares whose corners are integer points. The projection of these faces onto P is a parallelogram tiling that changes along with the approximating surface as P moves through space.
We can orient P so that the projections of the n canonical basis vectors are evenly spaced around a circle centered at the projection of the origin*, which ensures that the tiles are rhombuses and have evenly-distributed rotation angles. Despite this regularity, the resulting tiling is aperiodic for n>3.
To generate the tiling*, for each 1≤i<j≤n, for each (a,b) ∈ ℤ2, we find the unique point p ∈ P whose ith and jth coordinates are respectively a+½ and b+½, then round the other n-2 coordinates of p to the nearest integers to get a new point c, then select the face whose center is c and project it orthogonally onto P. The resulting tile (which might not cover p, interestingly) is colored according to the orientation of this face, represented by the pair (i,j). These calculations are carried out on the graphics hardware in a vertex shader.
Given an arbitrary point p ∈ P, the tile that contains p in the final tiling isn't necessarily the projection of the face closest to p. Coloring points according to the orientation of the closest face produces a different pattern, visualized in an overlay (see last slider). This layer uses a fragment shader to perform the necessary calculation at each point.
(*) The plane parametrization and face selection logic are based on Greg Egan's notes here; the tiling layer is essentially a WebGL implementation of his applet.