Search Unity

Screenspace edge detection on separate layer

Discussion in 'Shaders' started by Doidel, Oct 10, 2017.

  1. Doidel

    Doidel

    Joined:
    Jul 10, 2013
    Posts:
    12
    I have a landscape with buildings in my scene. I hope to render the scene normally, yet where the buildings have highlighted edges.
    I use some screen space edge detection on the buildings only, therefore they are in a separate layer called "edges". Then I have two cameras, rendered on top of each other. This unfortunately doesn't achieve what I aim for - the edges are always drawn even when a building is occluded / hidden. And the depth interaction with sprites is even stranger, yet this might be another issue.
    Would maybe "ZWrite On" in my shader help in any way? Currently it's off, but writing into the depth buffer might solve this issue...

    Many thanks in advance for your ideas!
     
  2. Doidel

    Doidel

    Joined:
    Jul 10, 2013
    Posts:
    12
    I managed to solve the issue.
    For future reference:
    I show what I did here:
     
    Last edited: Nov 1, 2017