OpenXRFbPassthroughExtensionWrapper

Inherits: OpenXRExtensionWrapperExtension

Wraps XR_FB_passthrough and related extensions.

Description

Wraps the following OpenXR extensions:

  • XR_FB_passthrough

  • XR_FB_triangle_mesh

  • XR_META_passthrough_preferences

  • XR_META_passthrough_color_lut

Only the main XR_FB_passthrough extension is required for basic passthrough functionality. The others allow for more complex features, such as filtering the passthrough output or using an OpenXRFbPassthroughGeometry node to control where passthrough is rendered. Settings for features unsupported by the current OpenXR runtime or headset will be ignored.

Passthrough will start automatically when XRInterface.environment_blend_mode is set to XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND, and will automatically stop when set to any other value.

Methods

LayerPurpose

get_current_layer_purpose ( )

PassthroughFilter

get_current_passthrough_filter ( )

Color

get_edge_color ( )

int

get_max_color_lut_resolution ( )

float

get_texture_opacity_factor ( )

bool

has_color_passthrough_capability ( )

bool

has_layer_depth_passthrough_capability ( )

bool

has_passthrough_capability ( )

bool

is_passthrough_preferred ( )

bool

is_passthrough_started ( )

bool

is_passthrough_supported ( )

void

set_brightness_contrast_saturation ( float brightness, float contrast, float saturation )

void

set_color_lut ( float weight, OpenXRMetaPassthroughColorLut color_lut )

void

set_color_map ( Gradient gradient )

void

set_edge_color ( Color color )

void

set_interpolated_color_lut ( float weight, OpenXRMetaPassthroughColorLut source_color_lut, OpenXRMetaPassthroughColorLut target_color_lut )

void

set_mono_map ( Curve curve )

void

set_passthrough_filter ( PassthroughFilter filter )

void

set_texture_opacity_factor ( float value )


Signals

openxr_fb_passthrough_state_changed ( int event_type )

Emitted when the passthrough state has changed.


openxr_fb_passthrough_stopped ( )

Emitted when passthrough has stopped.


openxr_fb_projected_passthrough_layer_created ( )

Emitted when a projected passthrough layer has been created.


Enumerations

enum LayerPurpose:

LayerPurpose LAYER_PURPOSE_NONE = -1

Passthrough layer is disabled.

LayerPurpose LAYER_PURPOSE_RECONSTRUCTION = 0

Full environment is presented on the passthrough layer.

LayerPurpose LAYER_PURPOSE_PROJECTED = 1

Passthrough is projected on custom geometry and presented on the passthrough layer.


enum PassthroughFilter:

PassthroughFilter PASSTHROUGH_FILTER_DISABLED = 0

Passthrough filter is disabled.

PassthroughFilter PASSTHROUGH_FILTER_COLOR_MAP = 1

Filter passthrough using a color map. See set_color_map.

PassthroughFilter PASSTHROUGH_FILTER_MONO_MAP = 2

Filter passthrough using a mono map. See set_mono_map.

PassthroughFilter PASSTHROUGH_FILTER_BRIGHTNESS_CONTRAST_SATURATION = 3

Filter passthrough using brightness, contrast and saturation. See set_brightness_contrast_saturation.

PassthroughFilter PASSTHROUGH_FILTER_COLOR_MAP_LUT = 4

Filter passthrough using a color LUT (Look Up Table). See set_color_lut.

PassthroughFilter PASSTHROUGH_FILTER_COLOR_MAP_INTERPOLATED_LUT = 5

Filter passthrough using an interpolated color LUT (Look Up Table). See set_interpolated_color_lut.


enum PassthroughStateChangedEvent:

PassthroughStateChangedEvent PASSTHROUGH_ERROR_NON_RECOVERABLE = 0

A non-recoverable error has occurred. A device reboot or firmware update may be required.

PassthroughStateChangedEvent PASSTHROUGH_ERROR_RECOVERABLE = 1

A recoverable error has occurred. The OpenXR runtime will attempt to recover, but some functionality may be temporarily unavailable.

PassthroughStateChangedEvent PASSTHROUGH_ERROR_RESTORED = 2

The runtime has recovered from a previous error and is functioning normally.


Method Descriptions

LayerPurpose get_current_layer_purpose ( )

Gets the current passthrough layer purpose.


PassthroughFilter get_current_passthrough_filter ( )

Gets the current passthrough filter.


