Elementary cellular automata are defined in a single dimension of quantized space and control a binary state for each cell. They are usually visualized in 2D by mapping the second axis to time. In this context each quantized unit of time corresponds to an evolution of the previous state of the automaton based on a rule.
A rule defines how each cell evolves based on the current state of its nearest neighbours and itself. For elementary automata, there is a fixed set of 8 transitions. These transitions are encoded in 8 bits. Those 8 bits are what we refer to as the rule.
A rule borrows its unique name by its numerical byte value. Each bit encodes the final state of the transitioning cell depending on a specific input state. That input state is defined by the index of the bit encoded in binary. As the maximum index has a value of 7, we need 3 bits to encode that value. These three bits encode the state of the current cell as well as its left and right neighbours.
Putting all this together, rule 126 is illustrated below:
Below is sample code for rule 126, implemented in a GLSL fragment shader.
.png)

