This was something I had thought about quite some time ago - quick to implement now that I have some appropriate infrastructure. Texture / image setup and usage has become completely trivial, and I can do a project like this in a matter of a couple hours. The base concept is fairly simple - using double buffering, compute the Cellular Automata (CA) update by ping-ponging between two textures to avoid having to do any fancy synchronization of GPU resources. One buffer is read from, as the existing state of the CA, and the other buffer recieves the new states. One compute shader invocation per pixel, and the rest is history.
The extension to the idea, which I thought was interesting, was to use a 32-bit unsigned integer texture - and run 32 of the sims in parallel. Because Conway's Game of Life only requires one bit of state for each pixel, this is totally possible. The shader just loads the uint value, and bitmasks out the appropriate sections to evaluate each of the 32 independent sims.
Another interesting aspect, since this update process happens in roughly half a millisecond, is that I can just hardcode it to evaluate all the bits all the time. Would be able to do this many times over and still be hitting up against the vsync limiter. I can then set how many bits are active, with the initialization of the data on the CPU.
I have been calling each individual sim a bit plane - by leaving one of these bit planes uniformly initialized as zeroes, it can never possibly show any activity. This lets me set how many active bit planes there are, by only generating initial data with that many seeded bits - Conway's Game of Life has no way to go from a full zero state to anything else - there is no way to go from a field of zeroes to anything else - the rules do not allow for spontaneous generation of life in that way.
So this is basically all there is to the project. I used the jet color palette in order to visualize the data. Starting at 0.0, and ranging through to 1.0 across the 32 bits, I add the palette sample to an accumulator value if one of the bits are active in the state buffer. I had to bring the brightness down a bit, sort of normalize the data, because using the straight sum was running a little hot, colors too bright.
You can see below examples of two active bit planes, three, sixteen, and the full buffer of thirty-two parallel sims:
This is another one that I don't think really goes anywhere. Just a fun little thing I had thought about one time and had wanted to experiment with for some time. I was a little disappointed in the output, really not as interesting as I had hoped. Videos of it come out very poorly. In any event, interesting to see it brought into the real world, you don't know if you don't try.
Last updated 7/9/2023