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

[DRAFT] Yet another implementation of XR_META_environment_depth (using global shader uniforms) #273

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

Conversation

dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Feb 20, 2025

This is an alternative to the existing PRs to implement XR_META_environment_depth (ex #230 and #232), with the notable advantage that I've managed to a test project successfully doing occlusion (the others don't quite make it all the way there):

com.oculus.vrshell-20250220-145856-0.mp4

(Please ignore my very messy desk :-))

The implementation works by taking the data from Meta's depth API, then stashing it in global shader uniforms, and then there is normal Godot shader that checks against that data. The shader is based on the example shader in Meta's sample project for the depth API.

However:

  • Updating global shader uniforms doesn't actually work without a small hack to Godot. Without the hack, the change to the global shader uniforms doesn't actually happen until the next frame, and at that point the depth image is no longer valid (the API gives us like a swapchain of depth images, so we have a different one each frame). See Godot PR [DRAFT] Renderer hacks to allow Meta enivornment depth API to work from GDExtension godotengine/godot#103095 for the hack
  • I'm not sure this is the best user experience we could provide for this feature, and there are other APIs which also want to do a similar thing. For example, there's folks in the community working on the same thing for ARCore, there is the "WebXR Depth Sensing Module" that I'll want to integrate eventually, not to mention that there will likely be other OpenXR depth extensions from vendors other than Meta. So, rather than re-implementing what I did here for every single one of those, I think this is something we should have support for in upstream Godot, that all the APIs can plugin into. I don't know how that should look yet, though :-)
  • My Godot hack mentioned above isn't working for Vulkan for some reason. This PR includes everything I think is necessary to make Vulkan work as well, but it isn't yet, and based on what I was seeing in RenderDoc, I think it's because my hack isn't work. I'll poke at that some more and see if I can figure it out, just so that I know what it takes to implement this, even if it'll eventually be in a different form.

(Would potentially fix #133)

@dsnopek dsnopek added the enhancement New feature or request label Feb 20, 2025
@dsnopek dsnopek added this to the 4.x milestone Feb 20, 2025
@dsnopek dsnopek force-pushed the meta-environment-depth branch 2 times, most recently from 00eb631 to 9c79963 Compare February 20, 2025 22:07
@dsnopek dsnopek force-pushed the meta-environment-depth branch from 9c79963 to d8be8a5 Compare February 20, 2025 22:10
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.

Depth API
1 participant