360° Photo Viewer Android App for Google Cardboard Made With Unity

by AnnaW8 in Craft > Cardboard

5303 Views, 8 Favorites, 0 Comments

360° Photo Viewer Android App for Google Cardboard Made With Unity

unnamed.png

Build an Android app for Google Cardboard to view a 360° photo powered by Unity. Android SDK, Java DK, Android Developer Device and Google Cardboard required.

Unity

unitylogo.jpg

Download and install unity personal.

Google VR SDK for Unity Package

Bildschirmfoto 2016-08-06 um 16.08.48.png

Download Google VR SDK for Unity.

Open Unity, create a new project and import the Google VR SDK for Unity package.

  • Assets > Import Package > Custom Package > Open the Google VR SDK for Unity package (gvr-unity-sdk-master/GoogleVRForUnity.unitypackage) > Import

Equirectangular Panoramic Image

4.jpg

Download an Equirectangular Panoramic image with 360° x 180° field of view.
(you can find several on flickr like this one https://www.flickr.com/photos/jancbeck/16681739371...)

Import and edit the Equirectangular Panoramic image in Unity.

  • Assets > Import New Assets, Import Equirectangular Panoramic image
  • Select the Equirectangular Panoramic image in the Project view.

In the Inspector view:

  • Change the Texture Type to Cubemap.
  • Change the Mapping to Latitude-Longitude Layout (Cylindrical).
  • Apply

New Material

StandardShaderNewEmptyMaterial.png

Create and edit the Material. Assign the Equirectangular Panoramic image to the Material. Assign the Material to the Skybox.

  • Assets > Create > Material
  • Select the Material in the Project view.

In the Inspector view:

  1. change the Shader to Skybox/Cubemap
  2. Cubemap (HDR) > Select Equirectangular Panoramic image

  • Drag and Drop the Material from the Project view into the Scene view.

or

  • Window > Lightning

in the Lightning view:

  • Environment Lightning / Skybox, Select the Material

Main Camera

InspectorCamera35.png

Add the stereo controller from google vr and update stereo cameras.

  • Select Main Camera in the Hierarchy view.

In the Inspector view:

  1. add component > GoogleVR > StereoController
  2. Stereo Controller (Script) > Update Stereo Cameras

Player Settings

class-PlayerSettings40-15.jpg

Change Build Identifiers and Screen Orientation in the Player Settings.

"Bundle Identifier: The string used in your provisioning certificate from your Apple Developer Network account(This is shared between iOS and Android)"

"Default Orientation, Landscape Left: The device is in landscape mode, with the device held upright and the home button on the right side."

  • Edit > Project Settings > Player

in the Inspector View:

  • Android Settings > Other Settings > Identification > Bundle Identifier (replace com.Company.ProductName with your data, like com.MyCompany.MyProduct)
  • Android Settings > Resolution and Presentation > Orientation > Default Orientation > Landscape Left

Connect Android SDK and Java DK to Unity

studio-feature-devices_2x.png

Add the Android SDK path and Java DK path to Unity.

"The first time you build a project for Android (or if Unity later fails to locate the SDK), you will be asked to locate the folder where you installed the Android SDK. Select the root folder of the SDK installation."

  • Unity > Preferences > External Tools > Android > SDK > Browse > Choose the root folder of your Android SDK.
  • Unity > Preferences > External Tools > Android > JDK > Browse > Choose the root folder of your Java DK.

Build

PublishingBuilds-0.jpg

Connect your Developer Android Device to your Computer.

  • File > Build Settings > Android > Build and Run
  • Save

Enjoy the 360 View

get-cardboard.png

Disconnect your Android Developer Device from the cable and put it in your favorite Google Cardboard.

Turn around and Enjoy the view.