Search Unity

Question URP X-Ray Effect

Discussion in 'Universal Render Pipeline' started by Klennywenny, Aug 12, 2021.

  1. Klennywenny

    Klennywenny

    Joined:
    Nov 17, 2017
    Posts:
    1
    Hi, im from a small Team currently developing our first Prototype. As we are a quite new and small Team there simply isn´t every position filled up to now. Because of this i have run into a Problem ways out of my normal Workspace as an AI-Programmer. I am currently trying to develop some kind of X-Ray, see trough Walls functionality. At first this seemed quit easy as i just follwed this Unity Guide: https://docs.unity3d.com/Packages/c...ures/how-to-custom-effect-render-objects.html and a Brackey´s Video that is just about the same Thing.

    The Problem is we need more than one shader to highlight different Characters and Objects (Player/Enemy/POI) [Img1]
    upload_2021-8-12_10-40-3.png

    But i think because we mess around with the Depth of the Renderer everything begins to break if we overlapp highlighted Objects. [Img 2]
    upload_2021-8-12_10-42-51.png

    How can i realise that the "X-Ray" Objects still propperly sort on their Z Position while they are still rendered on Top of everything else. Is this even possible with only Shader Graph and URP? I read about Stencil Buffers may be able to help here(?), but i doubt i really understand how they Work. As i said I´m quite new to Shaders and Rendering and every bit of help would be much appreciated. Thanks in advance!