Help with painting texture using slope

I’m beginning in UE, but there’s another potential solution using vertex colors. I think you’re going to need to create a material function that checks for terrain z values, comparing multiple points (either the z value of 1 to a 2nd point, or 3 points) for change in z value. I’m not sure how the math and nodes would be connected in it, yet vertex colors are used to paint certain textures / materials based on the xyz values of meshes. There’s a number of nodes that are for checking changes in xyz values of meshes, so it could be a matter of referencing the terrain in regard to xyz, and then enabling a vertex color painting or object placing via an automatic tool or something. There’s also CryEngine, which could suffice for importing the terrain and adjusting objects and textures based on slope. UE seems more capable for a custom solution, though.