Download

Accessing landscape's min and max height from within material

I’m stuck on a little problem with my landscape auto-material…

I need to access a Landscape’s min and max height inside my material. For example, I want to get the current landscape’s maximum height to calculate a percentage, to create a mask for a specific ground texture to only appear after 20% of the landscape’s height. I’d like to do it automatically since 20% height of 1 landscape will often be different then another landscape, that way I don’t have to change the height value for that texture to match 20% height of the landscape being used.

Can i do that from within my material only, or do I need to create a blueprint?

Thanks in advance!

Just a bump, hoping someone can help, as I am still stuck on this…thx in advance!

You can get the min/max Z of a component of landscape using the local bounds nodes, but if you reliably want it for the entire landscape you will need to find the min/max Z by hand. I usually do this by placing a plane mesh, scaling its XY to cover the entire world and then dragging it up and down to find the min and max Z value. I will usually watch the side viewports for this in wireframe mode since its a bit easier to line it up there.

Then in the material its a simple formula:

( WorldPosition.B - WorldMinZ ) / (WorldMaxZ - WorldMinZ)

then clamp from 0-1 just to be safe.

Thanks a lot Ryan, I’ll give that a try, it sounds like exactly what I was looking for :slight_smile: