Hi, I’m using the depth texture in Shader Graph in URP for water FX. The depth texture on Android seems a lot less precise than on PC or iOS. Have I done something wrong or is there a setting somewhere I’m not aware of?
I have made sure the shader precision settings are set to Float.
For mobile devices depth should always be sampled using a float sampler, for improved accuracy, which is what this fix does. Perhaps this wasn’t implemented in Shader Graph yet. If not, my guess is it will be in URP 7.4.x
@jimmikaelkael For custom shaders, you can add #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" then use SampleSceneDepth(float 2uv)
to sample the depth texture, instead of declaring the depth texture yourself.
The problem is that DeclareDepthTexture didn’t have _FLOAT in the depth texture declaration. That’s what my PR is fixing and solves the depth precision issue.
Thanks. I manually changed the _FLOAT declaration and the issue on Quest seems to persists? Can you confirm if the issue is also fixed on Android VR platform (specifically Quest)?
Oh that’s interesting. You might be dealing with a separate issue than what I was addressing.
Can you file a bug so the XR team can take a look and fix?
Thanks very much for your reply, but where do I do that please? I am not defining the depth texture in code… Unity is doing it automatically.
I just have a small script that tells Camera.main. (or whatever camera) to enable rendering of Depth information.
e.g.