How can I adjust the input value on a material based on camera distance?

How can I adjust the input value on a material based on camera distance? I want to adjust the Z scale of the gradient texture on this material based on camera distance, so that the input value increases up to a 2.000 when the camera is close to the object, and decreases up to .700 when the camera is further away.


Example for how it should look when the camera is close


Example for how it should look when the camera is far away

You’re probably looking for Camera Data > View Distance value to plug into your scaling:


Texture Coordinate:Camera > Distance < [0,0,0] or Texture Coordinate:Camera > Length would give the exact same result.

It doesn’t seem to work when used for scaling, but I managed to get it to work by inputting it into the location after some modifications, thanks for pointing me in the right direction