Hassan Karaouni
OMG Build
Published in
5 min readMay 2, 2018

--

Oculus Go 360 Photo Viewer: 3 Step Starter Build

Let’s visit the Atlantic ocean (or any location captured in 360) using Oculus Go!

The Oculus Go is here! We’re eager to see if Go and other standalone headsets launch VR into a more mainstream, easy-access future. Why stop there? Let’s join in building that future, starting with a first app on Oculus Go!

Here’s the sample project. Why is the title 24x7fix? More on that later. If you’re already a VR developer or just looking for build-specific steps - skip to Step 3. Building to Go is similar to Gear VR but easier in some ways — no OSIG files needed for dev!!!

Step 1: Set Up Your Dev Environment

Oculus released a handy guide on how to develop for Go. The setup process is very similar to Gear VR. Here’s a summary:

  1. Download Unity. Oculus recommends Unity 5.6.5p2 or 2017.4.1. You can download specific versions of Unity via the Download Archive.
  2. Download the Oculus Utilities for Unity. Oculus recommends 1.24.1 or later. The utilities speed up development for the Oculus platform.
  3. Download Blender. We’ll need this for a model we download.
  4. Download the Android SDK with Build Tools and the Java JDK. Remember where these are downloaded. In Unity (Preferences > External Tools) you’ll need to fill in where the tools are located to build your app.
Set the SDK and JDK fields to the location of the corresponding folders on your computer.

The above is a quick summary and it’s easy to run into bugs so don’t hesitate to do some Google searching or ask for help in the comments!

Step 2: Build Your Virtual Environment

Now let’s get to the fun part: building!

To build a simple 360 photo viewer, we need: a 360 image, a sphere to place the image on, and an interface between our movements in the real world and what we see in the virtual world. Getting a 360 image is easy. Capture your own, find one online at Flickr, or search on Google.

Setting up a sphere to place the image on is also easy — if you understand the key details. To create the effect of 360 immersion, our strategy will be to put the user inside of a sphere with the 360 image projected onto the sphere. A normal sphere won’t work because Unity utilizes a graphics optimization named backface culling.

Put simply: sides of an object facing away from the user are not rendered by default. The standard 3D model for a sphere in Unity is built to be viewed from the outside. In most cases, users don’t need to see the inside of a sphere.

We could turn off backface culling, but we’d mess with Unity’s optimizations in the process. A better approach: use a custom, inward facing sphere! You can check out a write-up with more detail on the problem and should download the inward facing sphere built by the author: Scott@F45.

Left: inward facing sphere. Right: standard sphere. Watch the horizon line for an intuition about the problem. On the standard sphere, the image is wrapped along the outside of the sphere.

Once you have the inward facing sphere downloaded, add the sphere to your project and slap on a 360 image! You’ll need to create a Material and add the 360 image as a Texture, then add the Material to the sphere.

The final step is to set up our interface between movements in the real world and what we see in the virtual world. Import the Oculus Utilities into your Unity project and look inside of the prefabs (Assets > Oculus > VR > Prefabs). Drag the OVRCameraRig.prefab into your scene and place the prefab in the middle of your sphere. The prefab is your virtual body!

Here’s a picture of the full set up!

Step 3: Build to the Device

The Oculus Go is an Android device, so you’ll need to switch your platform to Android in Build Settings. Also, don’t forget to go to your Player Settings to turn on Virtual Reality Supported and select Oculus in Virtual Reality SDK’s. There are certainly other tweaks (optimize the texture compression, edit Quality Settings, etc) you could make to optimize the final build of the project, but these simple steps are suitable for a quick prototype. If you’re interested, Oculus published a guide on Go-specific optimizations.

If you hit “Build and Run” already, you failed! You need to set your Go to enter Developer Mode first.

Hitting “Build and Run” without setting your Go to enter Developer Mode first was a great plan but it sucks.
  1. Plug in your Go to your computer via the USB cable.
  2. Open the Oculus app on your phone, hit Settings.
  3. Select your Go device and select the More Settings button.
  4. Select the Developer Mode button then toggle on Developer Mode.
  5. In the headset, you may need to accept pop-ups asking to enable USB debugging and other device permissions. After, your device should be recognized as an Android device!
In the Oculus app, go to Settings then select your Go. Select the More Settings button, then select and toggle on Developer Mode. Put the device on and accept the pop-ups to enable the Go to communicate with your computer.

Now for the moment of truth: hit Build and Run in Unity, put on your headset, and enjoy!

Final Thoughts

That was easy! If you got stuck, just post a comment. It’s awesome to be a part of building for VR at a time when the industry is making a strong push to go mainstream.

If you downloaded the sample project, you might notice the name is 24x7fix. What’s that? Want more tips on building for VR and building in general? Follow us at OMG Build! We promise answers and more content soon. Until then, happy building!

--

--