This sample demonstrates how to render UMG UI widgets as VR compositor layers on Meta Quest using Unreal Engine’s Stereo Layer API. It shows the Widget Render Target pattern, runtime toggling between compositor layer mode and main pass rendering, and non-quad layer shapes. The project is a minimal UE5 setup with a single scene and Enhanced Input System for VR interaction.
Clone the repository from GitHub, open the project in Unreal Engine 5, and build for Android. The project contains a single scene (LayerMap.umap) with bStartInVR=True enabled. For detailed build and configuration steps, see the project README.
Explore the sample
Component
What it demonstrates
Key concepts
LayerMap.umap
Main scene with compositor layer widgets
Stereo Layer, Widget Render Target
MenuActor
Widget-to-layer texture binding on Tick
Render Target assignment, per-frame updates
Compositor layer toggle
Runtime mode switching
Layer vs. main pass rendering comparison
Non-quad shapes
Cylinder and equirect layer geometry
UStereoLayerComponent shape configuration
Enhanced Input
VR input handling
Enhanced Input System, VR action mappings
Runtime behavior
When running on a Meta Quest device, the sample displays UMG widgets rendered as compositor layers. MenuActor sets the Widget Render Target as the Stereo Layer texture on every Tick, ensuring the widget content stays synchronized with the layer. You can toggle between compositor layer mode and main pass rendering at runtime to compare visual quality and performance. Compositor layers bypass the main render pass and are composited by the VR runtime, providing sharper text and reduced aliasing. The device supports up to 16 simultaneous compositor layers. Non-quad shapes (cylinder, equirect) demonstrate alternative layer geometries for panoramic or curved UI.
Key concepts
Stereo Layer component with Widget Render Target
The core pattern connects a UMG widget to a Stereo Layer via a render target:
// MenuActor binds the Widget Render Target to the Stereo Layer on Tick
// 1. Widget component renders UMG content to a Render Target texture
// 2. Stereo Layer component uses that Render Target as its texture source
// 3. VR runtime composites the layer at display time (post-distortion)
StereoLayerComponent->SetTexture(WidgetRenderTarget);
Runtime layer toggle
The sample demonstrates switching between compositor layer and main pass rendering:
// Toggle compositor layer on/off at runtime
// When disabled, the widget renders in the main pass like standard geometry
// When enabled, the widget renders as a compositor layer (sharper, less aliasing)
StereoLayerComponent->SetVisibility(bUseCompositorLayer);
Non-quad layer shapes
Compositor layers support shapes beyond flat quads:
// Cylinder layers wrap UI around the viewer (useful for large menus)
StereoLayerComponent->SetStereoLayerShape(EStereoLayerShape::CylinderLayer);
// Equirect layers map textures to a full sphere (useful for 360° backgrounds)
StereoLayerComponent->SetStereoLayerShape(EStereoLayerShape::EquirectLayer);
Project configuration
The project uses optimized mobile VR settings:
// Key project settings:
// bStartInVR = True (launch directly into VR)
// Mobile Multi-View enabled (single-pass stereo rendering)
// MSAA 4x (anti-aliasing for mobile VR)
// Up to 16 simultaneous compositor layers supported
Extend the sample
Add interactive buttons to the compositor layer widgets using poke or ray interaction.
Experiment with cylinder layers for large curved menus or HUD elements.
Measure performance differences between compositor layer and main pass rendering.
Combine multiple compositor layers for complex UI layouts (up to 16 simultaneous layers).