Change material properties based on z-depth (camera distance)

This may not be new to others, but I thought this was fun to play around with changing material properties based on distance from the camera. All the cubes have the same material on them (see node set up).



You can try logarithm instead of divide in the math node as well.