googlevr / gvr-unity-sdk

Google VR SDK for Unity
http://developers.google.com/vr/unity/
Other
2.71k stars 1.1k forks source link

Mirrored display on Unity 2019 & iOS #1031

Open M-Kersten opened 5 years ago

M-Kersten commented 5 years ago

IMG_DBC131DD29E3-1

SPECIFIC ISSUE ENCOUNTERED

The GVR camera transform rotation is inverted on Unity 2019. Only happens on iOS builds. Both with single and multi pass. Locking orientation doesn't make a difference either.

HARDWARE/SOFTWARE VERSIONS

STEPS TO REPRODUCE THE ISSUE

  1. Create a new unity project.
  2. Set target platform to iOS.
  3. Enable VR in build settings to import GVR package and add "cardboard" to devices.
  4. Set orientation locked to landscape left
  5. Build to iOS device and rotate it

ADDITIONAL COMMENTS

Other fixes i have tried (but don't work) include:

M-Kersten commented 5 years ago

Installed GVRSDK pod is 1.170

M-Kersten commented 5 years ago

So i tried downgrading the GVR iOS package from 1.18.5 down to 1.17 to match the podfile without improvement.

futurnaingenieur commented 5 years ago

Same issue here, build for Android:

GoogleVRUnityIssue

niharsail commented 5 years ago

Same thing happening with me.

Rickleung commented 5 years ago

Still no solution from unity?

christougher commented 5 years ago

Same Problems here for IOS. It seems IOS 12.2 and or Unity 2019 have this problem. IOS 12.2 seems to do this even with Unity 2018. Also same problems with Pixel 2 running Android 9.0

christougher commented 5 years ago

Seems to work fine under Graphics API OpenGLES3 but not Vulkan or Metal APIs...

yazansorour commented 5 years ago

downgrade unity to 2018.3.14f1 will works

mariovski commented 5 years ago

Go to player settings and remove Vulcan Api and stay with openGLES3. It works fine now on 2019.1.2f1 and Android Huawai p20 lite and others. https://computergraphics.stackexchange.com/questions/8185/what-are-metal-and-vulcan

binarynate commented 5 years ago

+1 for this issue. I'm unable to upgrade to Unity 2019.1 because enabling the Cardboard viewer in XR Settings causes the view to be upside-down on iOS. The issue is also described in this Unity forum thread.

M-Kersten commented 5 years ago

Temporary fix So we haven't heard back from Unity yet and needed to ship our game, my collegae came up with this script, attach it to your camera and it should render correctly on iOS.

FlipScreen.txt

christougher commented 5 years ago

Thanks so much for sharing this! Not seeming to fix it for me... Do we need to assign a material? I added it to the Main Camera in the HelloVR example scene but no change. Any other steps to follow? Thx again!

M-Kersten commented 5 years ago

Forgot to share this too, add a material with this shader to the script and it should work FlipShader.zip

christougher commented 5 years ago

Works great! Thx again.

christougher commented 5 years ago

Actually It appears that the left and right eye have about a 90 degree angle difference...

eqrxjz commented 5 years ago

I added to my project, works mostly fine, like @christougher mention, it has a disparity between cameras, maybe i can adjust that disparity in the script bottom section. i'll working on it, but by now it is the only workaround i found. Thanks! @spazzout

juscelinotanaka commented 5 years ago

I'm having the same problem. I am using the OpenGLES3 option for now. I can also add that when using Metal it keeps drawing a ScreenSpaceOverlay canvas over the inverted image while when using OpenGLES3 it doesn't show it (I know I shouldn't use it and/or expect it to work, I just made it for testing).

Before enabling VR: IMG_7643

After enabling VR - notice that it now has a slight alpha transparency/color multiplier on the button: IMG_7642

paulgnz commented 4 years ago

The Temporary fix above doesn't work with Metal. OpenGLES3 works however the performance is terrible.

Any suggestions?

christougher commented 4 years ago

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...

alcristog commented 4 years ago

Go to player settings and remove Vulcan Api and stay with openGLES3. It works fine now on 2019.1.2f1 and Android Huawai p20 lite and others. https://computergraphics.stackexchange.com/questions/8185/what-are-metal-and-vulcan

This worked for me!

iamtheonly commented 4 years ago

I'm using ARKit and Google Cardboard in my project. ARKit requires Metal, so I can't remove it and use GLES3 :(

I can confirm this does work in Unity 2019.3a, but then my project does not upload to App Store because of some Unity problems - "disallowed Frameworks", so I have to stick to 2019.1

Is this such a big issue that the fix can't be back ported to 2019.1 ? :/

xinaesthete commented 4 years ago

@iamtheonly have you tried the workaround scripts posted above?

iamtheonly commented 4 years ago

@xinaesthete yeah I did, and as someone posted it produces a huge disparity between the eyes. I haven't looked into the code too, maybe I can fix it myself.

I'm using cardboard for a 360 panorama viewer so I figured that simply flipping the texture upside down in the unity's panoramic shader will do (and it somewhat does - it displays correct!), but then when I build the app to the phone, the camera movement on X axis is inverted, so when I tilt the device down, the camera points upwards and vice versa.

alcristog commented 4 years ago

I got rid of any complication using the 2017 version for all my VR projects. This SDK seems not to work properly on 2019 versions...

xinaesthete commented 4 years ago

@iamtheonly ah ok. I haven't actually tried the workarounds I mentioned yet. I do see similar things with the transforms going the wrong, flipping a texture upside-down definitely not going to fix it (actually the app I tried it with is sufficiently abstract that you can only tell it's wrong because the movement is wrong).

FWIW it seems fine with 2018 @alcristog.

pauluhn commented 4 years ago

2019.1.10f1 doesn't seem to work with the flip hack. the left/right aren't aligned correctly.

christougher commented 4 years ago

I can confirm the fix is included in 2019.2. Building fine on iOS.

angamesahmed commented 4 years ago

if any one still facing this, i have done simple solution

using UnityEngine;
 [RequireComponent(typeof(Camera))]
 //[ExecuteInEditMode]
 public class MirrorFlipCamera : MonoBehaviour {
     new Camera camera;

    Transform origin;
    public bool invertCull;
     void Awake () {
         camera = GetComponent<Camera>();
        origin = transform.parent;
     }

    Vector3 correctedRotation = Vector3.zero;
    void LateUpdate()
    {
        //correctedRotation = origin.localEulerAngles;
        correctedRotation.y = camera.transform.localEulerAngles.y * -2f;
        origin.localEulerAngles = correctedRotation;
    }
 }
andylikh commented 4 years ago

I can confirm the fix is included in 2019.2. Building fine on iOS.

Ditto