Composition Layer Components
The Interaction prefab contains a Gaze Pointer prefab which makes use of Composition Layers to render content.
Gaze Pointer
The Gaze Pointer is comprised of the following GameObjects:
The XR Gaze Interactor GameObject has a Spaces Composition Layer component. This creates a Quad Layer which shows view locked content. In combination with the UI Overlay Camera GameObject this renders the gaze pointer UI element in a way that improves the stability and clarity of the pointer, at the cost of some performance.
The Spaces Composition Layer component is only supported when using OpenGLES3 as the Graphics API, and not Vulkan. The currently chosen Graphics APIs can be seen at Project Settings > Player > Other Settings > Rendering > Graphics APIs.
Layer Rendering
- Layer Texture: A render texture which will be rendered to the view locked quad layer.
- Is Texture Dynamic: The texture will be updated per frame.
Layer Positioning
- Use Transform: If checked the layer will use this object's Transform component for it's position and orientation. A Quad layer will ignore the Size and use Transform.localScale instead.
- Orientation: The orientation of the layer, relative to the view of the main camera. All layers are subject to back-face culling and any backwards oriented face will be discarded.
- Position: The position of the layer in world space coordinates.
- Sorting Order: The order in which the layer will be rendered. A lower number represents a lower layer. Layers with negative numbers will therefore be rendered 'underneath' the projection layer. Recommended for layers which will be used primarily as skyboxes such as Spherical (Equirect) or Cube. See Sorting Order.
Layer Data
- Size: Specific only to the quad layer, it represents the size of the quad layer to render in meters.
Sample Configuration
In the Snapdragon Spaces SDK samples, the view locked gaze pointer is configured as follows:
- The Spaces Composition Layer consists of a 10cm x 10cm quad layer, composited into a position 2m in front of the main camera.
- It draws the contents of the UI Overlay Render Texture into this quad.
- The contents of this image are captured by the UI Overlay Camera in its Target Texture field.
- The camera uses a Culling Mask to only capture contents in the UI Overlay layer.
- The only elements on the UI Overlay layer are the Reticle Canvas GameObject and its children.
- The Reticle Canvas has its Render Camera property set to UI Overlay Camera.
Spaces Composition Layer components can be configured with static or dynamic textures as needed. Enabling or disabling the component will hide/show the content they render.
Layer Specific Data
In addition to the Layer Rendering and Layer Positioning fields, each composition layer has its own unique layer data.
Quad
Position: As opposed to the world space placement of other layers, quad layers are positioned relative to the view of the main camera.
Cylinder
- Cylinder Radius: Non-negative radius of the layer. Zero or float.PositiveInfinity is treated as a layer with an infinite radius. A layer with an infinite radius should likely have a negative Sorting Order to be rendered before the projection layer.
- Central Angle: Visible horizontal angle of the cylinder in the range 0 -> 2𝝅. It grows symmetrically around the 0 radian angle. E.g. A layer with a central angle of 𝝅, will be projected onto the interior surface of a hemicylinder with the midpoint of the projection visible directly forward from the Position of the layer.
Spherical Equirect
- Sphere Radius: Non-negative radius of the layer. Zero or float.PositiveInfinity is treated as a layer with an infinite radius. A layer with an infinite radius should likely have a negative Sorting Order to be rendered before the projection layer.
- Central Horizontal Angle: Visible horizontal angle of the sphere in the range 0 -> 2𝝅. It grows symmetrically around the 0 radian angle. E.g. A layer with a central horizontal angle of 𝝅, will be projected onto the interior surface of a hemisphere with the midpoint of the projection visible directly forward from the Position of the layer.
- Lower Vertical Angle: Defines the lower vertical angle of the visible portion of the sphere, in the range -𝝅/2 -> 𝝅/2.
- Upper Vertical Angle: Defines the upper vertical angle of the visible portion of the sphere, in the range -𝝅/2 -> 𝝅/2.
Cube
- Cubemap Texture: Defines the Cubemap Texture to be used for the environment. The cube composition layer supports Cubemap texture resolutions up to 2048 and the RGBA 32 bit format. See Unity Cubemaps.