Search Unity

Question How to mask character based on 2d background depth texture using shader graph in URP?

Discussion in 'Shader Graph' started by Krabicz, Mar 6, 2021.

  1. Krabicz

    Krabicz

    Joined:
    Oct 5, 2016
    Posts:
    8
    There is few things I want to work here but let's focus on main issue:
    I have some not accurate depth shader for character model based on position in the world and texture I made in blender (just rendering depth). I want to display only part of model where model depth is darker then environment/backogrund depth. I don't know exactly how to approach this issue.

    Scene with axies, camera is ortographic.
    depthTest-01-scene.png

    Character depth shader: depthTest-01-shader.png

    How the character is currently displayed (it's wrong. I want only torso and head to be visible): depthTest-01.png