Getting Started With Google VR Daydream

Google Daydream

Update (01/08/17): This tutorial was written before the release of Daydream and some steps may be out of date.  Please see my updated tutorial here on setting up the Daydream development environment and my updated tutorial on building a Controller based app here.

Disclaimer: I’m employed by Google, I work in the VR team at YouTube. All of the opinions expressed in this article and any article I publish are absolutely my own and do not reflect the opinions or direction of Google or YouTube. I would never talk about any Google tech that isn’t already publicly available. The purpose of this article is to encourage and inspire developers to start exploring Google’s amazing Daydream VR platform.

This article contains insights based on my experience designing and developing for Daydream over the last several months using the beta SDK. It is a basic intro to what Daydream is and a quick start guide to get first time developers up and running. In the coming weeks I’ll be adding more advanced Daydream tutorials on interactive development and experience design for the platform.

Google VR
It would be a massive understatement to say that I’m excited by what Google is currently doing with VR. The team at Google have a clear vision of where VR will be in the future and a definite strategy for moving it forward. Being an employee of Google I’m not in a position to talk about what we’re working on behind the scenes but I can say that it is nothing short of impressive. My personal opinion is that Daydream will become the default platform for developing in VR bringing with it a massive user base of people who otherwise never would have experienced this amazing new technology. With Daydream and Google the future of virtual reality is lucid!

What Is Daydream?
There is some misunderstanding as to what Daydream actually is. In Google’s own words: “Daydream is a platform for high quality, mobile virtual reality. Coming in Fall 2016, Daydream provides rich, responsive, and immersive experiences with hardware and software built for VR.”

Daydream is the name being given to Google’s VR platform, it includes a headset, a hand controller, a content platform and a range of Daydream certified Android devices for the VR experience to run on.
Daydream isn’t being released until sometime in Fall 2016, and as of writing there are no Daydream compliant devices on the market, so to build for the platform developers will need to use the Nexus 6P. If you wish to build apps with the Daydream controller you can do this by running the Controller Emulator on any Bluetooth enabled Android device. Until the release of the Daydream headset any Google Cardboard headset can be used to view your VR application. If you don’t have a Nexus 6P you can still build and test apps in Unity without having to export to the phone, and it’s free.

The Headset and Controller
Apart from the phone the main two pieces of hardware are the headset and hand controller. Unlike the Google Cardboard, the Daydream headset straps to your head and is designed for extended comfortable use. The hand held controller streams orientational and acceleration data to the headset vie Bluetooth. It has has three interaction points: a clickable directional trackpad, and two buttons APP and HOME. The APP button is for app specific functionality for developers, while the HOME button takes the user back to Daydream home.

Let’s Get Down To It
As of writing (September 2016) there are two Daydream SDKs available to developers. The Android SDK and the Unity SDK. Probably the easiest way to get up and running with Daydream (and the method I’m going to share in this article) is to use the Unity SDK. Find out more about the Unity SDK here. Unity uses the C# language. If you’re unfamiliar with C# don’t worry it’s pretty straight forward to pick up and there’s a massive Unity community out there who have probably already solved many of the problems you’re going to encounter. If you want to test Daydream on a device you’ll also need a Nexus 6P phone running Android N and a Google Cardboard headset to experience the VR. Optionally you’ll need a second Android phone to act as the hand held controller, any old Android phone that handles Bluetooth should suffice . More on Daydream hardware here.

Daydream VR Quick Start

  1. Download the free version of the Unity game engine here.
  2. Download the Daydream Unity SDK here and click the “Download repo directly” link. While you’re there download the Google VR SDK samples for Unity to dig around in once you’re setup.
  3. Unzip the Unity SDK download file, you should have a directory called gvr-unity-sdk-master with a Unity package inside called GoogleVRForUnity.UnityPackage.
  4. Open Unity and create a new 3D project.
  5. Import the Unity SDK package by right clicking the Assets folder in the project window and selecting Import PackageCustom Package and select GoogleVRForUnity.UnityPackage. Make sure all imports are selected and import.
  6. Take a look around the imported directories, there are a couple of useful example scenes in the DemoScenes folder but the most important thing to get your scene working in VR is the Prefabs directory.
  7. In the Prefabs directory place the GVRViewerMain into your scene by dragging it into the Hierarchy window. The GVRViewerMain prefab is a component that turns your Main Camera into a stereoscopic camera and sets up your app as a Daydream VR app.
  8. Press the play button to run your Unity project in the IDE and you should see it running through a stereoscopic viewport. It’s that easy!
  9. Now add a cube to the scene under the GameObject drop down menu select 3D Object > Cube.
  10. If you run the project now you’ll see the cube in the scene. If you hold down the Option key while dragging your mouse you can rotate the camera’s viewport to view 360 degrees.

