Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UI Mask Failing on HoloLens, Works on Preview Fine

Discussion in 'VR' started by botgreet, Aug 9, 2016.

  1. botgreet

    botgreet

    Joined:
    Dec 26, 2015
    Posts:
    6
    Hi,

    Looks like others have seen this same issue, where the UI Mask looks great in preview but fails on the HoloLens and already filed a bug report, but wanted to see if there was any known work arounds or updates on any fixes or adjustments for the HoloLens in Unity:
    https://forums.hololens.com/discussion/1167/ui-mask-not-working-on-hololens

    e.g. Using the CurvedUI Asset from the Asset store, in preview I see this:



    On the HoloLens I see this:



    If I uncheck Mask on the Items, I see what I see on the HoloLens with images overflows....

    Thanks!
     
  2. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Hello,

    As of right now I'm not aware of any work around for the issue.

    Thank you,
    Wesley
     
  3. shouchard

    shouchard

    Unity Technologies

    Joined:
    Mar 29, 2016
    Posts:
    10
    We'll escalate this internally. Thanks for the report!
     
  4. BrandonFogerty

    BrandonFogerty

    Joined:
    Jan 29, 2016
    Posts:
    83
    This should be working in the latest 5.4 build.

    In the following video, I created a UI Mask and it rendered correctly on the HoloLens.
     
  5. Unreal_Ed

    Unreal_Ed

    Joined:
    Mar 12, 2015
    Posts:
    2
    I am seeing this issue in Unity 5.4.0f3 even in the editor. I've set up my images identically to the ones in your video and the mask does not apply.

    In the attached screenshot, the "ReadMoreButton" has a mask and an image component with a sprite. I made the sprite dark yellow to show it on the screenshot. The gray overlay over the oval and text is the FillGazeSprite object in the hierarchy. It gets its width set from 0 to 1 through code. It should only show through everything that's in yellow here but it doesn't (and in the editor too, as you can see). That's with and without "Show Mask Graphic" toggled btw, and a World Space canvas.

    The mask IS working, it's just not using the image. If i resize the parent object everything gets masked by the rect transform bounds, as if i didn't have an image inserted.

    What should i do?

    NonWorkingMask.jpg
     
  6. botgreet

    botgreet

    Joined:
    Dec 26, 2015
    Posts:
    6
    Hello Brandon, on version 5.4.0f3-HTP, when I try to match your set-up and settings with quick 2 pngs I created with transparency, I can indeed get it to mask on the HoloLens like it does in Game mode, but that's when I take out "VR Supported" and "Windows Holographic" from the Player settings and it's rendering in 2D UWP mode... I didn't see the 2D Title bar in your video...so are you saying this is working for you in 5.4.0f3-HTP with VR Supported? Or did your experiment have VR-Supported checked?





    My test code linked....https://mandalbot-my.sharepoint.com...docid=0ab18d8068b9f4e3f834c6eeb5b4bf896&rev=1
     
  7. botgreet

    botgreet

    Joined:
    Dec 26, 2015
    Posts:
    6
    Okay, so, I did the following, and was able to get the mask to work.

    1) i switched my Sprites to TrueCOlor images. (still no mask after retry)

    2) I turned off 16-bit depth buffer ( still no mask after retry, think was a recommended settings for HL)

    3) When I checked the following highlighted setting "GPU Skinning", I finally could see the mask on the HoloLens with 5.4.0f3-HTP. So I think the mask is inoperable in the current version without this setting enabled. (not sure about whether 1 or 2 are required, but when I try to fix my app, probably be able to tell.)



    4) Also I seem to need to change the colorspace to Gamma from Linear to get this to show correctly on the HL.
     
    Last edited: Aug 27, 2016
  8. fafase

    fafase

    Joined:
    Jul 3, 2012
    Posts:
    161
    I managed to get the mask working without any tweak, just plain basic mask setting.

    I did see it failing back in July 2016 but the latest update most likely fixed it.
     
  9. dimitroff

    dimitroff

    Joined:
    Apr 3, 2013
    Posts:
    131
    Unity 5.5 here.. and the Mask still does not work on the Simulator, works fine in the Editor? Any ideas?

    Update: The only solution for me was turning 16bit buffering off
     
    Last edited: Dec 13, 2016
    Hodgson_SDAS likes this.
  10. cgmagic

    cgmagic

    Joined:
    Oct 5, 2013
    Posts:
    12
    Having the same problem here, just reported it. but where did you find the 16bit buffering option in Unity 5.5 ? Cheers
     
  11. dimitroff

    dimitroff

    Joined:
    Apr 3, 2013
    Posts:
    131
    Sadly, no where.. I still had to use the 5.4 version
     
  12. zulu_mashabella

    zulu_mashabella

    Joined:
    Apr 11, 2013
    Posts:
    16
    In Unity 5.5 you can switch inspector to debug mode and find "Ui use 16 bit depth buffer" property, then turn it off.
    When i migrate from Unity 5.4 to unity 5.5, unity5.5 take this property from unity5.4 and hide it from inspector's normal mode.
     
  13. kurtscheuringer

    kurtscheuringer

    Joined:
    Jan 5, 2017
    Posts:
    1
    Not to revive this old thread but UI masks are still not working in the HoloLens and I am using 2017.4.13f1. Seems to do with using Stencil buffers in general not working on the HoloLens.

    Using Rect2DMask is the work-around solution when dealing with Canvas / Unity UI components.
     
  14. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,964
    These are still broken in 2018.4.0f1 - how is it that this has been ignored since 2016? I can see it was supposed to be fixed in unity 5 but we are on LTS 2018 and still no fix!?
     
  15. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    It's the Unity I-wonder-if-we-can-just-ignore-this-and-pretend-it-was-only-meant-to-be-used-for-pause-menus-until-runtime-UIElements-is-available-UI. On Hololens. Consider this thread a manhole to shout into.
     
    MadeFromPolygons and manugulus like this.
  16. GregBahmPersonal

    GregBahmPersonal

    Joined:
    Sep 19, 2017
    Posts:
    2
    In case any frustrated hololens developers come across this thread like I did, here's the solution:

    "Player>XR Settings> Virtual Reality SDKs> Windows Mixed Reality> Depth Format" must = 24-bit depth.
    "Enable Depth Buffer Sharing" must be checked.


    Works in Unity 2018.4.7f1, tested on a Hololens 2.

    Worked with Linear and Gamma color space, and without "GPU Skinning checked." It also worked in both "Single Pass" and "Single Pass Instanced" Stereo rendering modes.
     
  17. cellarmation

    cellarmation

    Joined:
    Jan 17, 2015
    Posts:
    30
    Thanks to everyone in this thread keeping the information up to date as this is still a current issue that people are walking into (as I just have).

    I can confirm this is still an issue on Unity 2018.4.18f1 targeting a HoloLens1. I only started getting this issue as the MRTK framework prompted me to change Depth Format from 24-bit down to 16-bit for performance reasons, didn't spot it caused this issue for a while though. Putting it back to 24-bit made this issue go away.
     
  18. pepipe

    pepipe

    Joined:
    Jun 2, 2014
    Posts:
    10
    Necroposting again this topic since it seems people keep having this problem, myself included. Part of the problem is because MRTK framework advises changing to 16-bit depth because of performance, the documentation even mentions that 16-bit depth disables stencil buffer, and looking at the difference between Mask and RectMask2D we see why the Stencil buffer is important. Mask needs it so it will not work with a depth set to 16 bit.

    So we have two possible solutions: use Mask and set the depth to 24 bit or use RectMask2D and keep the 16-bit depth. I'm guessing most uses for the mask in Hololens will be in UI so probably the RectMask2D is the more correct solution.
     
    zhare86 likes this.