Cardboard-VR-Unity-SDK icon indicating copy to clipboard operation
Cardboard-VR-Unity-SDK copied to clipboard

No resizing of stereo view for iPhone 12 Pro

Open TassiDK opened this issue 4 years ago • 12 comments

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?

TassiDK avatar Dec 07 '20 10:12 TassiDK

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

andypoly avatar Dec 15 '20 08:12 andypoly

Yeah I see this too on an iPhone 12

rajandeepsingh13 avatar Dec 22 '20 10:12 rajandeepsingh13

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

AerinFloreo avatar Dec 23 '20 00:12 AerinFloreo

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

cdytoby avatar Jan 04 '21 12:01 cdytoby

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?

andypoly avatar Jan 04 '21 14:01 andypoly

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.

cdytoby avatar Jan 04 '21 15:01 cdytoby

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

andypoly avatar Jan 12 '21 12:01 andypoly

  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

AndreySkyFoxSidorov avatar Feb 01 '21 13:02 AndreySkyFoxSidorov

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?

friggasaint avatar Feb 01 '21 19:02 friggasaint

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.

kaaaana avatar Feb 12 '21 07:02 kaaaana

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?

AndreySkyFoxSidorov avatar Feb 13 '21 12:02 AndreySkyFoxSidorov

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

andypoly avatar Mar 18 '21 16:03 andypoly