Lenghtening the Z range of Distance to Nearest Surface data

Hello all, I’m trying to ultimately detect the corners of intersecting meshes (which has been accomplished) so that grime, mould, and dirt can be collected there. My next step is to lengthen the grime on vertical surfaces, to create a dripping look, without effecting any grime on the horizontal surface.

I wanted to create this in Unreal, rather than an external piece of software, so I can more easily iterate inside the editor by moving the meshes about freely without concerning myself with the textures/look. This would also remove the need to use decals as this would be another actor to move inside the editor, further reducing turnaround times.

I’ve used Unreal’s Distance to Nearest Surface to create a material function that will help create a scalable “mask” for me; successfully creating the first attachment by using the nodes in the second attachment.

I’ve attempted to extract the meshes world position and multiply/mask/add (I’m not really sure which was appropriate) to the proxy dynamic “Ambient Occlusion mask” I’ve tried to develop but this effected the horizontal surfaces as well which I did not want.

Ultimately, how should I approach lengthening the grime on vertical surfaces, to create a dripping look, without effecting any grime on the horizontal surface?