@@ -15,7 +15,7 @@ Passthrough extension
1515---------------------
1616
1717OpenXR has a vendor extension for passthrough submitted by Meta.
18- Currently this extension is only supported on Quest but may be adopted by other headsets in the future.
18+ Currently this extension is only supported on Quest and PICO but may be adopted by other headsets in the future.
1919
2020:ref: `XRInterface <class_xrinterface >` has entry points for passthrough so different interfaces can implement this feature.
2121For :ref: `OpenXRInterface <class_openxrinterface >` the meta passthrough extension is implemented here.
@@ -24,9 +24,12 @@ In code you can call ``is_passthrough_supported`` to check if this extension is
2424If so you can simply enable passthrough by calling ``start_passthrough ``.
2525You can call ``stop_passthrough `` to disable passthrough.
2626
27- This will automatically set the main viewports ``transparent_bg `` property to true.
28- It will also result in the camera image being displayed as the background.
29- This will result in the background settings in the environment being ignored and alpha being applied.
27+ You do need to make sure the background is transparent.
28+ You need to enable the ``transparent_bg `` property on the viewport.
29+ Some background environment settings will still fill the background with an opaque color,
30+ you can use a ``custom color `` with a color that has alpha set to 0.
31+
32+ The OpenXR runtime will display the camera image as the background.
3033
3134.. note ::
3235
@@ -35,7 +38,7 @@ This will result in the background settings in the environment being ignored and
3538.. warning ::
3639
3740 After passthrough is enabled it is possible to change settings that will break passthrough.
38- Be sure not to change the ``transparent_bg `` setting or the environment blend mode.
41+ Be sure not to disable the ``transparent_bg `` setting or change the environment blend mode.
3942 This will result in the camera image no longer being visible but you still incur the overhead.
4043
4144 Always use ``stop_passthrough `` if you wish to turn off passthrough.
@@ -59,7 +62,7 @@ We need to check if ``XR_ENV_BLEND_MODE_ALPHA_BLEND`` is present in this list.
5962If so we can tell OpenXR to expect an image that can be alpha blended with a background.
6063To do this, we simply call ``set_environment_blend_mode(xr_interface.XR_ENV_BLEND_MODE_ALPHA_BLEND) ``.
6164
62- We must also set ``transparent_bg `` to true to ensure we submit the right image.
65+ We must also set ``transparent_bg `` to true and adjust the environment to ensure we submit the right image.
6366
6467Putting it together
6568-------------------
@@ -71,13 +74,14 @@ Putting the above together we can use the following code as a base:
7174 func enable_passthrough() -> bool:
7275 var xr_interface: XRInterface = XRServer.primary_interface
7376 if xr_interface and xr_interface.is_passthrough_supported():
74- return xr_interface.start_passthrough()
77+ if !xr_interface.start_passthrough():
78+ return false
7579 else:
7680 var modes = xr_interface.get_supported_environment_blend_modes()
7781 if xr_interface.XR_ENV_BLEND_MODE_ALPHA_BLEND in modes:
7882 xr_interface.set_environment_blend_mode(xr_interface.XR_ENV_BLEND_MODE_ALPHA_BLEND)
79- return true
8083 else:
8184 return false
8285
83-
86+ get_viewport().transparent_bg = true
87+ return true
0 commit comments