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

Have OpenXR create a depth texture swapchain #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BastiaanOlij
Copy link
Member

This PR adds support for creating a depth texture swapchain and supplies the correct depth texture to Godot so Godot uses it to render the depth buffer into.

This depth texture is then supplied to OpenXR. OpenXR can use this for advanced reprojection and for tools like LIV.

This needs thorough testing, on face value it seems to work but as it's a big structural change, best to make sure this works on all platforms first.

@BastiaanOlij BastiaanOlij added the enhancement New feature or request label Mar 1, 2022
@BastiaanOlij BastiaanOlij added this to the 1.3.0 milestone Mar 1, 2022
@BastiaanOlij BastiaanOlij self-assigned this Mar 1, 2022
@BastiaanOlij BastiaanOlij force-pushed the add_depth_buffer branch 2 times, most recently from 51a2c7c to 84f9e2a Compare March 1, 2022 05:22
src/openxr/OpenXRApi.cpp Outdated Show resolved Hide resolved
src/openxr/OpenXRApi.cpp Outdated Show resolved Hide resolved
src/openxr/OpenXRApi.cpp Outdated Show resolved Hide resolved
@BastiaanOlij
Copy link
Member Author

Ok, with @ChristophHaag fixes added in it looks like its now submitting the depth buffer properly but for me in SteamVR the re-projection screws up, it's like it's trying to reproject into the wrong direction

@BastiaanOlij BastiaanOlij force-pushed the add_depth_buffer branch 2 times, most recently from dce0ccf to 47333f4 Compare March 3, 2022 01:10
@BastiaanOlij BastiaanOlij marked this pull request as draft March 3, 2022 09:12
@BastiaanOlij
Copy link
Member Author

Even though this pretty much works and is ready to merge I've changed this back to a draft PR for two reasons:

  1. At the moment this is broken on SteamVR, I've added a test for that to disable it but we may want to postpone merging this until we are sure this is indeed the issue and Valve lets us know its fixed
  2. I think the way we change our framebuffer in Godot core is causing a performance hit, I'm going to work on a PR to fix that

@BastiaanOlij
Copy link
Member Author

Reminder to myself, need to check XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME and only add the depth layers if it's supported.

@BastiaanOlij BastiaanOlij force-pushed the add_depth_buffer branch 5 times, most recently from a308979 to 5dd1632 Compare March 5, 2022 07:58
@BastiaanOlij
Copy link
Member Author

Reminder to myself, need to check XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME and only add the depth layers if it's supported.

@m4gr3d @ChristophHaag I'm now checking if this extension is available and too my surprise it's not available on Quest? Might only be available on Quest 2? It is available on the Oculus desktop runtime.

@BastiaanOlij BastiaanOlij marked this pull request as ready for review March 5, 2022 08:13
@BastiaanOlij
Copy link
Member Author

I've put this back to ready for testing, it now properly checks for the extension and I think the code in the plugin itself is fine. Further testing on the performance hit, I think my computer just needed a restart or it may have been the buggy code in SteamVR itself. I can't find any noticable performance difference running with and without the depth buffer logic on when running on the Oculus Runtime.

@m4gr3d
Copy link
Collaborator

m4gr3d commented Mar 7, 2022

Reminder to myself, need to check XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME and only add the depth layers if it's supported.

@m4gr3d @ChristophHaag I'm now checking if this extension is available and too my surprise it's not available on Quest? Might only be available on Quest 2? It is available on the Oculus desktop runtime.

@BastiaanOlij I don't think the Quest (Oculus mobile runtime) supports depth based reprojection. The closest equivalent would be spacewarp which has its own XR_FB_space_warp extension.

@BastiaanOlij
Copy link
Member Author

@m4gr3d in due time we'll need to make it so that we have this solution active once we fully support spacewarp though that will likely be a Godot 4 feature as there are no plans that I am aware off of adding motion vectors to Godot 3.

Bit of a shame that they're not sticking to the standard though, I get that they need their own extension to submit the motion vector buffer but it would make sense if they had implemented submitting the depth buffer according to the existing API.

Alas, standards are made to be broken I guess :)

@BastiaanOlij
Copy link
Member Author

Ok, I think I've taken this as far as I can for now, we could merge it in just so all the code is there.

For SteamVR we'll remove the check once I get confirmation the issue on their end is resolved. Valve don't use the depth buffer themselves but they do send it on to the Oculus runtime, so it is strange it stops their platform from working properly.

Once we have something for motion vectors we can add spacewarp support (again possibly not until Godot 4) and tie into the depth buffer code here.

@BastiaanOlij BastiaanOlij modified the milestones: 1.3.0, 1.4.0 Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants