Oh, well then your network should work! You really dont need a DistanceBetween node tough, since the coordinates you get form sampler info are already in the distance space your after. By the way this a is a bit trickery problem to solve because im not really debugging maya im debugging you.
Any suggestion with remapColor, gammaCorrection or other nodes????
No you dont need those nodes just a sampler info setrange and a ramp is enough. RemapValue is color is the same as a ramp + set range so its a bit shorter solution tough.
So what you do is you connect:
samplerInfo.pointCameraZ -> remapValue.inputValue
remapValue.inputValue -> the color your driving
Then important! change the range to NEGATIVE VALUES, this is the only caveat. Camera depth is on the negative side so for example you want the color to change over from absolute distances form camera to a range of 10 units set the input min to 0, input max to -10
Thats it.
PS: the only thing I can think of as a problem is the neagetive values caveat.