googlevr / gvr-android-sdk

Google VR SDK for Android
http://developers.google.com/vr/android/
Other
3.28k stars 1.28k forks source link

GvrView is rotated 90 clockwise on Google VR Services 1.13 #536

Closed SPGB closed 6 years ago

SPGB commented 6 years ago

Using Google VR Services 1.12 the world displays correctly, however once I update a phone to 1.13 (tested on Pixel 1, Pixel 2, and an S8) the world shifts into what looks like portrait mode and Looking vertically around the world will move horizontally (and vice versa).

I'm calling headTransform.getEulerAngles(orientation, 0); to get the head transform and rotated the world based on that.

sigmaxipi commented 6 years ago

Is this only happening with your app or do you see it with the samples like TreasureHunt & Video360? You shouldn't need to use getEulerAngles when rendering. eye.getEyeView() should give you the view you want. headTransform isn't normally used for rendering. It's meant to adjust aspects of the VR scene that depend on the user's head pose such as audio or gaze tracking.

Can you record a video of your phone while you're having this problem and share it?

SkyeOfBreeze commented 6 years ago

As I believe I am having the same issue, I will post this here, but this could be a different issue.

I am having this issue only for Non-stereo mode on devices that support daydream headsets. Cardboard only devices are fine, with or without google vr services. VR Mode works correctly on all devices.

I have tested this on Pixel, Moto Z, Asus Zenfone AR, Galaxy S8, Pixel XL 2, and all have this issue. I am also using same code, but rotations work just fine on devices that do not support daydream. Setting headset to cardboard device does not change this, but disabling GoogleVr services fixes it. using eye.getEyeView() does not seem to change the issue.

Testing on Nexus 6P, Galaxy S7, LG G3 shows correct rotation. Also Disabled google vr services and noticed that rotation worked normally again on devices that support daydream.

The next two charts are converted to degrees and the device barely moved during running the app

headTransform.getEulerAngles(orientation, 0) produces:

GoogleVR Version pitch yaw roll
Disabled -32.36363219 -0.08164681402 -89.84365264
Up To Date -32.3754211 0.1750127252 0.1752110408

and eye.getEyeView() still is sideways and produces:

GoogleVR Version pitch yaw roll
Disabled 0.1126451873 57.29562925 -0.06896442005
Up To Date 57.29498721 -0.2629954468 0.1474197081

Orientation is locked to landscape in the manifest.

All samples appear to work correctly on devices.

updating from com.google.vr:sdk-base: 1.101.0 to 1.120.0 has no change.

I am using StereoRenderer for mono playback as well, so that may be the issue, but not sure yet. Is there a preferred solution I should be using to not see this for daydream and still keep non-daydream devices functioning the same?

If you need more info, let me know. I am unable to link to the code, but may be able to try to create a demo project that is close

SPGB commented 6 years ago

@btelman96 that seems to be what I am experiencing as well. I believe something in Google VR Services 1.13 is the culprit as I am only seeing the issue after upgrading.

I've been using headTransform to track head position for awhile now, so I am not sure why it would suddenly rotate 90 degrees. @sigmaxipi I could record a video but I'm not sure how helpful it would be, it just looks like normal video playback but rotated.

shauntc commented 6 years ago

I'm experiencing the same issue as far as I can tell.

Our app bundles both Cardboard and Daydream versions (open in Daydream and get the 3d/Daydream interface, open via app drawer get 2d interface + Cardboard). The strait daydream version works as intended and has the correct head orientation on all devices I've tested. The 2d/Cardboard (which renders from almost the same code path as the 3d/daydream experience) on Daydream ready devices (tested on the Pixel XL and Pixel 2 XL) gets incorrect head orientation (like above) but on non-daydream devices gets the correct head orientation (tested device had Google VR Services 1.13 exactly the same as the Pixel 2 XL tested).

Uninstalling Google VR Services updates fixes this issue on the device I tested it on (Pixel 2 XL).

We use the Google VR C++ wrapper api to get the head orientation and a custom 3d engine for rendering Our path to get orientation used in rendering:

gvr_mat4f head_space = m_pGvrApi->GetHeadSpaceFromStartSpaceTransform(m_targetTime);
gvr_mat4f head_neck = m_pGvrApi->ApplyNeckModel(head_space, 1.0f);
gvr_mat4f leftEye = MatrixMul(m_pGvrApi->GetEyeFromHeadMatrix(GVR_LEFT_EYE), head_neck);
gvr_mat4f rightEye = MatrixMul(m_pGvrApi->GetEyeFromHeadMatrix(GVR_RIGHT_EYE), head_neck);
jdduke commented 6 years ago

Thanks all for the reports, we'll look into this and report back tomorrow. The mono mode of GvrView isn't quite as thoroughly tested as stereo ("VR") mode, so this probably slipped through the cracks during testing of the 1.13 release.

If any of you have a link to an existing app in the Play Store (or just a sample app) that is broken with the 1.13 Google VR Services build, feel free to send the link to me directly as that will help speed the investigation.

shauntc commented 6 years ago

@jdduke We're getting this inside a GvrLayout rendering stereo Here's an internal release of one of our apps: https://drive.google.com/file/d/1Nu_PtfA49Iy4jo-IRjctxeO9STuAEnFW/view?usp=sharing Just tap through the menus till it brings up a mono view (which is just controlled by touch), in the bottom right there is a button to switch to Stereo view, which is where you will see the problem. You can also open the same app in Daydream mode through the daydream app and see that it works correctly there I'll have my eye on this tomorrow so if you need any other details, let me know

jdduke commented 6 years ago

Thanks @shauntc, that's quite helpful as we weren't seeing this with our non-stereo builds of the GvrView-based TreasureHunt sample. Stay tuned for an update.

jdduke commented 6 years ago

Those of you hitting this issue, could you please check to make sure that, when your Activity is resumed and/or your content is active, you're either calling GvrView.onResume (for the SDK) or GvrLayout.onResume (for the NDK)?

SkyeOfBreeze commented 6 years ago

Upon initial testing, adding the GvrView.onResume seems to fix it for me. I will report back on Monday after testing on more devices. Works fine now on both daydream and non-daydream.

Edit: No devices show this issue now after having it added

SPGB commented 6 years ago

@jdduke Calling GvrView.onResume() solves the issue for me.

Within video playback I allow the user to swap between mono and stereo view modes, so it's worth noting that I have to call .onResume() after each switch as well.

jdduke commented 6 years ago

Can anybody else confirm whether adding .onResume() calls resolves the issues they're seeing? We're debating a hotfix rollout of Google VR Services, but if the suggested workaround works for everybody we might hold off.

shauntc commented 6 years ago

adding .onResume() fixed it for us ✅ Thanks @jdduke

jdduke commented 6 years ago

OK, just be sure to call [.onPause()](https://developers.google.com/vr/reference/android/com/google/vr/sdk/base/GvrView#onPause()) when your Activity is paused and/or the magic window experience is paused, and also [.shutdown()](https://developers.google.com/vr/reference/android/com/google/vr/sdk/base/GvrView.html#shutdown()) when your Activity is destroyed and/or you no longer need to use the GvrView/GvrLayout instance.

jdduke commented 6 years ago

Assuming the onResume() call works for everybody, I'm going to close this issue. If folks are unable to work around the issue, feel free to add a note here and I'll consider reopening. Apologies for the unexpected breakage, I'll be sure to add some stronger notes to our documentation about the need for calling onResume()/onPause()/shutdown().