Can a material change its visual appearance based on distance to actors?

I have simple static mesh as ground floor, with a green-ish grass-like material applied. Also I have put some stone meshes onto the ground plane. What I want now is to make the area on the ground plane around (and underneath) the stones appear a bit different then the rest, e.g. blended to a muddy brown or something.

So my question is this: Is it possible to let the material change its appearance based on how far a (certain type of) actor is (in my case the stones)?

If not, how else would you implement such a behaviour?

Are those stones randomly placed? Or you place them manually in level?
For manually placed you can use vertex painting with material that blends two textures.

For automatic solution you kind of looking for how to get ambient occlusion information from lightmass.
And that i am not sure if its possible. But if you had AO information as texture you can just linear interpolate and blend in similar way to vertex paint material.

So for now play with vertex painted material and look for how to get AO information.

Thanks for your feedback, Nawrot.
Do you have any recommendations regarding docs/videos for vertex painting and AO in Unreal?

Update to a very old topic, but here is a way to do it based on a specific object (can probably be done with multiple as well with some tweaking).

Create a Material Parameter Collection (Material Parameter Collections | Unreal Engine Documentation) and create a Vector variable.
In a blueprint that ticks (level blueprint or something else), get the World Location of an object, and store that in the MaterialParameterCollection (split the pin and use the “Set Vector Parameter Value” node to input the X/Y/Z to R/G/B).
In the material you want to know the distance to the object, add a “Collection Parameter” node and link to your MaterialParameterCollection, and pick the value you saved previously.
If you need to compare it to the pixel/vertex (not sure) you are currently shading, use the “Absolute World Position” node in the Material Editor, and then break out the values you want from that to compare and do whatever magic you need.

I used this to create a grass that bends away from the player character moving around in it.