Search Unity

[Solved] Google Cardboard - Screen Distortion is wrong

Discussion in 'AR/VR (XR) Discussion' started by Red_Dragon69, Apr 6, 2016.

  1. Red_Dragon69

    Red_Dragon69

    Joined:
    Sep 7, 2015
    Posts:
    115
    Hy,
    I'm playing around with the Google Cardboard SDK und tried to build an Android app for my Sony Xperia Z1 Compact. When testing in editor everything looks fine, but after deploying to my phone the distortion looks kind of weird. :/

    This is a picture of how it should be:
    HowItShouldBe.png

    And this is how it looks on my phone:
    HowItIsRendered.png

    Is the display size (4.3 inches) too small? The Cardboard app itself and other VR apps (e.g. DiveCityCoaster) are working properly. Only the Unity Cardboard SDK produces such a strange image. I did not change anything in the demo scene provided by Google. https://developers.google.com/cardboard/unity/download

    Pls help!

    Best regards,
    Max
     
  2. Red_Dragon69

    Red_Dragon69

    Joined:
    Sep 7, 2015
    Posts:
    115
    And again, I found the error a few hours after posting this thread. It's not perfect, but way better than before. :)

    First of all i measured my phone and created a new profile for my phone in CardboardProfile.cs
    Code (CSharp):
    1.  
    2.   /// Some known screen profiles.
    3.   public enum ScreenSizes {
    4.     XperiaZ1Compact,
    5.     Nexus5,
    6.     Nexus6,
    7.     GalaxyS6,
    8.     GalaxyNote4,
    9.     LGG3,
    10.     iPhone4,
    11.     iPhone5,
    12.     iPhone6,
    13.     iPhone6p,
    14.   };
    15.  
    16.   /// Parameters for a Nexus 5 device.
    17.   public static readonly Screen XperiaZ1Compact = new Screen {
    18.     width = 0.095f,
    19.     height = 0.055f,
    20.     border = 0.001f
    21.   };
    22.  
    23. // ...
    24. /// Returns a CardboardProfile with the given parameters.
    25.   public static CardboardProfile GetKnownProfile(ScreenSizes screenSize, DeviceTypes deviceType) {
    26.     Screen screen;
    27.     switch (screenSize) {
    28.       case ScreenSizes.XperiaZ1Compact:
    29.         screen = XperiaZ1Compact;
    30.         break;
    31.       case ScreenSizes.Nexus6:
    32.         screen = Nexus6;
    33.         break;
    34.       case ScreenSizes.GalaxyS6:
    35.         screen = GalaxyS6;
    36.         break;
    37.       case ScreenSizes.GalaxyNote4:
    38.         screen = GalaxyNote4;
    39.         break;
    40.       case ScreenSizes.LGG3:
    41.         screen = LGG3;
    42.         break;
    43.       case ScreenSizes.iPhone4:
    44.         screen = iPhone4;
    45.         break;
    46.       case ScreenSizes.iPhone5:
    47.         screen = iPhone5;
    48.         break;
    49.       case ScreenSizes.iPhone6:
    50.         screen = iPhone6;
    51.         break;
    52.       case ScreenSizes.iPhone6p:
    53.         screen = iPhone6p;
    54.         break;
    55.       default:
    56.         screen = Nexus5;
    57.         break;
    58.     }
    59.     Device device;
    60.     switch (deviceType) {
    61.       case DeviceTypes.CardboardMay2015:
    62.         device = CardboardMay2015;
    63.         break;
    64.       case DeviceTypes.GoggleTechC1Glass:
    65.         device = GoggleTechC1Glass;
    66.         break;
    67.       default:
    68.         device = CardboardJun2014;
    69.         break;
    70.     }
    71.     return new CardboardProfile { screen = screen, device = device };
    72.   }
    73.  
    Finally on the CardboardMain object set Screen Size to your device and Device Type to Google Tech C1 Glass. This is the best approach to VR with a smaller phone, without creating a new VR profile. Further you have to adjust & align your phone very carefully into your cardboard device. Even the slightest error in position could ruin the immersion!!!

    HowItWasSolved.png

    Best regards,
    Red_Dragon
     
  3. Unitalo

    Unitalo

    Joined:
    Jan 12, 2017
    Posts:
    2
    Where do i find CardboardProfile.cs?
     
  4. Red_Dragon69

    Red_Dragon69

    Joined:
    Sep 7, 2015
    Posts:
    115
    Google changed the name from Cardboard to GoogleVr and all scripts were also changed. You have to look for GvrProfile in the GoogleVR/Scripts folder.

    I tried a few phones on the new GoogleVR and I think the cardboard pairing works better now, so the need for a new profile is no longer given.
     
    Last edited: Jan 12, 2017