MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

UI Mask in Scroll View not working with 16-bit depth format

Open pampas93 opened this issue 7 years ago • 5 comments

Describe the bug

After following the recommended settings for Unity, and changing the Depth format to 16-bit shows irregularities while using the scroll view. Items seem to overflow beyond the viewport. But after changing to 24-bit, it works fine. Reproducible only on HL2 device (not on the editor)

To reproduce

Steps to reproduce the behavior:

  1. Open the HandInteractionUnityUIExample scene
  2. Open XR settings in Player settings, set Depth format to 16-bit depth
  3. Have Enable Depth Buffer Sharing. Stereo Rendering mode can be Single-pass instancing or multi-pass. Shouldn't matter (I think)
  4. Build for HL2 and see the scroll view overflow.

Expected behavior

With the recommended settings, scroll view shouldn't overflow (UI Mask working fine)

Your Setup (please complete the following information)

  • Unity Version [e.g. 2018.4.5f1]
  • MRTK Version [e.g. v2.1]

Target Platform (please complete the following information)

  • HoloLens 2

pampas93 avatar Aug 26 '19 23:08 pampas93

Occurs on Hololens 1 aswell

jganser avatar Sep 06 '19 15:09 jganser

@pampas93 use Rect 2D Mask component instead of Mask

arunrajselvaraj avatar Sep 12 '19 05:09 arunrajselvaraj

AFAICT this has been an issue in UnityUI since 2016:

https://forum.unity.com/threads/ui-mask-failing-on-hololens-works-on-preview-fine.424998/ https://forums.hololens.com/discussion/1167/ui-mask-not-working-on-hololens

Though also AFAICT it seems like general stencil buffer support doesn't seem to be working as expected, which is what the Mask component uses to accomplish the culling effect:

https://forum.unity.com/threads/stencil-buffer-not-working.439158/

At this point it might just be worth Rect 2D Mask given the amount of time the underlying thing has been broken.

wiwei avatar Sep 17 '19 16:09 wiwei

Alrighty, thanks to the sluething that @Troy-Ferrell did, it looks like the fact that stencil buffers don't work on 16 bit is by design:

https://docs.unity3d.com/ScriptReference/RenderTexture-depth.html

Maybe we should downgrade/caveat our recommendations here to warn against these sorts of things... I think there are other things in the MRTK that also depend on stencil buffers being usable.

wiwei avatar Sep 17 '19 18:09 wiwei

Closing as dupe of 5970

Troy-Ferrell avatar Sep 26 '19 23:09 Troy-Ferrell