Lerping two colors based on pixel z-axis value

Hi! I would like to lerp my material by two different colors based on the pixel z-axis value.
How could I accomplish that?

Thank you!

Hey ,

Maybe something like this is what you’re looking for? AbsoluteWorldPosition lets you get the pixel location, and then you can us the Mask node to get the Z coordinate.

If you’re using Lightmass, one caveat is that it doesn’t seem to use the AbsoluteWorldPosition node; I suspect it just uses 0 when it’s baking but I’m not actually sure. In either case, if you’re baking your lighting, I wouldn’t expect fully accurate bounce lighting from this. If this is for an emissive material or an object that isn’t part of a light bake, it should be fine.

1 Like

Thank you very much! That was exactly what I need.