Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content masking using unity ui scroll view not working with 16 bit depth submission mode #11709

Closed
h421qqq opened this issue Jul 17, 2023 · 1 comment

Comments

@h421qqq
Copy link

h421qqq commented Jul 17, 2023

This issue has been migrated a new MRTK repository, and the status of this issue will now be tracked at the following location:


Describe the bug

I have text in a scroll view that is masked so the user can scroll to read. In unity play mode, it works as expected. when deployed on my hololens 2 with Depth Submission Mode set to 16 bit, the text does not appear masked and can be seen overflowing. when deployed with depth of 24 bit it works as expected. (correct me if this is the proper way to deploy but i get the "depth should be set to 16 bit" in the project validation thing)

Steps to reproduce the behavior:

  1. Make a scene with the Unity UI scroll view.
  2. Add text to the scroll viewthat overflows the view port.
  3. Deploy to Hololens 2 with 16 bit depth submission mode and see overflowing text.

Expected behavior

Proper content masking with 16 bit depth submission mode.

Screenshots

When trying to screenshot, the scroll view looks fine. However in person, on the hololens2, the text is overflowing

Your setup

  • Unity Version 2022.3.1f1
  • MRTK3 commit e807733

Target platform

  • HoloLens 2
@h421qqq h421qqq added the Bug label Jul 17, 2023
@github-actions github-actions bot added the MRTK3 label Jul 17, 2023
@AMollis
Copy link
Member

AMollis commented Jul 17, 2023

@h421qqq , if you are using standard UGUI elements, you'll have to use 24 bit depth for the clipping to work. The UGUI materials rely on the stencil buffer to clip UGUI elements. The stencil buffer is only available when the depth submission mode is set to 24-bit. To properly render UGUI using the Unity Scroller, please make sure to configure Depth Submission Mode to be 24-bit, under Project Settings > XR Plug-In Management > OpenXR. 

If you only need to clip objects in 2D, you can use this built-in UGUI component: RectMask2D | Unity UI | 1.0.0 (unity3d.com) - it doesn't use the stencil buffer akin to how the VirtualizedScrollRectList sample scene works with Graphics Tools components.

I recommend taking a look at our VirtualizedScrollRectList scene, for a sample of how-to setup a scroller with MRTK UI elements (using MRTK Graphic Tool materials) that works with 16 bit depth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants