Hi, I am having trouble with a simple _CameraDepthTexture sampling. In shadergraph it works perfectly fine using this setup:
In custom shader I do:
float4 scrPos : TEXCOORD01;
...
uniform sampler2D _CameraDepthTexture;
//Then in vertex
o.vertex = UnityObjectToClipPos(v.vertex);
o.scrPos = ComputeScreenPos(o.vertex);
//Then in frag
float2 screenUV = i.scrPos.xy / i.scrPos.w;
float depth = tex2D(_CameraDepthTexture, screenUV).r;
return depth;
And the result is:
And this is what I get if I add depth = Linear01Depth(depth):
What am I doing wrong?



