Search Issue Tracker

By Design

Votes

0

Found in

2019.4

2020.3

2020.3.19f1

2021.2

2022.1

Issue ID

1369884

Regression

No

[Quest] Sampling depth texture from surface shader is incorrect in VR with Multi-View

Shader System

-

Reproduction steps:
1. Open project "DepthBugSurfaceShader.zip"
2. Open "Scene.unity" found in Assets/BugRepro
3. Build the project and run on Oculus Quest

Expected result: The blue cube looks the same as in Editor
Actual result: The blue cube is misaligned with the red cube and has an incorrect depth position

Reproducible with: 1.11.0 (2019.4.33f1, 2020.3.24f1, 2021.2.1f1, 2022.1.0b1)

Tested with:
Oculus (Quest 2), Android 10, CPU: Snapdragon XR2, GPU: Adreno (TM) 650

Notes:
The bug is not reproducible when rendering mode is set to Multi-Pass
Built-in renderer

  1. Resolution Note:

    Multiview mode for XR rendering requires a different approach for reading screen-space textures (including depth maps). Specifically, multiview mode renders to a texture array, often with different projections. As such, the application needs to render (or copy) the depth into a texture array (declared as a UNITY_DECLARE_SCREENSPACE_TEXTURE in the shader), and sample that using UNITY_SAMPLE_SCREENSPACE_TEXTURE. Those shader macros are XR aware and will resolve to the approprate declaration and sampler for either monoscopic or stereo rendering.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.