After Effects Tutorials Unity

360 Video Footage in Unity with Video Player

Set up your scene’s skybox to loop a 360 video using Unity’s panoramic render texture.

Assumptions: You’re building for Android with an OVR camera rig. This tutorial uses Unity 2017.4.0f1 and VRTK 3.2.0.


Import 360 Video File

Import your video file as an asset into Unity into a new folder called ‘Video’. The default settings are fine.


Create Render Texture

In the project panel, create a new render texture named ‘VideoRenderTexture’ and move it into the same Video folder. This is very important: The size of the render texture must match the size of your video exactly. My video, for example, is 2048 x 2304, which is reflected in the size I specified for my corresponding render texture.

Enable Mip Maps & Autogenerate Mip Maps.


Scenic Mentor 3 IconCreate Skybox Material

Create a new Material in the project panel named ‘Video Skybox’ and move it into your Video folder. With the new material asset selected, choose Skybox>Panoramic from the Shader dropdown box in the Inspector. Choose Mapping>Latitude Longitude Layout and Image Type>360 Degrees. My video is a top and bottom stereoscopic layout, so I have selected Over Under in the 3D Layout dropdown.

Finally, click on the select button in the grey box under Spherical (HDR) and choose your ‘VideoRenderTexture’ asset. Alternatively, you can simply drag and drop the asset onto the square.

So your assets ‘Video’ folder should look something like this now:


Scenic Mentor 4 IconAdd Skybox Material to Your Scene

Main Nav> Window> Lighting. Drag and drop or select the little grey circle to add your ‘VideoSkybox’ material in the top Environment section as the scene’s Skybox Material.


Scenic Mentor 5 IconAdd Video Player Object

Add a new object anywhere in your scene. In the hierarchy, Create>New>Empty Object and rename it to ‘VideoObject’.

Select this object and, using the Inspector, add the ‘VideoPlayer’ Component. Drag your 360 video file into the Video Clip field and enable ‘Play on Awake’, enable ‘Wait For First Frame’ and enable ‘Loop’.  Lastly, drag your ‘VideoRenderTexture’ asset into the Target Texture field.

Note: If you are building for Android, .mov files and H.265 are not compatible. Use MPEG-4 codec/.mp4 instead.

I hope this information will make learning VR easier and more enjoyable. Subscribe to my youtube channel for more Unity and VR tutorials.

You May Also be Interested In...