Hexagonal Cellular Automata

Cellular automata using hexagons have been a requested feature in Visions of Chaos for some time now.

If you are ever in need of programming hexagonal based code, I highly recommend this excellent page that seems to cover every possible question you would ever have about hexagons.

2D Hexagonal CAs

Hexagonal CAs work very similar to square grid CAs. The only difference is that each cell has 6 possible neighbors rather than 8.

Here is a selection of a few 2D Hexagonal cellular automata. Rules shown before each part are in the survival/birth/states format.

2D Hexagonal CA was my top performing twitter post so far. It even got a like from Dan Shiffman which is a real honor as Dan has been an inspiration to me for years now.

3D Hexagonal CAs

This is the one that got most requests. Many people seemed to think that moving from cube grids to hexagonal grids would give better more interesting results, so it was finally time to experiment with 3D hexagonal grids.

3D Hexagonal Cellular Automaton

I adopted the usual Von Neumann and Moore neighborhoods. For 3D hexagonal CA Von Neumann means 8 neighbors per cell (the neighbor cells sharing a face with the current cell, 6 in the XZ plane and 1 above and 1 below). For Moore it is 20 total neighbors (for all face sharing and “edge sharing” neighbor cells).


As with other cellular automata in Visions of Chaos, by default I render the CA cells using software OpenGL. This is fast, but no real support for shadows or ambient occlusion so the resulting images are more difficult to read like the following.

3D Hexagonal Cellular Automaton

For better rendering results I have been using the Mitsuba Renderer for years now. Mitsuba has no native support for hexagonal prisms though. First I tried creating a ply file for a hexagonal prism and rendering that in Mitsuba. I hit a similar bug as described here with the edges rendering black. In the end I ended up using 3 rotated stretched cubes to create each hexagonal prism. Not the fastest solution but I do get nicely rendered 3D grids of hexagonal prisms as the following image shows.

3D Hexagonal Cellular Automaton

Then I also reached what seems to be an object limit in Mitsuba. For a while I would get occasional complaints from people reporting Visions of Chaos would not render using Mitsuba resulting in black frames. I now have code that checks the Mitsuba log at the end of renders looking for “exception” errors. If a Mitsuba exception is detected I now notify the user that Mitsuba had a problem. The limit seems to be around 4.5 million cubes from my tests.

The following image is rendered using just the ambient occlusion integrator in Mitsuba.

3D Hexagonal Cellular Automaton

3D Results

This first example movie of the 3D variant is a generations type. Generations cellular automata base cell updates on the count of each cell’s neighbors.

The rules are in survival/birth/states format. All use the Moore neighborhood so each cell has 20 total neighbor cells.

Help Me

Seeing as these hexagonal CAs are relatively new features of Visions of Chaos I don’t have a large number of sample rules to show them off. If you download Visons of Chaos and experiment with the 2D and/or 3D Hexagonal CA modes please send me any interesting new rules you discover.