Introduction
This is a fairly straightforward implementation of a program to generate Celtic Knots on grids, like ones seen, for example, on the jaw-dropping Book of Kells or Lindisfarne Gospels as well as Celtic Crosses (or, perhaps more commonly today, on tattoos!). These patterns are pretty popular with the celtic revival movements, they are likely Celtic Christian> more than Celtic Barbarian, but anyway.
Once again, we have a pretty simple grid-based system to generate interesting patterns. I've done this project in February of 2018, right after the Voronoi Tilings. I had been aware of Peter Cromwell's paper on the subject for a while, but decided to work on it after coming across Andrew Glassner and his IEEE Computer Graphics & Applications on it (see 1, 2, 3).
Other useful and interesting books were Celtic art in pagan and Christian times (1904) which has a very early description of the method to generate them, and also the several books by George Bain and his son Ian, which show how to create these several other classes of patterns (see this one available on OpenLibrary).
Hows does it work?
The idea is that you start from a dense "basket weave" (crossing bands that alternate being on the top and bottom at crossings), and you successively remove crossings to form a full pattern. As you can see in the figures below, you have 2 implied square grids, the red and the green grid. If you join two adjacent cells of this grid, you remove a crossing. The only rule is that you can't cross green and red edges.
Other than that, you can easily study properties like the separate number of different threads (you may want to limit yourself to a single connected knot), add all kinds of symmetry (from the simpler mirror and rotations to one-dimensional frieze patterns or the two-dimensional wallpaper groups).
Rendering
The trickiest part of the rendering was understand how Bezier Curves work, but after that things went fairly smoothly, and I still use them quite often. Once you know how to generate the curves, you can easily change the band width and its texture, as seen below.
When I worked on this project, I didn't know how to write shaders, so the patterns look a bit flat. It would be simple to change the band to a heightmap, say, with more interesting materials and even project them onto stone, say, to replicate Celtic crosses.
Use in videogames
I didn't work on this with any particular purpose other than curiosity. That said, this is actually a very common kind of pattern used in fantasy games (and other media) - the Witcher and Dragon Age are just a couple of examples, but you'd almost be hard pressed to find a fantasy RPG without them! That said, they typically create a single pattern and repeat it a lot. With a system like this, you could easily generate several examples to breathe some life into otherwise monotonous ornaments.
Also, by modifying the grid size, you can create different kinds of patterns:
- A book/page binding if you remove the inner part of the grid;
- A bracelet or ring if you create a long and thin rectangular pattern (with compatible edges, which can easily be implemented in code or post-processing);
- Ornament in wood/stone like celtic crosses or in clothing;
- Tattoos, etc.