Hello,
In Built in render pipeline, this fragment shader:
float d = tex2Dproj(_CameraDepthTexture, i.projPos) //i.projPos is calculated via ComputeScreenPos(o.pos) in the vertex shader
return float4(d.rrr/nearPlaneDiv,1);
shows a correct depth texture, with [white/black] values on [near/far] planes, but only if there is a C# script with:
camera.depthTextureMode = DepthTextureMode.Depth;
I have two questions:
- Why the same shader code in URP doesn’t work? (everything is black, no matter what value I use for nearPlaneDiv
- is _CameraDepthTexture built-in shader variable is filled even if I don’t use camera.depthTextureMode?