Is it possible that Sprite Renderer in a HoloLens2 Unity Project, which are masked via a SpriteMask are only visible on one eye in the final HoloLens2 build (UWP via VisualStudio2019 deployed on HoloLens2 device). I also experienced the same behaviour on elements which are masked with a StencilShader. I am using a 24-bit depth buffer for my unity project if that helps, otherways the StencilShader wouldn´t work.
Asked
Active
Viewed 654 times
1 Answers
0
To display certain objects to one eye, for different rendering configurations, different ways need to be used.
With MultiPass, you should be able to set a camera to render to only one eye(Camera component -> Output-> Target Eye), so doing per eye stuff is super easy. With Stereo Instancing, you can draw in Shader but you will need to multiply the projection matrix of the current eye.

Hernando - MSFT
- 2,895
- 1
- 5
- 11
-
Yes, but my problem actually is, that those sprites are displayed on only one eye what I don´t like. Every sprite which is covered by stencil or mask operations is only displayed on the right eye display of the HoloLens. I was wondering whether the reason behind that actually is the Stencil buffer or the Sprite Mask. I need those stencils and masks but I also need to see the result on both eyes. – SilverLife Feb 16 '21 at 09:25
-
The question I wanted to ask is, how can I use stencil buffers in shaders and in the same time be able to see the result on both eyes. Sorry, maybe I asked my Question not really good. – SilverLife Feb 16 '21 at 09:37
-
Which Depth buffer format are you using? According to the MRTK Doc, stencil buffer only work with 24-bit depth format: https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/hologram-stabilization.html#depth-buffer-format Besides, for example, you can find the shader material examples in the MaterialGallery scene under MRTK/Examples/Demos/StandardShader/Scenes/. – Hernando - MSFT Feb 17 '21 at 09:23
-
Sorry for the late reply! I was not available for a while. I am using 24 bit depth format as mentioned in MRTK Doc and the reason for this problem really is the code about stencil buffering in the corresponding shader. If I remove the stencil-buffer code from the shader script I wrote, the Sprite is beeing displayed correctly. – SilverLife Mar 04 '21 at 10:27