Develop
Develop
Select your platform

VR Compositor Layers

Updated: Nov 14, 2024
This guide covers how to implement compositor layers in your Unreal application. For additional information, see Compositor Layers.

Overview

In Unreal, compositor layers are implemented through the Stereo Layer API. Note that the Stereo Layer API is only supported for Oculus Headsets on Unreal versions 4.13 and later.
By default, compositor layers are always displayed on top of all other objects in the scene. You may set compositor layers to respect depth, causing them to be occluded by scene elements that are closer to the camera, by enabling Supports Depth. If you are using multiple layers, use the Priority setting to control the depth order in which the layers will be displayed, with lower values indicating greater priority (e.g., 0 is before 1).
Note that enabling Supports Depth may affect performance, so use it with caution and be sure to assess its impact.

Samples

To see examples of compositor layers in Unreal, check out the following:
  • Layer Sample for a basic illustration of using UMG on quad layers and cylinder layers.
  • Rendering Techniques Sample for how to use compositor layers for text rendering.
  • Scene Sample for how to use compositor layers for a main menu and with passthrough.
  • Phanto for use of a compositor layer as a game round pop-up.

Creating a Compositor Layer

To create a compositor layer:
  1. Create an Actor and add it to the level.
  2. Select the Actor, select Add Component, and choose Stereo Layer.
  3. Under the Stereo Layer options, set Stereo Layer Type to Quad Layer, Cylinder Layer, or Equirect Layer.
  4. Set Stereo Layer Type to Face Locked, Torso Locked, or World Locked.
  5. Set the overlay dimensions in world units in Quad Stereo Layer Properties or Cylinder Stereo Layer Properties.
  6. Select Supports Depth in Stereo Layer to set your compositor layer to not always appear on top of other scene geometry. Note that this may affect performance.
  7. Set Texture to the texture that should be rendered as a compositor layer. Set Quad Size or Stereo Layer Shape values as appropriate to adjust the size of your compositor layer.
  8. Select layer filters. Refer to Layer Filters and MQSR about details.
To connect the compositor layer to a UMG UI widget:
  1. Create a Widget Blueprint and modify it to include your desired UI elements.
  2. On the same Actor that contains the Stereo Layer, select Add Component, and choose Widget.
  3. In order to preserve user expectations, align the Widget to your already-created Stereo Layer by adjusting Widget Draw Size and Pivot to match the bounds of the Stereo Layer’s Quad Size.
  4. Disable Render in Main Pass for the widget. It will be rendered in-scene via the Stereo Layer component.
  5. Add logic like the following Blueprint, which updates the Stereo Layer with the texture of the widget, to your Actor containing the Widget and Stereo Layer components:
Screenshot of Blueprint for update stereo layer with widget Render Texture
You may add up to 16 compositor layers to Meta Quest applications. Any additional layers beyond this limit will not be rendered.

Layers Sample

The LayerSample, available from our Unreal GitHub repository, illustrates the use of VR Compositor Layers to display a UMG UI. For more information, see Unreal Samples.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon