Table of Contents

Class OpenXRCompositionLayer

Namespace
Godot
Assembly
GodotSharp.dll

Composition layers allow 2D viewports to be displayed inside of the headset by the XR compositor through special projections that retain their quality. This allows for rendering clear text while keeping the layer at a native resolution.

Note: If the OpenXR runtime doesn't support the given composition layer type, a fallback mesh can be generated with a ViewportTexture, in order to emulate the composition layer.

public class OpenXRCompositionLayer : Node3D, IDisposable
Inheritance
OpenXRCompositionLayer
Implements
Derived
Inherited Members

Properties

AlphaBlend

Enables the blending the layer using its alpha channel.

Can be combined with TransparentBg to give the layer a transparent background.

public bool AlphaBlend { get; set; }

Property Value

bool

EnableHolePunch

Enables a technique called "hole punching", which allows putting the composition layer behind the main projection layer (i.e. setting SortOrder to a negative value) while "punching a hole" through everything rendered by Godot so that the layer is still visible.

This can be used to create the illusion that the composition layer exists in the same 3D space as everything rendered by Godot, allowing objects to appear to pass both behind or in front of the composition layer.

public bool EnableHolePunch { get; set; }

Property Value

bool

LayerViewport

The SubViewport to render on the composition layer.

public SubViewport LayerViewport { get; set; }

Property Value

SubViewport

SortOrder

The sort order for this composition layer. Higher numbers will be shown in front of lower numbers.

Note: This will have no effect if a fallback mesh is being used.

public int SortOrder { get; set; }

Property Value

int

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

IntersectsRay(Vector3, Vector3)

Returns UV coordinates where the given ray intersects with the composition layer. origin and direction must be in global space.

Returns Vector2(-1.0, -1.0) if the ray doesn't intersect.

public Vector2 IntersectsRay(Vector3 origin, Vector3 direction)

Parameters

origin Vector3
direction Vector3

Returns

Vector2

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsNativelySupported()

Returns true if the OpenXR runtime natively supports this composition layer type.

Note: This will only return an accurate result after the OpenXR session has started.

public bool IsNativelySupported()

Returns

bool