Skip to main content
Version: 1.0

Composition Layers

When presenting rendered images to the user it is sometimes desirable to separate elements of the scene into different layers. Each of these layers can be rendered individually and then composited together to form the final scene. This can help to improve the stability and quality of each rendered layer at the cost of some performance.

These layers are referred to as Composition Layers. The Snapdragon Spaces SDK allows developers to access different types of composition layers. These types are briefly summarised here. Additional details can be found in engine specific documentation.

SUPPORTED RENDERERS

Not all layers described here are supported for all rendering APIs (OpenGLES, Vulkan, etc.). See any engine specific documentation for further details.

Layer Types

Projection Layer

A projection layer represents planar projected images rendered from each eye using a perspective projection. This is most often used to render the virtual world from the user's point of view. A projection layer is created automatically from the perspective of the main camera and rendered to the XR headset. No action is needed to render this automatically generated projection layer. The projection layer's default Sorting Order is set to 0. Layers with a negative sorting order will be rendered underneath the projection layer and layers with a positive sorting order will be rendered over the projection layer. It is recommended to explicitly order layers for best results. It is not yet possible to submit additional projection layers.

Quad Layer

Quad layers are useful for displaying user interface elements or 2D content rendered into the virtual world. A quad layer is only visible from the front, and has no thickness.

Cube Layer

A cube layer is a representation of an environment texture (cube map) that is projected onto the interior faces of a cube. To not conceal the projection layer, the cube layer must have a lower Sorting Order.

Cylinder Layer

A cylinder layer projects a texture onto the interior of a cylindrical surface. They are useful for displaying curved content and UI interfaces. When used with an infinite radius, it is recommended to use a negative Sorting Order to not conceal the projection layer.

Spherical Equirect Layer

The spherical equirect layer represents an equirectangular texture that will be projected onto the interior surface of a sphere. They are typically used to display panoramic or 360-degree content. When used with an infinite radius, it is recommended to use a negative Sorting Order to not conceal the projection layer.

Depth Layer

A depth layer contains the data needed to match depth information to the color information of the final image. Depth images are only submitted alongside projection layers.

VR ONLY

Depth submission is only supported on selected VR hardware. In Unity, depth layers can be enabled by opening Project Settings > XR Plug-in Management > OpenXR and selecting a Depth Submission Mode of Depth 16 Bit or Depth 24 Bit. Depth images corresponding to the default projection layer are then automatically generated and submitted with no further action required by the developer.

Sorting Order

All composition layers are sorted and rendered with a "painter's algorithm" where lower layers are rendered first and higher layers are rendered over them.

Number of Layers

A maximum of 16 composition layers can be used. This total includes the default projection layer responsible for rendering the content from the main camera - a real count of 1 + 15 additional composition layers. Each layer used incurs additional performance overhead. If the maximum number of layers is ever exceeded, the highest layers will not be rendered.

tip

Use as few layers as possible for the best performance.

Layer Dimensions

The maximum allowed dimensions of a composition layer is determined by hardware, but dimensions of up to 16k textures should be generally supported.