Color get_edge_color ( )

Gets the color to be drawn on top of edges that are detected in the original passthrough imagery.

Edge rendering is disabled when the alpha value of the color is zero.


int get_max_color_lut_resolution ( )

Gets the maximum allowed resolution for color LUTs (Look Up Tables).

See set_color_lut and set_interpolated_color_lut.


float get_texture_opacity_factor ( )

Set the opacity of the passthrough imagery between 0.0 and 1.0.


bool has_color_passthrough_capability ( )

Returns true if the headset supports color passthrough; otherwise false, if only monochrome passthrough is supported.

This is only valid if has_passthrough_capability returns true.


bool has_layer_depth_passthrough_capability ( )

Returns true if the headset supports passthrough layers composited using depth testing; otherwise false.

This is only valid if has_passthrough_capability returns true.


bool has_passthrough_capability ( )

Returns true if the OpenXR runtime can give us extended information about passthrough capability via the has_color_passthrough_capability or has_layer_depth_passthrough_capability methods.

If this method returns false, don't trust the return value of those methods.


bool is_passthrough_preferred ( )

Returns true if the OpenXR runtime recommends that the app start in passthrough mode (if supported); otherwise false.

While this recommendation is platform dependent, it may, for example, return true if the user was already in passthrough when they opened the app, in order to prevent the user switching from passthrough, to full VR, and back to passthrough again.


bool is_passthrough_started ( )

Checks if passthrough has been started.


bool is_passthrough_supported ( )

Checks if passthrough is supported.


void set_brightness_contrast_saturation ( float brightness, float contrast, float saturation )

Sets the current passthrough filter to PASSTHROUGH_FILTER_BRIGHTNESS_CONTRAST_SATURATION, which will adjust the brightness, contrast and saturation of the passthrough imagery.

  • brightness: brightness adjustment value in the range -100 to 100. The neutral value is 0.

  • contrast: contrast adjustment value which must be greater than 0. The neutral value is 1.0.

  • saturation: saturation adjustment value which must be greater than 0. The neutral value is 1.0.

Note: Only one passthrough filter can be enabled at a time.


void set_color_lut ( float weight, OpenXRMetaPassthroughColorLut color_lut )

Sets the current passthrough filter to PASSTHROUGH_FILTER_COLOR_MAP_LUT, which will use the OpenXRMetaPassthroughColorLut to map from the colors in the passthrough imagery into colors from the LUT (Look Up Table).

The weight is a value between 0.0 and 1.0, which can be used to blend linearly between the original colors and the mapped colors.

Note: Only one passthrough filter can be enabled at a time.


void set_color_map ( Gradient gradient )

Sets the current passthrough filter to PASSTHROUGH_FILTER_COLOR_MAP, which will use the given gradient to replace each input luminance value in the passthrough imagery with an RGBA color value.

Note: Only one passthrough filter can be enabled at a time.


void set_edge_color ( Color color )

Sets a color to be drawn on top of edges that are detected in the original passthrough imagery.

Edge rendering is disabled when the alpha value of the color is zero.


void set_interpolated_color_lut ( float weight, OpenXRMetaPassthroughColorLut source_color_lut, OpenXRMetaPassthroughColorLut target_color_lut )

Sets the current passthrough filter to PASSTHROUGH_FILTER_COLOR_MAP_INTERPOLATED_LUT, which will use the given OpenXRMetaPassthroughColorLut objects to map from the colors in the passthrough imagery into colors interpolated between the two LUTs (Look Up Tables).

The weight is a value between 0.0 and 1.0, which can be used to blend linearly between the colors from the two OpenXRMetaPassthroughColorLut objects. This can be used to smoothly transition from using one OpenXRMetaPassthroughColorLut to another.

Note: Only one passthrough filter can be enabled at a time.


void set_mono_map ( Curve curve )

Sets the current passthrough filter to PASSTHROUGH_FILTER_MONO_MAP, which will use the given curve to replace each input luminance value in the passthrough imagery with a grayscale color value.

Note: Only one passthrough filter can be enabled at a time.


void set_passthrough_filter ( PassthroughFilter filter )

Sets the current passthrough filter.

The filter type can also be changed by calling any of the following methods:

However, the only way to disable the passthrough filter is by calling this method with PASSTHROUGH_FILTER_DISABLED.


void set_texture_opacity_factor ( float value )

Set the opacity of the passthrough imagery between 0.0 and 1.0.