Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passthrough not working on Godot 4 OpenXR with a Varjo XR3 Headset #81338

Closed
hitmuri opened this issue Sep 5, 2023 · 4 comments · Fixed by #81561
Closed

Passthrough not working on Godot 4 OpenXR with a Varjo XR3 Headset #81338

hitmuri opened this issue Sep 5, 2023 · 4 comments · Fixed by #81561

Comments

@hitmuri
Copy link

hitmuri commented Sep 5, 2023

Godot version

4.1

System information

Windows 10 - Godot 4.1.1 - Compatibility

Issue description

When trying to use the Varjo XR3 headset (in OpenXR mode) with Godot 4 (with OpenXR and passthrough activated), the passthrough does not work, i.e. the scene is rendered on a black background instead of the camera stream.

It seems to me that are two problems in the openxr module, more precisely in the openx_api.cpp file (fixing them solves the issue) :

  1. The XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT is only set when the number of layers is > 1, which is fine for the Meta Quest headset but does not work for the Varjo since it only requires one layer.
  2. The environment blend mode XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND is only really set when the XRFbPassthrough extension is present, which is not the case with the Varjo runtime.

I am not sure how to fix this without causing issues for other headsets.

  1. Would it be an issue to always activate the XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT ?
  2. Could blend modes be activated even if they are not supported by an extension ?

Steps to reproduce

Minimal reproduction project

N/A

@BastiaanOlij
Copy link
Contributor

Hi @hitmuri ,

I'm missing something, enabling the passthrough system (as in enabling Metas passthrough extension) set the blend mode and indeed adds the extra layer, which is just one of the two options.

If all that is needed is to set the blend mode, than don't enable the passthrough extension, instead just set the blend mode through code (xr_interface.set_environment_blend_mode(xr_interface.XR_ENV_BLEND_MODE_ALPHA_BLEND)).
I planned adding that to the project settings as well but looks like I forgot about that.

So it's basically following https://docs.godotengine.org/en/stable/tutorials/xr/openxr_passthrough.html#passthrough-through-ar

We use this for ML2 and Lynx R1

@hitmuri
Copy link
Author

hitmuri commented Sep 11, 2023

Hi @BastiaanOlij ,

Thanks for the answer.

After checking again, it seems that the blend mode is correctly selected but that the issue comes from the layers_list.size()>0 test in the projection layer (in openxr_api.cpp), which seems to be false for the Varjo, which means that the XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT is not set.

Just removing the test fixes the passthrough rendering.

@BastiaanOlij
Copy link
Contributor

Ah, that looks like it's not respecting that setting, looks like two bits of functionality have crossed paths.

I want to make sure the settings becomes a project setting as well so you can change the default, and I'll polish that up as well.

@BastiaanOlij BastiaanOlij self-assigned this Sep 11, 2023
@hitmuri
Copy link
Author

hitmuri commented Sep 11, 2023

Great, thank you for that, and thanks for all the work on XR in Godot by the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants