If you’ve played 360 video in VR, you know it’s kinda cool… But lately, 3D video is starting to take off. With off the shelf cameras like the Vuze line, it’s gotten easy to record your own without spending the cost of a new car to get started.. Before today, playing 360 3D video in VR with Unity3D was a bit complicated.. but now, thanks to an open source project put out by Unity Technologies, it’s getting easier. Earlier today, I stumbled on a post and github project they’ve put together to make 3D 360 video simple to implement.
Video Version
Prefer to watch video? The entire process is available on youtube here.
Project Setup
To get going, you’ll need a couple things.. First, you need a 3D video. For this article, I’m using an Over-Under video you can download from here: http://www.panocam3d.com/video3d360.html#!portfolio/project-13.html
Once you’ve downloaded your video, you’ll need to grab the script and shader from this github project: https://github.com/Unity-Technologies/SkyboxPanoramicShader
You can download it or clone the repository, whatever you feel most comfortable doing.
Place the shader and script into your project along with the video file you want to play.
You’ll also need to visit your player settings and make sure the Virtual Reality Enabled box is checked.
Render Texture
To use this shader, we need a render texture. Create a new render texture and name it “Panoramic Render Texture”
Select the RenderTexture and change the size to 2304 x 2304.
The render texture resolution should match your video resolution.
Change the depth buffer to “No depth buffer”.
Render textures are textures that can be rendered to. They can be used to implement image based rendering effects, dynamic shadows, projectors, reflections or surveillance cameras.
The Video Player
To create a video player, drag the video from the project view into the scene view. A player will automatically be created with the video assigned to it.
Select the video player and look to the inspector.
Change the render mode to “Render Texture”.
Drag the render texture from the project view into the target texture field.
The Material
Next, we need to create a material for the shader.
Create a new material, name it “Skybox”
Drag the render texture onto it.
Set the mapping type to “Latitude Longitude Layout”
Change the image type to 360 Degrees.
Set the 3D layout to “Over Under”
Skybox Setup
The last step is to assign our material to the skybox.
Open the Lighting window.
Drag the Skybox into the Skybox Material field.
All Done
That’s it, save your scene…
Then put on the headset and press play, the video should start playing in 3D.
What about other video types?
This shader appears to have support for a few different video formats. In this article, we covered a simple 360 degree over under video, but you may have noticed the options for 180 & side by side. I haven’t tried those yet, but if you’re interested in them, I’d recommend you check out the full documentation they’ve provided here: https://docs.google.com/document/d/1JjOQ0dXTYPFwg6eSOlIAdqyPo6QMLqh-PETwxf8ZVD8/edit#