How can I get the exact Z axis global value into my Material?

Thanks for the answer. I was already using a world position node but since you said that it gives the exact position of each pixel, I went through my material again and removed a bunch of nodes that were multiplying the effect. I got it working now as I wanted thanks!