Skip to content

OpenXRInterface

Inherits: XRInterface < RefCounted < Object

Our OpenXR interface.

The OpenXR interface allows Orblit to interact with OpenXR runtimes and make it possible to create XR experiences and games.

Due to the needs of OpenXR this interface works slightly different than other plugin based XR interfaces. It needs to be initialized when Orblit starts. You need to enable OpenXR, settings for this can be found in your games project settings under the XR heading. You do need to mark a viewport for use with XR in order for Orblit to know which render result should be output to the headset.

Type Name Default
float display_refresh_rate 0.0
bool foveation_dynamic false
int foveation_level 0
bool foveation_with_subsampled_images false
float render_target_size_multiplier 1.0
float vrs_min_radius 20.0
float vrs_strength 1.0
Returns Method
Array get_action_sets() const
ViewConfiguration get_active_view_configuration() const
Array get_available_display_refresh_rates() const
HandMotionRange get_motion_range(hand: Hand) const
Vector2 get_recommended_target_size() const
SessionState get_session_state()
bool is_action_set_active(name: String) const
bool is_eye_gaze_interaction_supported()
bool is_foveation_supported() const
bool is_hand_interaction_supported() const
bool is_hand_tracking_supported()
bool is_user_presence_supported() const
bool is_user_present() const
void set_action_set_active(name: String, active: bool)
void set_cpu_level(level: PerfSettingsLevel)
void set_gpu_level(level: PerfSettingsLevel)
void set_motion_range(hand: Hand, motion_range: HandMotionRange)

cpu_level_changed

cpu_level_changed(sub_domain: int, from_level: int, to_level: int)

Informs the device CPU performance level has changed in the specified subdomain.

gpu_level_changed

gpu_level_changed(sub_domain: int, from_level: int, to_level: int)

Informs the device GPU performance level has changed in the specified subdomain.

instance_exiting

instance_exiting()

Informs our OpenXR instance is exiting.

pose_recentered

pose_recentered()

Informs the user queued a recenter of the player position.

refresh_rate_changed

refresh_rate_changed(refresh_rate: float)

Informs the user the HMD refresh rate has changed.

Note: Only emitted if XR runtime supports the refresh rate extension.

session_begun

session_begun()

Informs our OpenXR session has been started.

session_focussed

session_focussed()

Informs our OpenXR session now has focus, for example output is sent to the HMD and we’re receiving XR input.

session_loss_pending

session_loss_pending()

Informs our OpenXR session is in the process of being lost.

session_stopping

session_stopping()

Informs our OpenXR session is stopping.

session_synchronized

session_synchronized()

Informs our OpenXR session has been synchronized.

session_visible

session_visible()

Informs our OpenXR session is now visible, for example output is sent to the HMD but we don’t receive XR input.

user_presence_changed

user_presence_changed(is_user_present: bool)

Signal emitted when the user presence value changes.

Note: This signal will not be emitted during application startup and application shutdown. Developers should assume user presence is gained on startup and lost on shutdown.

SessionState

enum SessionState

SESSION_STATE_UNKNOWN = 0

The state of the session is unknown, we haven’t tried setting up OpenXR yet.

SESSION_STATE_IDLE = 1

The initial state after the OpenXR session is created or after the session is destroyed.

SESSION_STATE_READY = 2

OpenXR is ready to begin our session. session_begun is emitted when we change to this state.

SESSION_STATE_SYNCHRONIZED = 3

The application has synched its frame loop with the runtime but we’re not rendering anything. session_synchronized is emitted when we change to this state.

SESSION_STATE_VISIBLE = 4

The application has synched its frame loop with the runtime and we’re rendering output to the user, however we receive no user input. session_visible is emitted when we change to this state.

Note: This is the current state just before we get the focused state, whenever the user opens a system menu, switches to another application, or takes off their headset.

SESSION_STATE_FOCUSED = 5

The application has synched its frame loop with the runtime, we’re rendering output to the user and we’re receiving XR input. session_focussed is emitted when we change to this state.

Note: This is the state OpenXR will be in when the user can fully interact with your game.

SESSION_STATE_STOPPING = 6

Our session is being stopped. session_stopping is emitted when we change to this state.

SESSION_STATE_LOSS_PENDING = 7

The session is about to be lost. session_loss_pending is emitted when we change to this state.

SESSION_STATE_EXITING = 8

The OpenXR instance is about to be destroyed and we’re exiting. instance_exiting is emitted when we change to this state.

ViewConfiguration

enum ViewConfiguration

VIEW_CONFIGURATION_MONO = 0

Our XR output configuration is monoscopic.

VIEW_CONFIGURATION_STEREO = 1

Our XR output configuration is stereoscopic.

VIEW_CONFIGURATION_STEREO_WITH_INSET = 2

Our XR output configuration is stereoscopic with an additional foveated inset render.

VIEW_CONFIGURATION_UNSET = 254

Our XR output configuration has not yet been determined.

VIEW_CONFIGURATION_UNKNOWN = 255

Our XR output configuration is unknown.

Hand

enum Hand

HAND_LEFT = 0

Left hand.

HAND_RIGHT = 1

Right hand.

HAND_MAX = 2

Maximum value for the hand enum.

HandMotionRange

enum HandMotionRange

HAND_MOTION_RANGE_UNOBSTRUCTED = 0

Full hand range, if user closes their hands, we make a full fist.

HAND_MOTION_RANGE_CONFORM_TO_CONTROLLER = 1

Conform to controller, if user closes their hands, the tracked data conforms to the shape of the controller.

HAND_MOTION_RANGE_MAX = 2

Maximum value for the motion range enum.

PerfSettingsLevel

enum PerfSettingsLevel

