Search Unity

Question Terrain vs Mesh and flipping triangle diagonals - Terrain documentation

Discussion in 'Documentation' started by Carlbaum, Feb 4, 2021.

  1. Carlbaum

    Carlbaum

    Joined:
    Apr 25, 2013
    Posts:
    1
    TLDR;
    1. Can I flip the diagonal of terrain triangles somehow?
    2. Is there some technical documentation explaining differences between terrain and meshes?

    -

    I just joined a Unity project where we're using real height-maps to generate terrain. I noticed that there are a bunch of artifacts in the generated terrain that could be remedied by simply flipping the triangle diagonal.

    Anyway, I started looking into if I can flip these triangles on the terrain somehow. For a regular mesh I know I can just extract the list of triangles and just swap the vertex indices. However, it doesn't seem possible for terrains.

    I just started looking into this today and I don't fully understand how unity terrains works and how they differ from a regular meshes (and I can't seem to find that in the documentation - maybe I'm just not looking in the correct places?).

    As for the questions:
    1. Can I flip the diagonal of terrain triangles somehow?
      1a) Why not?
    2. Is there some technical documentation explaining differences between terrain and meshes?

    If there is nothing like this I'd like to request it to be added in some way. Perhaps something like the following:

    a) Manual approach - add possibility to manually flip triangle diagonals of terrains. This should ideally propagate through all LODs, but especially important for the highest resolution.​

    b) Map approach - add possibility to specify a one-channel map where values above 0.5 represents one diagonal and values below 0.5 represents the other diagonal.

    c) Automatic approach - I think the preferred diagonal could be automatically extracted from a height-map by looking at the primary direction of hight difference within the quad. Would be really neat if this would be combined with a and b.​

    If nothing like this can be done I guess we just gonna have to smooth out these areas and loose some details or increase the resolution (which isn't really an option).
     
    Radivarig likes this.
  2. Radivarig

    Radivarig

    Joined:
    May 15, 2013
    Posts:
    121