microsoft / microsoft/MixedReality-GraphicsTools-Unity

UV flips up and down on HoloLens2 real device in magnifier function.

Open
#147 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue
Dominant language
C#
Stars
209
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

While playing with the new feature while working on other MRGT issues, I encountered a problem with the screen of the magnifier function flipping upside down on the actual HoloLens2 device.

https://youtu.be/C5aYusFA_tM

I was able to get it working on the actual device by inverting the Y component of the UV in Graphics Tools/Magnifier.

            half4 frag(v2f i) : SV_Target
            {               
                float2 normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(i.vertex);

                float2 normalizedScreenSpaceUVStereo = UnityStereoTransformScreenSpaceTex(normalizedScreenSpaceUV);              

                normalizedScreenSpaceUVStereo.y *=-1; //Add!!
                float2 zoomedUv = zoomIn(normalizedScreenSpaceUVStereo, MagnifierMagnification, Center);
               
                float4 output = SAMPLE_TEXTURE2D_X(MagnifierTexture, samplerMagnifierTexture, zoomedUv);
                                
                return output;
            }

https://youtu.be/-tDxe4X7AnQ

 I have previously encountered the same UV upside down phenomenon when using CameraOpaqueTexture in a URP environment to create my own lightweight Bloom post effect.
 This only occurred on the actual HoloLens device, not on the Editor, and seems to be the same as this time.

 Maybe there is something going on with the HoloLens rendering or deploying from Untiy, but I don't understand it and am very curious.

To reproduce

I deployed to HoloLens2 in Unity2021.3.5f1 with MRTKv2.8.2 using OpenXR platform.

Expected behavior

It needs to be rendered correctly in HoloLens as well as VR without tampering with the code itself.

Screenshots

Please refer to the above Youtube video.

Your setup (please complete the following information)

Unity Version 2021.3.5f1 (URP)
Graphics Tools Version 0.5.0(Introduced from MixedRealityFeatureTools)

Target platform (please complete the following information)

Only HoloLens 2

Additional context

I would like to understand the cause of the problem as I am curious about the causes in this area.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the magnifier shader under Graphics Tools/Magnifier and reproduce the UV orientation issue on a HoloLens 2 using Unity 2021.3.5f1, URP, MRTK v2.8.2, and OpenXR. Compare the device output with the Editor and the reported Y-inverted UV behavior; done means the magnifier renders correctly on HoloLens 2 and VR without manual code changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
unity
Domain
ar-vr-xr, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.