mobfishgmbh / Cardboard-VR-Unity-SDK

Apache License 2.0
56 stars 11 forks source link

No resizing of stereo view for iPhone 12 Pro #91

Open TassiDK opened 3 years ago

TassiDK commented 3 years ago

When building for iOS, the stereo view works as intended, except when running it on an iPhone 12 Pro. The two images render correctly, but only take up approximately half of the screen size, without ever resizing. Is there a place in any of the scripts where support for the newest iPhones can be added?

andypoly commented 3 years ago

Yeah see this also, I think Unity reports the wrong dpi for iPhone 12s. Presumably the cardboard elements will not take all the screen on an iPhone Max but if it is wrong size for carboard lenses it is a breaking issue

rajandeepsingh13 commented 3 years ago

Yeah I see this too on an iPhone 12

AerinFloreo commented 3 years ago

We are also having this issue, Iphone 12 Max. Using Unity 2019.4.11f

cdytoby commented 3 years ago

I don't have a newest iPhone in my hand so I can't do bugfix on this subject, need help on this one.

andypoly commented 3 years ago

Can anyone report what Screen.dpi Unity reports for iPhone 12 models - I suspect this is wrong and might be related (Have no iphone 12 on hand right now either). How is the scale of the eye views decided @cdytoby? Is it in mobfish code?

cdytoby commented 3 years ago

https://github.com/mobfishgmbh/Cardboard-VR-Unity-SDK/blob/master/Assets/Cardboard/Scripts/Behaviours/CardboardPostCamera.cs

This MonoBehaviour is about drawing the eye mesh for each eye, including modifying the orthogonal projection matrix.

https://github.com/mobfishgmbh/Cardboard-VR-Unity-SDK/blob/master/Assets/Cardboard/Scripts/CardboardLensDistortion.cs

In this code contains how the eye mesh is created. private static extern void CardboardLensDistortion_getDistortionMesh(...). This method is exactly how the mesh is retrieved.

The eye mesh should be retrieved from native c++ code correctly, with the value correctly scaled with screen coordinate "normalized" from -1 to 1 on both x and y axis.

If I understand correctly, the related C++ code can't calculate these scale correctly, and returned the incorrect value.

https://github.com/googlevr/cardboard/releases

Based on google vr official releases, they do modified their code to make it correct for new iphones, by adding more dpis to their code.

So in order to update this, the native plugin repository should be updated, which is hosted here (a fork from official one).

https://github.com/mobfishgmbh/cardboard

I can't simply use the official one because this one has some modification, including bug fix and add an event callback.

andypoly commented 3 years ago

Yep are the fixes to be ported across? https://github.com/googlevr/cardboard/issues/144

AndreySkyFoxSidorov commented 3 years ago
  1. Download https://github.com/mobfishgmbh/cardboard
  2. Need update file screen_params.mm to https://github.com/googlevr/cardboard/blob/master/sdk/screen_params/ios/screen_params.mm
  3. Build and replase libsdk.a file
friggasaint commented 3 years ago
1. Download https://github.com/mobfishgmbh/cardboard

2. Need update file screen_params.mm to https://github.com/googlevr/cardboard/blob/master/sdk/screen_params/ios/screen_params.mm

3. Build and replase libsdk.a file

Could you elaborate on how to build with updated screen_params.mm to a new libsdk.a?

kaaaana commented 3 years ago

Could you elaborate on how to build with updated screen_params.mm to a new libsdk.a?

You can create libsdk.a from the updated sdk by using Xcode.

AndreySkyFoxSidorov commented 3 years ago

libsdk.zip

1. Download https://github.com/mobfishgmbh/cardboard

2. Need update file screen_params.mm to https://github.com/googlevr/cardboard/blob/master/sdk/screen_params/ios/screen_params.mm

3. Build and replase libsdk.a file

Could you elaborate on how to build with updated screen_params.mm to a new libsdk.a?

andypoly commented 3 years ago

thanks, I think! - much smaller - stripped of debugging info or something?