GodotVR / godot_openxr_vendors

Godot 4 wrapper for OpenXR vendors loaders and extensions
MIT License
90 stars 19 forks source link

Starting in Passthrough on Meta Quest #190

Closed BastiaanOlij closed 1 month ago

BastiaanOlij commented 1 month ago

When you are already in passthrough in the menu system, and start a Godot project that is an AR project, I'm encountering two issues.

The first is that the Quest will temporarily switch passthrough off during loading of the Godot project. A manifest entry is needed to keep the Quest in passthrough during loading. We can add this manifest entry based on checking the environment blend mode setting in the OpenXR project settings. If this is set to anything but Opaque we should add the following:

<!-- Enable passthrough background during the splash screen -->
<meta-data android:name="com.oculus.ossplash.background" android:value="passthrough-contextual"/>

The second is that when OpenXR starts and loads this setting, it checks if the blend mode is supported. It looks like at this point in time, our "alpha mode emulation" hasn't been checked yet and thus the setting reverts back to Opaque. You have to set it to Alpha again in code.

You can use this project to test this functionality: https://github.com/BastiaanOlij/godottoy

BastiaanOlij commented 1 month ago

cc @dsnopek

dsnopek commented 1 month ago

Thanks, I'll take a look at it!

I don't know exactly how everything relates together, but we also have OpenXRFbPassthroughExtensionWrapper::is_passthrough_preferred() (via the XR_META_passthrough_preferences extension), which is supposed to allow the OpenXR runtime to tell us if we should default to passthrough.

dsnopek commented 1 month ago

@BastiaanOlij:

The second is that when OpenXR starts and loads this setting, it checks if the blend mode is supported. It looks like at this point in time, our "alpha mode emulation" hasn't been checked yet and thus the setting reverts back to Opaque. You have to set it to Alpha again in code.

Regarding this second issue, I just posted PR https://github.com/godotengine/godot/pull/94550 for Godot to fix it!

dsnopek commented 1 month ago

@BastiaanOlij:

The first is that the Quest will temporarily switch passthrough off during loading of the Godot project. A manifest entry is needed to keep the Quest in passthrough during loading.

And PR https://github.com/GodotVR/godot_openxr_vendors/pull/194 addresses this first issue.

With both those PRs together, I can comment out the code changing the blend mode in start_vr.gd in your Godot Toy app, and it will seamlessly stay in passthrough!