Building To The Phone
As mentioned previously if you want to build to the phone at the time of writing (Sept 2016) you’ll need a Nexus 6P, and optionally a second Android phone to act as the controller. I will refer to the Nexus 6P as the Headset phone and the other phone as the Controller Phone. There are detailed steps on setting up your phone for Daydream here. I’ll take you through the key steps because the totality of the process can be a bit confusing the first time through.

  1. Install Android 7 Nougat on your phone by registering your phone with the Android Beta program, follow the steps here.
  2. Once Nougat is installed you’ll need to enable VR services, VR permissions, Bluetooth and Location Services. Follow these instructions on the Daydream site under the section Set Up Headset Phone, and optionally follow the instructions for setting up a controller phone.
  3. To set up the controller phone you’ll need to download and install the controller emulator app (see Setup Controller Phone section) and pair it via Bluetooth with your headset controller. For more info on the Controller Emulator see here.
  4. To build your app from Unity to the headset phone you’ll need the Android SDK installed on your computer and linked in Unity. Do this by downloading the latest version of Android Studio.
  5. Once Android Studio is installed, open it and under Android Studio menu select Preferences. Under Appearances & Behaviors > System Settings > Android SDK make sure Android 6.X (N) or greater (API level 24 or greater, Nougat) is installed, if not install it.
  6. In the Android SDK location text field, copy the location. On Mac something like /Users/MyUserName/Library/Android/SDK.
  7. Go back to Unity and under Unity menu select Preferences > External Tools and paste or browse for the location of the Android SDK.
  8. If you don’t have Java installed you’ll need to download and install the latest JDK, follow the instructions here.
  9. Once you have the JDK installed paste or browse the location of it into Unity preferences external tools. On Mac something like this: /Library/Java/JavaVirtualMachines/jdk1.0.VERSION.jdk/Contents/Home
  10. In Unity under File > Build Settings highlight Platform > Android and select “Switch Plaforms”, this could take a couple of minutes to install the relevant build files.
  11.  Still in Build Settings select Player Settings, under the Android tab in Other Settings change the Bundle Identifier to something other than the default. Something Like: com.myname.myapp
  12. In Player Settings under Resolution and Presentation set the default orientation to be Landscape.
  13. In Player Settings under Other Settings make sure Virtual Reality Supported is NOT selected. As of writing this only works with the Oculus SDK, NOT Daydream, although I imagine this will change in the future.
  14. Now connect your headset phone via USB and hit Build and Run from Build Settings and your app should run on the phone in stereoscopic VR.

Exploring Further
There are two demo scenes included with the Daydream Unity SDK, they are the best place to start learning more intermediate / advanced features of the platform.

The HeadsetDemo scene runs in the Unity IDE without the need for a phone. It uses a gaze based input system and is a good intro to concepts such as RayCasting and the Unity Event System. The ControllerDemo scene needs to be built to the phone and requires a second Android phone running the Controller Emulator app to act as a Daydream controller. It’s contains a slightly different RayCasting system that connects to and rotates with the hand held controller.

If you haven’t already downloaded the Unity SDK examples, do that now from here. They contain a wealth of tips and tricks for developing in Daydream from some of Google’s best developers. If you’re stuck or not sure how to do something work it out by digging around in their code. The best way to learn is to start building a game or app and aim to have it submitted to the Play Store when Daydream launches later in 2016.

3 comments

  1. how do I watch my own 360 videos we created using samsung 360 camera? On my old NOte 5 I could easily watch my own videos. I can’t figure it out on the google Pixle XL?

    Reply

  2. In “Daydream VR Quick Start”
    In step 10 it says:
    If you hold down the Option key while dragging your mouse you can rotate the camera’s viewport to view 360 degrees.
    I do not know what this means. I do not have an Option key.
    I have a Windows key and a FN key. Holding down either of those keys while dragging my mouse does nothing. Am I missing something?
    Thanks

    Reply

    1. @Kevin Ablett, my apologies I am a confirmed Mac addict. From the Daydream docs: “Simulated head tracking: In Play mode, you can use mouse movements to move the camera in the same way as head-tracking. To simulate turning your head, press and hold the Alt key and move your mouse. To tilt your view, press and hold the Control key and move the mouse”. For more see this guide on stereo rendering in the Unity editor

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *