Get Coordinates Based on a Material Instance

Hi there,

I just watched this video here and created my own landscape map.

Basically I have used three material functions (grass, stone and soil) and blended / masked them together into one material which gives me smooth transitions from grass to dirt to rock. I have then made and instance of that material and applied it to my terrain mesh.

What I need to know:

In a blueprint script I am using a LineTraceByChannel to get a bunch of random hit locations on the terrain. For each of these hits I would like to know what material is being displayed at that location, is it grass, rock or dirt? I don’t suppose this is even possible when using an instance of such a highly masked and blended material?

Thanks for your help!

Okay the only way I found possible to achieve my goal is like that:

I got the normal vector from the LineTraceByChannel at the specified location on the terrain. I now have to check whether it has the normal value at an acceptable angle or not.

My grass is located on more or less flat ground, as defined in the material. Since the normal value on the z axis at 1 defines a flat surface I have made a branch that checks if the z value < 0.9 and if that’s true then, at this location, the terrain must be too steep for grass (must be rock or dirt).

Hope this will help someone else in the future!