Create a gradient dependant of distance to an object I have the following scenario in cycles:



I would like to know if it is possible to create a gradient on a plane like the one on the image above where the colours depend on the distance to an object (sphere in this case). In this case, the surface right below the ball would be the nearest one and hence would be of one colour. As we move away from the plane's center the colour should change accordingly to the distance to the sphere.
I would like to automatize the process so that blender takes the coordinates of the sphere and automatically draws a colour gradient on the plane's surface.
I have managed to create the gradient but I cannot make it dependant of the distance to an object.

Thanks in advance
You can do something like this with dynamic paint.  This solution does calculate proximity from the mesh, not just the center point.

The plane should be your dynamic paint canvas, the sphere (or whatever object(s)) the brush.  I suggest painting to vertices as that's easy to use in the material node setup.  On the brush object, set your paint source to "Proximity" and set a Paint Distance that gives you the gradient values you're looking for.



Then set up your material to translate the gradient into a color gradient input to a shader.  Here I've used the wetmap.