Changing texture/material near meshes

I’m making a lava-shader, where I want it to be hot bubbling lava in the open, and cooler, petrified lava near meshes. So far I’ve tried with depth fade, but I want the texture change to expand around the mesh, not just the fading mesh. Is there anything like a mesh detection node that can give me a mask output, or is there any other, better solution?

Could you draw an example in Photoshop of how you want it to look?

Another question, why can’t you use depth fade as a mask?

I hope this makes sense! With the depth fade I couldn’t get Texture 1 to expand around the mesh, only on the areas where the mesh is hidden beneath the lava. What I’m looking for are a texture change that expands around the whole mesh, and is visible from above, preferably with the possibility to tesselate the lava around the mesh as well to get a dynamic “cooling lava stone” material around any mesh dipped into the lava.

Grateful for any help!

That’s not supported out of the box, however it could be accomplished with the use of a distance field for the mesh. The other meshes materials could lookup the distance field value and use it to lerp in a different term of the material. Distance fields are generated for meshes with Distance Field AO, however they’re not exposed to materials right now. This would require some modifications to the renderer.

When I’ve tried to use Distance fields the area of the material they would effect seamed to be limited to very close to the intersection, is there any way of enlarging this effect?