# 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.
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. 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.
# 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.
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.
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.