I have recreated the material described in this post:

But I was wondering, what can I do to this material to make it create a grid in all three directions? Currently it creates a grid in X and Z directions. But in the Y direction, it only creates vertical lines.

Is there a way to create this same grid, but so that it works in vertical direction as well?

I have tried monkeying with this material as much as I can think and have come up with nothing.

Basically we convert every component (x, y, and z) into -1 or 1.
By multiplying those together, we get an XOR operation which makes a 3d checkerboard.
Then we use that to lerp between two colors.

The small offset added at the beginning is because this process leads to aliasing at grid boundaries. If you have a cube with an edge exactly at a transition point, you’ll get flickering.