Intersection detection for sand in corners

Hi guys,

I have been searching though the forums and documentation for a while now but cant figure it out.

I’m working on a desert rock material and I want to make it so that the material detects where it intersects with other meshes, so I can use it for a Sandmask.
There is already a z-axis and crevasse mask in there. If I add this Material and connect a vertex paint system in there it would save us a lot of time.


Any other tips and crits are very welcome!

The specular needs some work. I want the sand to be nice and shiny but not too much (Journey is an obvious example). The problem at the moment is that blend between the sand and rock texture is too soft.