Querying painted layer at a position on landscape

Apologies in advance if this isn’t the correct section to ask this question - it involves coding but the main focus are landscape materials so I thought this might be the best place.

I’m attempting to implement contextual footstep SFX based on the surface the player is walking on. I know the usual implementation of this is to use surface types and assign physical materials to the different layers of the landscape material, but unfortunately querying the surface type at a position on a landscape is broken in the version my team is using (4.24.1). We have an important deadline coming up soon so we’d like to avoid changing versions right now, so I figured I’d try to find a workaround.

The first possible solution that comes to mind is to query the layer that is painted below the player’s feet. Our lead artist said that he believes this information is stored in the vertices of the landscape, but I’m not sure how to access this in code, or if this is even something that’s possible.

If anyone has any insight into how I could access this information at runtime, or knows of any other possible alternatives to surface types, it would be much appreciated! Also, if this would be better asked in the Blueprint or C++ section, I will kindly take my question elsewhere.

Hi, this seems to have been resolved in 4.24.2.

But if you meant that with avoid changing versions, then this might help you:

As far as I know the landscape layer data gets stored in the “landscape layer info” you create for each layer. And the resolution of the layer info is the same as your landscape resolution, so if your landscape would be 4033 x 4033 then the layer info resolution would be 4033x4033. I don’t know how/whether you can access those through code though.

One other thing that might be useful for you, is that you could mask your layers (one specific layer white color all others black color inside your material, so “sample layer” as color) and then take a orthographic top view shot from the landscape using a render target and scene capture component 2d, then you would get the layer info into a texture. You can do this for each layer then. But I also don’t know how you can access a texture through C++.

So you might get a more qualified answer in the C++ section :slight_smile: