Houdini could do it for sure. Since it doesn’t seem possible to do it in a shader, a mix of generating in Houdini or placing them on the objects in a 3d package. Along with the foliage painting tool is the way to go.. it’s a shame though. I’d of loved to spawn more or less moss based on parameters in a shader.. one day
With built in tools I don't know, I guesss you could blueprint something out. Else houdini engine is a good way to get that done if you don't need it edited at runtime.
I'm pretty sure you'll be able to drive that through niagara - i'm just scratching the surface at the moment but given that it can place particles based on a texture .. the Houdini question is more to do with what happens to the instances ISM instancing only works within in a single actor so if you create a rock blueprint…
The foliage system does draw on static mesh as well as the terrain. But it won't be able to access the mask that's inside of the material. You'd have to manually paint foliage onto the rock. For something like that I'd use houdini - but that might take a bit of time for you to learn.