PERF_SETTINGS_LEVEL_POWER_SAVINGS = 0

The application has entered a non-XR section (head-locked / static screen), during which power savings are to be prioritized.

PERF_SETTINGS_LEVEL_SUSTAINED_LOW = 1

The application has entered a low and stable complexity section, during which reducing power is more important than occasional late rendering frames.

PERF_SETTINGS_LEVEL_SUSTAINED_HIGH = 2

The application has entered a high or dynamic complexity section, during which the XR Runtime strives for consistent XR compositing and frame rendering within a thermally sustainable range.

PERF_SETTINGS_LEVEL_BOOST = 3

The application has entered a section with very high complexity, during which the XR Runtime is allowed to step up beyond the thermally sustainable range.

PerfSettingsSubDomain

enum PerfSettingsSubDomain

PERF_SETTINGS_SUB_DOMAIN_COMPOSITING = 0

The compositing performance within the runtime has reached a new level.

PERF_SETTINGS_SUB_DOMAIN_RENDERING = 1

The application rendering performance has reached a new level.

PERF_SETTINGS_SUB_DOMAIN_THERMAL = 2

The temperature of the device has reached a new level.

PerfSettingsNotificationLevel

enum PerfSettingsNotificationLevel

PERF_SETTINGS_NOTIF_LEVEL_NORMAL = 0

The sub-domain has reached a level where no further actions other than currently applied are necessary.

PERF_SETTINGS_NOTIF_LEVEL_WARNING = 1

The sub-domain has reached an early warning level where the application should start proactive mitigation actions.

PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED = 2

The sub-domain has reached a critical level where the application should start drastic mitigation actions.

display_refresh_rate

float display_refresh_rate = 0.0

The display refresh rate for the current HMD. Only functional if this feature is supported by the OpenXR runtime and after the interface has been initialized.

foveation_dynamic

bool foveation_dynamic = false

If true, enables dynamic foveation adjustment. The interface must be initialized before this is accessible. If enabled, foveation will automatically be adjusted between low and foveation_level.

foveation_level

int foveation_level = 0

The foveation level, from 0 (off) to 3 (high). The interface must be initialized before this is accessible.

foveation_with_subsampled_images

bool foveation_with_subsampled_images = false

If true, enables subsampled images with foveation, which can provide a performance boost on Vulkan.

render_target_size_multiplier

float render_target_size_multiplier = 1.0

The render size multiplier for the current HMD. Must be set before the interface has been initialized.

vrs_min_radius

float vrs_min_radius = 20.0

The minimum radius around the focal point where full quality is guaranteed if VRS is used as a percentage of screen size.

Note: Mobile and Forward+ renderers only. Requires Viewport.vrs_mode to be set to Viewport.VRS_XR.

vrs_strength

float vrs_strength = 1.0

The strength used to calculate the VRS density map. The greater this value, the more noticeable VRS is. This improves performance at the cost of quality.

Note: Mobile and Forward+ renderers only. Requires Viewport.vrs_mode to be set to Viewport.VRS_XR.

get_action_sets

Array get_action_sets() const

Returns a list of action sets registered with Orblit (loaded from the action map at runtime).

get_active_view_configuration

ViewConfiguration get_active_view_configuration() const

Gets the active view configuration.

Note: This will only return a valid value after OpenXR is initialized.

get_available_display_refresh_rates

Array get_available_display_refresh_rates() const

Returns a list of display refresh rates supported by the current HMD. Only returned if this feature is supported by the OpenXR runtime and after the interface has been initialized.

get_motion_range

HandMotionRange get_motion_range(hand: Hand) const

If handtracking is enabled and motion range is supported, gets the currently configured motion range for hand.

Vector2 get_recommended_target_size() const

Returns the recommended render target size from the OpenXR runtime.

This may not match the current render target size returned by XRInterface.get_render_target_size().

get_session_state

SessionState get_session_state()

Returns the current state of our OpenXR session.

is_action_set_active

bool is_action_set_active(name: String) const

Returns true if the given action set is active.

is_eye_gaze_interaction_supported

bool is_eye_gaze_interaction_supported()

Returns the capabilities of the eye gaze interaction extension.

Note: This only returns a valid value after OpenXR has been initialized.

is_foveation_supported

bool is_foveation_supported() const

Returns true if OpenXR’s foveation extension is supported. The interface must be initialized before this returns a valid value.

Note: When using the Vulkan rendering driver, Viewport.vrs_mode must be set to Viewport.VRS_XR to support foveation.

is_hand_interaction_supported

bool is_hand_interaction_supported() const

Returns true if OpenXR’s hand interaction profile is supported and enabled.

Note: This only returns a valid value after OpenXR has been initialized.

is_hand_tracking_supported

bool is_hand_tracking_supported()

Returns true if OpenXR’s hand tracking is supported and enabled.

Note: This only returns a valid value after OpenXR has been initialized.

is_user_presence_supported

bool is_user_presence_supported() const

Returns true if OpenXR’s user presence extension is supported and enabled.

Note: This only returns a valid value after OpenXR has been initialized.

is_user_present

bool is_user_present() const

Returns true if system has detected the presence of a user in the XR experience.

set_action_set_active

void set_action_set_active(name: String, active: bool)

Sets the given action set as active or inactive.

set_cpu_level

void set_cpu_level(level: PerfSettingsLevel)

Sets the CPU performance level of the OpenXR device.

set_gpu_level

void set_gpu_level(level: PerfSettingsLevel)

Sets the GPU performance level of the OpenXR device.

set_motion_range

void set_motion_range(hand: Hand, motion_range: HandMotionRange)

If handtracking is enabled and motion range is supported, sets the currently configured motion range for hand to motion_range.