Samsung Gear 360 Video in Unity 5.4

A step-by-step guide to view 360 video with your Oculus Rift

It was a pain to figure out for the first time, but there are only a few simple steps to set it up. Thought I would make it easier for others by posting a step by step so others can easily follow. I’ve also added a few areas where I ran into problems and how potential solutions for fixing them.

The most useful tutorial I found was by Liv Erickson so this is mostly building on what Liv already put together. Also, it seems like you can use any 360 video (as long as it is the correct format and already been stitched) and any hardware that Unity supports. I just had the Gear 360 and Rift available to test.

As Liv mentions, we are going to create a sphere, add a “Material” to it that has a custom Shader and add a script to the sphere.

Before starting, make sure you have Quicktime Player as Unity uses that to import videos and you could have potential issues if you download the player while Unity is open.

Start a new Unity project:

Turn on the Oculus SDK:

Edit -> Project Settings -> Player -> Other Settings

Select “Virtual Reality Supported” and it should already have Oculus selected. If not, select the “+” and select it from the list

Create a Sphere and Move Camera:

GameObject -> 3D Object -> Sphere

Change the “Scale” to 20, 20, 20 for X, Y, Z respectively

Select Your main Camera and for “Position” make it 0, 0, 0 for X, Y, Z respectively, just like your sphere. We want the Camera to be right in the middle.

Hit Play and test that your camera moves around with your Rift. You shouldn’t see the Sphere as we have not added the Shader to it.

Create “Material” and add the “Shader”:

Assets -> Create -> Material and name it (I called it VidMaterial)

Now, for the Shader go to Assets -> Create->Shader->Standard Surface Shader (not Instanced and I called it InvertSphere)

Double click on the shader so you can change the script, add the following to it and make sure to save it:

Now select your Material and at the top, for the Shader, select your customer Shader (InvertSphere).

Add Video to Unity and Material:

To import your already edited/stitched video go to Assets -> Import New Assets

This can take a while. It took ~10 minutes for a 1 minute video. Task Manager said Unity Editor was not responding and so I ended the task. It took a while to figure out why it wasn’t importing through other methods. Instead, just wait.

Once imported, drag the video the the “Base (RGB)” for the Material in the “Texture” area (in the top right).

Add the Material to the Sphere:

No select the Sphere in your Scene and drag the Material into the Sphere’s Inspector. Your Sphere should now be black.

Create the Auto Play Script:

Now that we have the movie in our Sphere, we need to add the script to auto play it as movies do not start on their own in Unity.

To create a script go to Assets -> Create -> C# Script

I named it PlayVideoOnLoad and then double click it and add the following into it:

Add the Script to the Sphere:

The last step is to add the auto play script to the Sphere. Select the Sphere and drag the script into the inspector.

You must then select the video in the “Mov Texture” area within the script that you added as a component in the Sphere’s Inspector. You can do that by clicking the small circle on the right of it. It should then looks like this (the Sphere may be black and that is alright, just hit play):

That’s it!

Hit play and you should have your 360 video running in your Rift headset. Let me know if you have any questions.

Like this story? Get more in the weekly newsletter from CinematicVR.