360 Video Footage in Unity with Video Player
After Effects Archives 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 Icon Create 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 Icon Add 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 Icon Add 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.

 

 

That’s it!
I hope this information will make learning VR easier and more enjoyable. One of the goals of ScenicMentor.com is to help designers work faster, giving them more time to create and more easily share their ideas with the world!
I’d love to hear comments or suggestions. Contact me here.

Facebook
RSS
Twitter
Email
LinkedIn