Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [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?

    Click image for larger version  Name:	progress.png Views:	30 Size:	98.4 KB ID:	1820326

    p.s.
    MinDegree should be beteen 0 and 90 degrees
    Last edited by matan19; 10-11-2020, 02:30 PM.

    #2
    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:
    Click image for larger version  Name:	angle3.PNG Views:	0 Size:	220.2 KB ID:	1820961

    Try that:
    Click image for larger version  Name:	angle.PNG Views:	0 Size:	184.0 KB ID:	1820959

    Click image for larger version  Name:	angle2.PNG Views:	0 Size:	232.4 KB ID:	1820960

    All white for a slope angle above 60 degrees.
    Last edited by msum; 10-11-2020, 07:25 AM.

    Comment


      #3
      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.

      Comment


        #4
        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!

        MostHost LA I actually ended up using the Smooth Step node. But yeah it was a hard edge on the mask before that!

        Comment


          #5
          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!

          Comment


            #6
            Click image for larger version  Name:	SlopeMask.PNG Views:	0 Size:	152.7 KB ID:	1827546 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
            Last edited by SoSeductive69 Tv; 10-30-2020, 06:54 AM.

            Comment

            Working...
            X