In your buffer_shift() function, try turning off all the LEDs and the MOSFETs before writing out the new values. It could be that the shift registers directly driving the LEDs are switching faster than the MOSFETs, causing the wrong LEDs to very briefly turn ON before the MOSFET has had time to switch to the next level.
void buffer_shift() {
for (byte level = 1; level < 5; level++) { //z, iterating through all levels
byte cache_8 = 0; //needs to be reset with every iteration, storing final pattern for columns 1-8
byte cache_16 = 0; //columns 9-16
//Column 1-8: "creating" byte for the first register by adding the bytes of each LED to get the final pattern
for (byte row = 1; row < 3; row++) { //x, iterating through first 2 rows
for (byte column = 1; column < 5; column++) { //y, iterating through the 4 columns in each row
cache_8 = cache_8 | buffer_pattern[row][column][level];
}
}
//Column 8-16: Same procedure as before, now for the 2nd register
for (byte row = 3; row < 5; row++) { //x, iterating through last 2 rows
for (byte column = 1; column < 5; column++) { //y, iterating through the 4 columns in each row
cache_16 = cache_16 | buffer_pattern[row][column][level];
}
}
shift(0,0,0); //<<<< add this line to turn off all LEDs before writing out new pattern >>>>
shift(cache_8, cache_16 , level); //shifting the pattern for the whole level, 4 times for the whole cube
delay(t); //delay, so that the LEDs are on for longer, makes them shine brighter
//delayMicroseconds(t);
}
}