Search Unity

Question Smoothing texture edge with Shader Graph

Discussion in 'Shader Graph' started by jbaumer6, Mar 27, 2021.

  1. jbaumer6

    jbaumer6

    Joined:
    Mar 12, 2018
    Posts:
    15
    I am currently procedurally generating a river on procedurally generated terrain. I'm having issues with the textures looking jagged on the edges when it takes a diagonal path, or rather, cuts across the terrain perpendicular to the hypotenuse of the mesh tris. Forgive the height issues with the verts in this picture but here is an example:


    Is there anyway to use Shader Graph to turn the jagged edge into a straight line despite the alignment of the tris? I would prefer adjusting the actual mesh to create a flat edge, but I'm okay with a jagged mesh if the solution involves manipulating the textures for the effect.

    If not, what is the easiest way to go about fixing this? I have code in place that places UVs, adjusts verts directly, or I can adjust it on heightmaps created from noise, or whatever. I'll take any solution here, but I figured shader graph is most likely the best course - if it can do it.

    Thanks!
     
    Last edited: Mar 27, 2021
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    This looks like interesting problem.
    I am not sure for the solution.
    But what I would try, is having UV map, with specific colors around edges of water / land and use vertex color, to adjust position, of most displaced vertex of the triangle. Calculation of direction of the edge, may be required. Also, you could define Edge direction, based on UV color. Let say dark is the correct position o of the vertex, bright is displaced, i.e. toward middle of the river.
     
  3. Chromecore

    Chromecore

    Joined:
    Jun 2, 2020
    Posts:
    1
    I was curious if you ever found a solution to this problem. I am running into the same problem with changing the color based on the steepness of the terrain.
     
    StrangeWays777 likes this.