Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Resolved How to get steepness of the mesh

Discussion in 'Shader Graph' started by UserNobody, Apr 21, 2021.

  1. UserNobody

    UserNobody

    Joined:
    Oct 3, 2019
    Posts:
    119
    Hello there,
    I am working on a terrain shader using Shader Graph and would like to ask how to get the steepness of the mesh?
    I want to apply rock texture where the terrain is steep enough, how could I achieve that?

    I currently have this but that doesn't work...

    upload_2021-4-21_23-34-44.png
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,395
    Wouldn't something simple like this work - just create an up vector (0,1,0) and then get a dot product of that and the current surface normal in either object or world space, depending on your use-case.

    Here's an example graph I created:

    20210423_terrain_steepness_graph.png

    Result:
    20210423_terrain_steepness.png
     
    UserNobody likes this.
unityunity