Layered Material where the bottom/top of mesh is always covered?

I’ve been trying to figure this out myself, but no dice.

Basically, I want to setup a material that I apply to a bunch of rock static meshes that will keep dirt at the bottom and on top of them no matter what orientation they take.

I don’t even know where to start here. I’m sure there are people who’ve done this and quite easily, I just don’t know where to begin, I’m pretty new to the engine.

I’ve made a mockup in substance painter of the effect I’d like to achieve, I’ve made the dirt on the top and bottom very orange for the example.

e0c1a464c0537af7974042b36eea305c4c42b7e2.jpeg

I’d like to be able to rotate, scale, position it and other rock meshes in my scene and have the material automatically keep the tops and bottoms covered with another sand/dirt material.
I figured a layered material and some kind of crazy material node math setup would get me there, I just lack the prowess to do it on my own.

Any help would be awesome.

A Material has the possibility to read the Vertex Normal in World Space. This way you can lerp between your materials based on the orientation.

Okay, that sounds like a good place to start, thanks for the help.