Query Landscape layer weight in Blueprint?

  • I have a snow layer on other layers.
  • I can do LineTrace, check the Phys Mat and Physical Surface Type, however it indicates snow even if it is not 100% snow.
  • I can Break Hit Result, Cast Hit Component to LandscapeComponent, but there seems no layer weight information.

Or if Blueprint cannot do it, how do I do it with C++?

Thanks!

===================================================

If I paint a snow layer (e.g. a round continuous snow area), on 1 side of the area, I have to go to deep snow to get Snow surface type, on the other side of the area, just shallow snow gives me Snow surface type.

“The Physical Material (if any) assigned to areas of Landscape where this layer is dominant.”

So, what I see is, in certain area/direction, it does not assume the dominant layer’s physical material.

===================================================

So, my test result on 4.9:

  • Take LandscapeMountain’s M_Landscape_Master material.

  • Assign Snow physical material to the snow layer info.

  • If I paint snow on a small part of a component, the whole component’s physical material is snow.

  • If I paint grass on the whole component, then painting snow on top of the grass does not give me snow physical material at all, have to remove grass where snow is (but you don’t see if there’s grass below snow).

1 Like

The procedural foliage volume does this.
Check the function in FoliageEdMode.cpp “LandscapeLayerCheck” and “GetMaxHitWeight” (which seems similar to what youre trying to do)
And more specifically ULandscapeComponent::GetLayerWeightAtLocation and ULandscapeComponent::GetLandscapeInfo().GetLayerInfoByName(…)

you would need to have layers in your landscape, which you achieve by adding a “sample layer” node in your material using a chosen name.

(related xkcd: Wisdom of the Ancients )

2 Likes