Play 360 Videos in Unity
Unity Version: 5.3.4f1 Personal
Step-by-step slide [Google Slides]
Play video with MovieTexture
Adapted from Bernie Roehla.
- Move Main Camera to
X = 0, Y = 0, Z = 0
. - Create a Sphere at
X = 0, Y = 0, Z = 0
and scaleX = 10, Y = 10, Z = 10
, rename it to VideoSphere. - Create an empty material and drag to VideoSphere.
- Create a new shader
InsideVisible.shader
so the texture can be rendered inside the sphere. Drag it to material in VideoSphere. - Drag the 360 video to Assets and drag it to texture of Material in VideoSphere.
- Create an empty GameObject and add a script
VideoPlayback.cs
to playback the video. Assign Sphere to VideoSphere. - Click Play, now you can play the video.
- For sound, click on GameObject and Add Component, then type in Audio Source. Choose the same video for AudioClip. Now you have sound sync to the video!
Stream 360 camera
Hardware: Ricoh Theta S
-
While holding the camera icon button, press power button to go to LIVE stream mode. Then connect it to computer via USB.
-
Install RICOH THETA UVC Blender (Mac, Win)
-
WebCamStream.cs
streams webcam according to Camera Number. You can check the Unity console for the index, for example:Device 0: RICOH THETA S - original dual fisheye views Device 1: THETA UVC Blender - equirectangular view <- use this device Device 2: FaceTime HD Camera
360 Video Format
-
MP4/MOV format video at most 1280x640 resolution (might need to wait 10+min when importing); Unity native OGG format video can run up to 3840x1920.
You can convert the video by the following on Linux:
ffmpeg -i INPUT.mp4 -c:v libtheora -c:a libvorbis -q:v 6 -q:a 5 OUTPUT.ogg
-
Unity built-in MovieTexture does not support mobile platforms (iOS, Android).
-
Easy Movie Texture ($65) and AVPro Video plugin ($450) provides good support for mobile and high resolution videos.
360 Video Source
- The video in this example: Pokèmon 360 - CATCH 'EM ALL in VR! by Freakin Rad.
- youtude-dl is a great program to download YouTube video including 360 videos.