Search Issue Tracker
By Design
Votes
3
Found in [Package]
4.0.5
Issue ID
1338621
Regression
No
[XR SDK] Shadow is displayed inconsistently between right and left eye when Single Pass instancing rendering mode is used
Reproduction steps:
1. Open the attached project ("1338621R.zip")
2. Open the "ShadowBug" scene
3. Enter Play mode
Expected result: Shadow in both eyes are displayed aligned
Actual result: Shadow in the right eye isn't aligned (see "q88PM5ioac.mp4" video)
Reproducible with: XR SDK 4.0.5 (2019.4.27f1, 2020.3.10f1, 2021.1.9f1, 2021.2.0a18)
Not reproducible with: 2018.4.35f1 (XR SDK not available)
Tested:
- Oculus Rift S
- MockHMD
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [HDRP] Game view renders artifacts when Camera's Component "Post Anti-aliasing" is set to "TAA" and Dynamic Resolution's "Forced Screen Percentage" is changed
- A deactivated Prefab's name color becomes white when a GameObject in the scene is deactivated
- The Game view becomes blank when using Frame Debugger with MSAA and Texture binding enabled in Play Mode
- Crash on dynamixel_sdk.dynamixel:groupSyncReadTxRxPacket when entering Play Mode after updating path to Dynamixel SDK in script
- NullReferenceException is thrown when changing the Inspector preview selection
Resolution Note:
The fragment shader needs to have the following macro (at the beginning of the function) to be able to sample the right shadowmap slice for the second eye :
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
(Documentation: https://docs.unity3d.com/Manual/SinglePassInstancing.html)
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO tells the GPU which eye in the texture array it should render to, based on the value of unity_StereoEyeIndex. This macro also transfers the value of unity_StereoEyeIndex from the vertex shader so that it will be accessible in the fragment shader only if UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX is called in the fragment shader frag method.