Search Unity

Unity 2019 VR upside down

Discussion in 'AR/VR (XR) Discussion' started by jjxtra, May 8, 2019.

  1. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Unity 2019 has a serious bug that renders full screen blits upside down in VR, all modes, standard pipeline. Have not tested LWRP or HDRP, they could also be impacted. Many assets are impacted. Unity, are you aware of the bug? I cannot submit bug report with Unity 2019, it crashes at 3% upload every time.

    The work-around for this bug is the following, put it in the vertex shader and adjust your output uv coordinate with it.

    Code (CSharp):
    1. // note: you must set _VREnabled to 1 in a script if XRDevice.isPresent is true, else set it to 0.
    2.  
    3. inline float2 AdjustVertexFullScreenUV(float2 uv)
    4. {
    5.     uv = UnityStereoTransformScreenSpaceTex(uv);
    6.  
    7. #if (UNITY_UV_STARTS_AT_TOP)
    8.  
    9. #if UNITY_VERSION >= 201900
    10.  
    11.     // HACK: Unity 2019 bug flips blit in VR, this is a regression. 2018 and earlier do not have the bug.
    12.     if (_MainTex_TexelSize.y < 0.0 || (_VREnabled && _MainTex_TexelSize.y > 0.0 && _ProjectionParams.x < 0.0))
    13.     {
    14.         uv.y = 1.0 - uv.y;
    15.     }
    16.  
    17. #else
    18.  
    19.     if (_MainTex_TexelSize.y < 0.0)
    20.     {
    21.         uv.y = 1.0 - uv.y;
    22.     }
    23.  
    24. #endif
    25.  
    26. #endif
    27.  
    28. }
     
  2. unity_fvH2-MMGIWTywA

    unity_fvH2-MMGIWTywA

    Joined:
    Dec 7, 2017
    Posts:
    3
    Unity please do something urgently. Every screen on all VR is inverted and mirrored.
     
  3. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    It is fascinating how this made it out of QA. I would have a bunch of automated tests with screen captures before submitting a non-beta release :)
     
    Nyarlathothep likes this.
  4. DaReign

    DaReign

    Joined:
    Apr 12, 2013
    Posts:
    79
    Now you know why unity is free..... We are all beta testers. Current version of unity 2019.1.0f2 have many bugs like all previous. I use unity occasionally and can't imagine how people could work in this every day and even pay for premium version :) :) :) but at start I got some weird error with multiplayer which I didn't used so I had uninstall package :). Next webGL building time take ages. If you use posprocessing in android then build time skyrocket. And finally I manged to finish app. Published it and then appear that error when in some phones VR is rendered upside down .....
     
  5. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    I noticed this issue in Unity 2018.3 only after I updated Xcode to the latest. Prior to the Xcode update it worked just fine...
     
  6. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Has anyone been able to upload a bug report?
     
  7. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    My first bug report attempt stalled with 10% remaining to upload. Trying again to send a smaller bug report. Basically after testing on two different macs I've found that in Xcode 12.0.1, Unity 2018 and IOS 12.0.1 still works normally. If ANY of those have been updated to (Unity 2019 or Xcode 12.2 or IOS 12.2) the camera tracks upside down.

    Edit. Stalled out at 50%. How do you submit a bug report of the bug reporter!? (*&^%$!)
     
    Last edited: May 22, 2019
  8. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    This was fixed silently in Unity 2019.1.3. Nothing in the patch notes. No response from Unity. Please own up to these bugs and put them in the patch notes. Now I am reverting the hacks I put in place for Weather Maker to work-around this. Would have been nice to see it in the patch notes so I can do it sooner rather than wait for customers to tell me it is now broken again because of my hack...
     
    ROBYER1 likes this.
  9. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    I still get inverted tracking on Android Pixel2 on 2019.1.3f1 But I found that setting Graphics API to OpenGLES3 instead of Vulkan fixed it! For android anyway... still need to check out IOS

    I saw a message that XR Support was not compatible with Vulkan so I figured I'd try it with cardboard...

    Finally was able to submit a bug report without a project attached. Instant success...
     
    Puebebe likes this.
  10. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Same thing with IOS... Building to Metal has in inverted image but OpenGLES3 builds fine. Unfortunately for me I need Metal for my ARKit features.... So @jjxtra maybe you can set up your code to behave differently based on the Graphics API till Unity or Google actually do sort this out.
     
    Last edited: May 24, 2019
  11. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Is there a way to check for one Graphics API or the other? As in flip the image in Metal vs leave it be in OpenGles3?

    Also here's Unity's response from my bug report:

    "Thank you for this information.
    We are aware that the issue only occurs with Metal and Vulcan.
    At this moment it is verified that the issue is fixed in the latest ALPHA version of Unity 2019.3.0a3.
    I can't guarantee that the fix is available to 2019.1 versions, but the backports are opened for the fix to be implemented to this version.
    I can't tell when it will be backported or will it be backported."
     
  12. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Yikes. Wouldn't it just be a switch on their end setting a uniform that says "flip the uv y coordinate if target hardware is this, this or this..."
     
  13. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    You would think it wouldn't be a difficult fix fur them.
     
  14. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
  15. P_Jong

    P_Jong

    Joined:
    Jun 14, 2017
    Posts:
    58
    It didn't fix the problem with the double reflections on the boat attack demo, or with a few water assets in the Unity asset store that say they are compatible in VR and LWRP, but they are not. I agree Unity needs to respond better, and add notes to things that do get fixed. First thing I do with every new release of Unity is read the patch notes. But glad they silently fixed this issue in 2019.1.3. But I never had any issue with things being flipped in VR with the Oculus Rift. My problem is with reflections, depth, and transparency in water in VR and single pass.
     
    ROBYER1 likes this.
  16. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Got an email from Unity QA...
    "I have just verified the fixes and it should be available in the next released Unity version."

    Not sure exactly which version(s) he's referring to... Hopefully 2018.4 as well as 2019.1...
     
    P_Jong likes this.
  17. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Fix is included in 2019.2.0f1. I requested it be ported back to 2018.4 but no confirmation if that will happen.
     
    Last edited: Aug 1, 2019
    ROBYER1 likes this.
  18. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I'll remove my hacks for Unity 2019.1
     
  19. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Did you find any water materials that do not exhibit this bug on single-pass mode VR on platforms like the Oculus Go/Quest?