Set up a panoramic video
Instructions on how to set up a panoramic video in Unity.
Read time 3 minutesLast updated 14 days ago
Use a panoramic video to create a more immersive environment in your application.
To set up a panoramic video for use in Unity, follow these steps:
- Create a Video Player for your panoramic video.
- If your video has an equirectangular layout, render an equirectangular video to a render texture.
- If your video has a cubemap layout, render a cubemap video to a render texture.
- Project your video content onto an object.
Create a Video Player for your panoramic video
To create a Video Player component from your panoramic video:
- Import your video into Unity as an asset.
- Drag the video asset from the Project view to an empty area of Unity's Hierarchy view.
By default, this sets up the component to play the video full-screen for the default Camera. Press Play to view this.
Render an equirectangular video to a render texture
To render an equirectangular video to a render texture, you must change the default behavior of the video player. To do this, use the following steps:
- Go to Assets > Create > Rendering > .Render Texture
?
- Click on the new render texture. The Inspector window shows.
- Set Size to match your video's dimensions.
- To check the dimensions of your video, refer to View the source information of your video clip.
- Click on the object that contains the Video Player component. The Inspector window shows.
- Set Render Mode to Render Texture.
- Set Target Texture to your new render texture.
- If your video has the cubemap layout, consider these Alternative steps for videos with the cubemap layout.
- Enter Play mode to verify that this is functioning correctly.
The video doesn’t render in the Game window, but you can select the render texture asset to check its content updates with each video frame.
Render a cubemap video to a render texture
If your video has a cubemap layout, you can render the video directly to a render texture cube instead of a 2D render texture. This is better for performance and is more suited to game engines.
To set this up:
- Go to Assets > Create > Rendering > Render Texture. This action creates a new render texture.
- Click on the new render texture. The Inspector window shows.
- Set Dimension to Cube.
- Set Size to be exactly the dimensions of the individual faces of the source video.
- For example, if you have a 4 x 3 horizontal cross cubemap layout video with dimensions 4096 x 3072, set Size to 1024 x 1024 (4096 / 4 and 3072 / 3).
- Click on the object that contains the Video Player component. The Inspector window shows.
- Set Render Mode to Render Texture.
- Set Target Texture to your new render texture.
With this setup, the video player assumes that the source video contains a cube map in either a cross or a strip layout (which it uses the video aspect ratio to determine). The video player then fills out the render texture’s faces with the correct cube faces.
Project your video content onto an object
Once your video player contains your panoramic video as a render texture, you can display your video's content on the surface of a GameObject or skybox.
To display the content on a GameObject, drag your render texture onto the object. This creates a new material that contains the render texture as its texture. When the Video Player plays the video, it will display on the object.
For information on how to set a panoramic video as a skybox, refer to Set up a panoramic video as a skybox.