Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Outline on transparent mesh without overlaps

Discussion in 'General Graphics' started by Jolla, Jun 16, 2022.

  1. Jolla

    Jolla

    Joined:
    Sep 27, 2018
    Posts:
    1
    Hi all!
    I searched all over, and I couldn't find a solution to this problem (or at least not one compatible with URP)
    image.png

    I need transparent silhouettes with an outline / glow around them. I've been using a simple fresnel effect in shadergraph to achieve the outline, but the transparency makes it so that the outline overlaps through the mesh.

    What I want is something like this :

    image (1).png

    So the whole body is transparent except for the outline, but the outline doesn't overlap with itself.
    I need the transparency so that particles can shine through it , like this :

    image (2).png

    I achieved the result in the last picture by setting the mesh's material's depth test to "Less equal", but it only sems to work with certain rotations of the objects (probably because of the order in which the triangles are rendered?).
    I tried playing with render queues, custom forward renderer rendering objects, and nothing would get me to the desired result.
    It's hard to believe that something as basic as this (and I say basic because even the unity editor is able to do this, when we select an object and an outline of the silhouette with no overlaps is displayed in orange), would be so hard to achieve.
    Does anybody have any clues for how to make this work in URP?
    Here is something I found which would seem to aim at my desired result, but does not work in URP :
    http://clynamen.github.io/blog/2014/06/24/outline-in-unity-with-mesh-transparency/
    Thanks!