Display video on composition layers
You can use Composition Layers to display high resolution videos in a Head-Mounted Display (HMD) at full resolution. With Composition Layers, the resolution isn't limited to the resolution of the Eye Buffer, or affected by distortion and sampling from the render pipeline.
Refer to the following sections to understand the Video types you can use with composition layers, and Add video to a composition layer.
Video types
The following table describes the recommended composition layer for different types of video:
Video type | Composition layer |
---|---|
Rectangle video | Quad or Cylinder |
360 degree video | Equirect |
Stereo video | Projection |
Refer to Composition layer component for more information about the types of composition layer.
Add video to a composition layer
To add a video to a composition layer, you must first:
- Import your video file into your Unity project.
- Create a composition layer of appropriate display. Refer to Video types to choose an appropriate composition layer for your video type.
Follow these steps to display your video on the composition layer:
- Add a Video Player component to a GameObject (Hierarchy window: Right-click on your chosen GameObject > Video > Video Player).
- In the Inspector window of the Video Player component, select your imported video file in the Video Clip field.
- Go to Assets > Create > Rendering Render Texture to create a new Render Texture.
- Open the Video Player component and view it in the Inspector window.
- In the Target Texture field, assign your custom Render Texture you created in step 3.
- Open the composition layer you created in the Inspector window.
- In the Source Textures component, under Source, select Local Texture and add the Render Texture you created in step 3.
When you enter Play mode, you can now observe the video clip displayed on the composition layer.
Composition layer settings configured to display a video clip.
Note
The video clip will not display on the composition layer until you enter Play mode for the first time, after which the first frame on the video will display on the Composition Layer in the Scene view and the Game view.