I am trying to create a shader that darkens an object based on its distance to one and only one other object (closer = darker).
I suppose this is sort of like Ambient Occlusion where a trace is used to detect presence of other objects, but I want to do this specifically for one ‘reference’ object and not other ones.
The end-goal is to create a weathering look for a cube that is inserted into a plane. The grunge on the cube gets darker as you get lower, closer to the ground.
Any idea how to do this? Not sure if OSL can do this.