Search Unity

Display 2D Sprite behind objects sorted by z-Axis

Discussion in 'Shaders' started by GazingUp, Jan 19, 2021.

  1. GazingUp

    GazingUp

    Joined:
    Jun 16, 2015
    Posts:
    271
    I've been looking all over for shaders / shader graphs that can do anything with displaying the player behind walls/objects sorted by z-axis. It's an RPG game 3/4 perspective.

    Is there any way to do this? All the sources I've seen either simply don't work in URP or are just 3D. I don't see any 2D tutorials on shaders. Are shaders not the way and maybe I'm missing something simple here? How will I display my player behind an object by z-Axis? The only one shader that kind of works is the URP Lit shader. I'm not sure how to change the color of the transparent color when player's behind the wall though.



    This is what I want for top down perspective (3/4 angle), the dither node simply does not work in URP. I had followed this page here https://cyangamedev.wordpress.com/2020/02/24/sprite-stencil-overlay-breakdown/
    Thanks for any help.
     
  2. GazingUp

    GazingUp

    Joined:
    Jun 16, 2015
    Posts:
    271
    The solution was a lot easier than I'd thought.
    The PBR graph saved the day! While it isn't a fancy see through effect, I achieved my goal of being able to see the player behind things sorted by Y and Z axis. Unity really is amazing.