How to control 64 LEDs without using 64 individual wires? Multiplexing!
Running a wire to the anode of each led would obviously be impractical, and would look really bad.
One way to get around this, is to split the cube into 4 layers of 16x16 LEDs.
All the LEDs aligned in a vertical column share a common anode (+).
All the LEDs on a horizontal layer share a common cathode (-).
Now if i want to light up the LED in the upper left corner in the back (0,0,3), I just supply GND (-) to the upper layer, and VCC (+) to the column in the left corner.
If i only want to light up one led at a time, or only light up more than one layer at the same time.. this works fine.
However, if I also want to light up the bottom right corner in the front (3,3,0), I run into problems. When I supply GND to the lower layer and VCC to the front left column, I also light up the upper right led in the front (3,3,3), and the lower left LED in the back (0,0,0). This ghosting effect is impossible to workaround without adding 64 individual wires.
The way to work around it is to only light up one layer at a time, but do it so fast that the eye doesn't recognize that only one layer is lit at any time. This relies on a phenomenon called Persistence of vision
Each layer is a 4x4 (16) image.
If we flash 4 16 led images one at a time, really fast, we get a 4x4x4 3d image!