This solution in the Amplify shader editor describes how to create a gradient on the Z Component.