Feedback Wanted: Shader Graph

Scene Depth node sounds like what you want.

https://bitinn.github.io/ScriptableRenderPipeline/ShaderGraph/Scene-Depth-Node/

OH wait, you did mention this node.

If it doesn’t work as expected, check if you can write a custom node to achieve it.

By the way this is the LWRP implementation of Screen Depth node.

If you want LOD then a custom node like Screen Depth isn’t that hard to write.

I was aware of the Scene Depth Node, in fact, in this thread has been discussed already how useless it is.
My question was specific about writing a custom node that uses the Depth Texture (which contains the full pyramid) and extracts the LOD0.

As written in the post, using _CameraDepthTexture, doesn’t work

I’m basically stuck and I need a way to reach the _CameraDepthTexture or to sample as texture the SHADERGRAPH_SAMPLE_SCENE_DEPTH.

Questions about this has been posted all over this and other threads so I need now a clean answer from Unity staff or someone who’s been thru this.

Getting antsy over this isn’t going to make this faster:

As I said, SHADERGRAPH_SAMPLE_SCENE_DEPTH is defined by each SRP, on LWRP it’s shadergraph_LWSampleSceneDepth. Which means I was posting the exact code of what Scene Depth node does.

It doesn’t offer you a way to not skip the “Linear01Depth” conversion, you can’t get the raw depth.

What could you do? Well, write a custom node that replace it with your own code.

It’s not a “quick” answer, but AFAIK this is the only way for now, for Shader Graph at least.

OR if you don’t mind some performance lost, convert it to LinearEyeDepth, see this post:

https://discussions.unity.com/t/687913 page-30#post-3798496

Giving untried solutions and not reading the question is not helpful.
I dind’t want to smap over this post again and you’re making me.


I’m making a custom node (as said) because (as pointed elsewhere) SceneDepth returns the Pyramid without the possibility of having the LOD0 (at least for my knowledge) as said.
The solution with Screen Hack is not acceptable (for me at least) because it’s broken when changing the screen size in an unpredictable way.

In my custom node I end up having:
undeclared identifier ‘_CameraDepthTexture’
or
undeclared identifier ‘SampleCameraDepth’

(Something to import, somehow, is missing?)

The only compiling thing is using SHADERGRAPH_SAMPLE_SCENE_DEPTH(UV) just like the well know Node again having the full pyramid of the depth texture and I don’t know how to extact the LOD0 from it.

At this point the answer I want is either:

How to use _CameraDepthTexture or SampleCameraDepth or anything valid in my custom node
How to extract LOD0 (with LOAD_TEXTURE2D_LOD maybe?) FROM SceneDepth or SHADERGRAPH_SAMPLE_SCENE_DEPTH or anything valid

If none of the above is possible I’ll wait for a fix from Unity.

This is the kind of answers I like:

For quick link:
https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/release/2018.3/com.unity.render-pipelines.high-definition/CHANGELOG.md

OK you are using HDRP, I apologize as my focus is on LWRP, and AFAIK HDRP has been broken for a while on various front, and if you are using Unity 2018.x instead of 2019.x alpha, then even more so as they need to back port fixes from 5.x to 4.x

But it would be great for everyone to:

  • List your SRP and package version (same node can perform different things based on them).
  • Show the relevant code.
  • And perhaps some screenshot etc.

Unity team post here maybe once a week and so if you don’t have everything ready they might just ignore or ask you for more info.

Anyway, glad to see a fix is coming.

1 Like

Totally agree, probably the solution has been on it’s way for weeks and I struggled to find a workaround pointlessly jumping from one thread to another and spending hours of coding.

This would be most helpful!

Can anybody help me?
I try to add Custom data from particle system to the vertex displacement (vertex position), and I can’t understand why shader doesn’t work…

If I add info from Custom data to the Color shader works correctly


4094833--357799--shadergraph_customdata_color.gif

If I add info from Vector1(value from Property) to the Position shader works correctly


4094833--357805--shadergraph_nocustomdata_value.gif

And if I add info from particles Custom data to the Position shader doesn’t work

Tell me where did I make a mistake?

Hey, just wondering, has issue case 1108669 been worked on by Shader Graph team? I reported 1 month ago with repro sample and in this thread, but has received no triage from QA team so far.

I honestly don’t know if it’s fixed in 5.x or whether it will be backported to 4.x

Hey, do you confirm 4.7.0 is out?

Hey, it’s party time!!!

Just updated and getting the Kernel ‘KSampleCopy4_1_x_8’ not found error continuolsy.
Problem has been discussed here Feedback Wanted: Scriptable Render Pipelines page-20 but I don’t find the package they mention.


Remove the High Definition RP package and reinstall. Apprently the update doens’t work

I assume 4.7.0 are not released on PM yet?

Quick note: don’t use GitHub release that wasn’t released officially on Package Manager unless you know the package like the back of your hand.

Reason: there are times they haven’t past the QA test, meaning, only consider the Package Manager version to be final.

1 Like

Ok here’s a weird one in 4.6.0, I think ShaderGraph breaks when switching to the new C# runtime. I get a lot of strange errors like “_Color already defined” when trying to compile with shader graph. These disappear when I go back to the old C# runtime and reimport my shaders. I can provide more details if this can’t be reproduced by simply compiling unlit shaders with the new runtime.

SamplerState in Custom Node still not working, even though it was reported on fogbugz half a year ago (deleted my bookmark, because nobody was reacting to it). Still the same error. Are we missing something?

Unity 2018.3.1f1 HDRP 4.6.0 ShaderGraph 4.6.0

I believe so. Issue was that the preview on the Master Node was being rendered on top of the Preview for the Shader Graph. The Master Node preview was removed

Most likely fixed in 5.x

Only fixing this in 5.x does not help me and many others though: I am using 4.x and Unity 2018 for the foreseeable future. If no backport is happening please let us know.

No I got it because I enabled the experimental versions.
Scene Depth is fixed at least and it’s a key feature when you’re story is center around a beach and it’s not a mobile game. :slight_smile: