360 Video Player for Oculus Quest 2 (Using Unity SkyBox)
Setup Unity Envirnoment for Oculus Quest 2 Development
- Set Up Unity Settings for Oculus Quest 2.
- Import Oculus Integration Package.
Creating a Skybox Material
- In the Project window, right-click and select Create > Material
- Select the Material you just created and in the Inspector, set the Shader to Skybox > Panoramic
Creating a Render Texture
- In your Project window, right-click and choose Create > Render Texture
- Set the Render Texture so it will play at the correct resolution. If you already know the video resolution, Change the size parameter in your Render Texture to the correct dimensions. If you do not, you’ll need to find those dimensions in the Source Info panel.
-
Select your video in the Project window and click the video title in the bottom of the Inspector, next to the play button. Select Source Info. The video resolution is located in the Pixels row.
-
Enter the values of your Render Texture in the Size box, starting with frame width.
-
Finally, select your 360 Video Material, and set the newly created Render Texture as the Texture. You can do this by either dragging your Render Texture onto the Texture field or by clicking the Select button and searching for your new Render Texture.
Creating Video Player
-
Create an Empty GameObject.
-
Click your VideoPlayer GameObject and, in the Inspector window, click Add Component. In the search bar, type “Video” to find the VideoPlayer component.
-
Leave the VideoPlayer GameObject selected in the Hierarchy window, and find your video in the Project window. Left-click and drag the video onto the Video clip box in the Inspector window.
-
Find your Render Texture and drag it into the Render Texture slot on the Video Player component
Setting Skybox Material
-
Select Window > Rendering > Lighting Settings to access the settings for the Scene’s Skybox.
-
Drag your Skybox Material onto the Skybox Material slot under Environment. You can also click the widget to the right of Skybox Material and search for your Material there.
- When you enter Play Mode, you should see the 360 Video appear in the viewport.
Adding VR Camera
-
Search for OVRCameraRig in Assets and add it to Scene.
-
Build and Run.