VR Compositor Layers
In some versions of Unreal, you may add transparent or opaque quadrilateral, cubemap, or cylindrical overlays to your level as compositor layers.
TimeWarp compositor layers are rendered at the same frame rate as the compositor, rather than rendering at the application frame rate. They are less prone to judder, and are raytraced through the lenses, which improves the clarity of textures displayed on them.
We recommend using compositor layers for text and for headlocked elements. Text rendered on compositor layers is more legible, and headlocked layers remain headlocked when Asynchronous TimeWarp interpolates dropped frames.
Gaze cursors and UIs are good candidates for rendering as quadrilateral compositor layers. Cylinders may be useful for smooth-curve UI interfaces. Cubemaps may be used for startup scenes or skyboxes.
We recommend using a cubemap compositor layer for your loading scene, so it will always display at a steady minimum frame rate, even if the application performs no updates whatsoever. This can significantly improve application startup times.
Quadrilateral, cylinder, and cubemap layers are supported in Unreal versions 4.13 and later. Cylinder and cubemap support currently support mobile development only.
By default, VR compositor layers are always displayed on top of all other objects in the scene. You may set compositor layers to respect depth positioning 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.
To create an overlay:
- Create an Actor and add it to the level. If you don’t want the Actor to be visible in the scene, use an Empty Actor.
- Select the Actor, select Add Component, and choose Stereo Layer.
- Under the Stereo Layer options, set Stereo Layer Type to Quad Layer or Cylinder Layer.
- Set Stereo Layer Type to Face Locked, Torso Locked, or World Locked.
- Set the overlay dimensions in world units in Quad Stereo Layer Properties or Cylinder Stereo Layer Properties.
- 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.
- Configure Texture and additional attributes as appropriate.
The Actor you slave the component to will be fixed at the center of the quad or the cylinder.
You may add up to three VR compositor layers to Gear VR applications, and up to fifteen to Rift applications.
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.