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:
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.
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.
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.
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…
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
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
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?
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
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.