[Solved] [Help] "Select Slope" material function for landscape?

I’m trying to create a material function similar to the “Select Slope” node in WM.

The idea is to have an input for degrees, and output with 0 for areas below it and 1 for areas above it, with a fallof.

I can’t even get the simple result of 0 and 1 though. I tried doing like the attached image, but even in unlit it results in everything being white.

What am I missing here?

p.s.
MinDegree should be beteen 0 and 90 degrees

I think what’s misleading here is the “radian” value, which technically isn’t true for UE here. See this thread https://answers.unrealengine.com/que…cted-resu.html .
The input for Sine or Cosine here is between 0 and 1, which means that after converting your angle to radians you would need to divide it again by 2 pi to normalize it. Which is exactly the same as just dividing the input by 360.

So instead of doing that:

Try that:

All white for a slope angle above 60 degrees.

The If creates a hard mask though, so not the best way to achieve this unless you need it specifically like that.

To fade the masks you would have to use a map range.
if you *2PI the dot result you get the degree value.
To save on render cost you could just go the other way around. Adapt to the dot value.

map range clamped will output a mask that can be fed directly into a lerp.

Thank you both guys!

@msum Yeah that was very confusing! I since my input is in degrees anyway I ended up usnig custom code with “radians(cos(Value))”. Single node for both, and it actually works!

[USER=“3140864”]MostHost LA[/USER] I actually ended up using the Smooth Step node. But yeah it was a hard edge on the mask before that!

@matan19 could you post the solution you used. Im a bit of a noob and would like that smooth mask that takes in a degree!

I manged to come up with solution after a bit of messing around for anyone else looking. Added in a bit of extra stuff before the smooth step, so the blending takes place always along the slope angle and isnt offset :cool: