Hi, this is driving me crazy. If you make an empty pbr graph and just connect the scene depth note to alpha, set the render mode to transparent, the shader only works in LWRP. It’s completly broken in HDRP. And it has been for several months. Is there really no way for me to use depth buffer in the shader graph?
I need this too.
What is the version of HDRP? What is the version of unity?
Scene depth works for me.
I had the same issues on several machines, several versions of unity and hdrp over the course of several month, checking each time if it’s fixed. Most recently, 2019.2.10 unity and 6.9.2 hdrp.
What versions work for you?
Ok, turns out it works only for Unlit in HDRP 7.1.2 for me. Did you open the case?
Broken for me also in the most recent version of HDRP. I will log a bug report when I get home later.
also broken for me, still.
Any chance that you guys use keywords in your shader graphs?
If so, then that’s the reason why.
Keywords are still super buggy and break many shader features like scene depth/color, transmission and depth-offset (for parallax mapping).
That’s definitely possible - I ended up getting it to work but I don’t know how unfortunately.
No keywords used in the shader. I reported the issue and it was confirmed that it’s broken.
I always thought it was a problem with the HDRP settings. I searched on the Internet for a whole day and still couldn’t find the answer. I didn’t know until I saw this now that HDRP settings can’t solve this problem.
Do we know if this is fixed now that HDRP is released?
Just tested it, no it doesn’t.
Hello,
I just tried to repro and it seems that it’s working as expected for me, here’s what i did:
- Create a new PBR shader graph
- Switch the graph to transparent
- Add a scene depth node in Eye space with a fraction and set the albedo to red like so:
- Then i created a material from this graph and assigned it to a quad in my scene:

As you can see, the alpha of the quad is affected with the depth of objects behind it.
Ineed you are right, it’s working in HDRP 7+. Not sure how I managed to not get it to work when i tested it 2 days ago.
Would you happen to know how to use that depth to make an intersection highlight effect with other meshes?
Yeah sure, the main idea is to compare the view space position of your object with the depth of the scene in eye space, but there is a catch: the actual z component of the position in view space is negative so to compare it to the scene depth you just have to add both values like this:

And it will result in something like this:

Thanks so much!
Very cool, glad to see it is working now.
Does this work on HDRP 7.3.1? I couldn’t get Antoinel’s example to function. Is there something specific in addition to the graph that needs to be configured in a special way in Pipeline Asset or such?
Also double check that the material you are using is not overriding the surface type you’ve set in the master node.

