Search Unity

Z-Fighting coplanar faces. Draw one after another.

Discussion in 'Shaders' started by Unique-Player, Dec 14, 2019.

  1. Unique-Player

    Unique-Player

    Joined:
    May 6, 2017
    Posts:
    78
    I am trying to simulate Shaded-Wireframe rendering of scene-view in game-view with MeshTopology.Lines.
    Currently, object is copied and located at the exact location as original one, then MeshTopology applied.
    Only problem i have is that there are visible flickering of lines because of faces overlapping each other. Solution is, for now, to use shader which extrudes vertex along normals.
    But i would like to know if there any way to have two objects with overlapping faces being rendered one after another without flickering.
    So far i have used - ZTest, Offset with no luck. Even though it works with faces, they do not work with lines generated by MeshTopology. Offset is not working at all, ZTest - can`t find suitable one. if set to Greater(GEqual) lines become visible above anything, Less on original object is not chaning anything.
    Any help would be appreciated, thanks.


    Since the final purpose is different from just showing wireframe, i must use MeshTopology. GLlines are too slow.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    Unique-Player likes this.