-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
OpenXR: Use the XR_FB_foveation_vulkan
extension to get the density map for VRS
#99768
base: master
Are you sure you want to change the base?
OpenXR: Use the XR_FB_foveation_vulkan
extension to get the density map for VRS
#99768
Conversation
I'm really on the fence about this one. Was just talking to @DarioSamo about density maps in general, what my ideas are for improving what we have right now, and if we do this right, our build in solution will be as good as, if not better than what is on offer here. And it works on any platform (well currently any Vulkan based platform). So far the feedback I've gotten talking to people in the know, most game engines have already solved this the same way we have, with their own logic for generating density maps, because they ran into the same problems we did with what OpenXR offers. Most vendors this don't have a need to supporting something in the runtime. Especially when looking at PCVR vendors who are dealing with a wide hardware spectrum. That is not to say that in some point in the future we will see a vendor neutral extension for this but thats a big unknown. So doing structural changes to our rendering engine to support an edge case currently only supported by Meta, and potentially not something that will be introduced by others, while we already have a viable solution that we can improve open is.. uhm.. Meh.. The other thing that is a potential problem here, is that the density map has to be adjusted to the resolution at which we're rendering, and since we're allowing that to be overridden, we might not be getting a density map at the right size. |
I think there's a few advantages to using the density map from OpenXR:
So, I'd really like to be able to have the option to let the OpenXR runtime generate the density map! I'm not crazy about my implementation so far, because it couples a whole bunch of things that I don't want coupled, but that's hopefully something I can work out before taking this out of draft. |
A point I forgot to respond to in my last comment:
We shouldn't have to make any structural changes to the renderer to do this! All the rendering changes in my commit on this PR are just temporary hacks in order to test this - it's only a draft :-) In the end, I expect all changes for this to be in the "openxr" module. The renderer is already calling |
@dsnopek the problem is, the solution Dario and I were discussing tonight kind of changes things a lot. What we're thinking of is to leave providing a texture for non XR usage only, and instead provide eye center and radius data if XR_VRS is specified, and generating the density map in the shader that is currently in the rendering engine (and eventually move that into the rendering driver so that we're independent of hardware/GPU architecture). This removes a bunch of overhead and solves a bunch of problems with an externally supplied density map not matching our further rendering settings. It's not a big step to make the density map adjust based on frame timing. I do hear what you're saying, but many of those issues are because we need to improve our implementation, and so far its just not gotten the attention it deserves. Solving that properly means that we have a good solution for all platforms, and seeing this extension does not seem to be getting wide adoption, we're going to have to do that anyway. My only concern is that right now, there is no proper extension in OpenXR that allows us to get usable eye tracking data, so supporting eye tracked foveated rendering alongside fixed foveated rendering is a problem. We're using the eye gaze extension which is not really suitable for this. |
c646106
to
177d119
Compare
XR_FB_foveation_vulkan
extension to generate the density map for VRSXR_FB_foveation_vulkan
extension to get the density map for VRS
d665edb
to
7f9324e
Compare
Previously, this PR just hacked the renderer to use the FDM from OpenXR. I've just updated it into a non-hacky form, that will hopefully be an acceptable approach - details are added to the PR description. (I'm going to wait until either PR #99551 is merged or rebased to deal with the merge conflicts - they shouldn't be a big deal, but I don't want to diverge from that PR, so it's easy to update for any changes) |
7f9324e
to
e9abe8d
Compare
XR_FB_foveation_vulkan
extension to get the density map for VRSXR_FB_foveation_vulkan
extension to get the density map for VRS
I'm pretty sure we already talked about this outside of GitHub some months ago, but posting here so it's visible on GitHub: I don't think the changes here would impact implementing what you describe above. In the end, there are two paths that can happen: (1) Godot generates the FDM via some shader (whether that's based on a texture or input like eye center and radius), or (2) Godot grabs an already made FDM from And discussed above, I think there are a number of advantages of having path nr 2 be an option (and it is an option, if developers don't set |
Now that PR #99551 is merged, I'm finally taking this one out of DRAFT! |
677218b
to
bf99c4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some notes in ProjectSettings.xml
for Foveation Level / Foveation Dynamic that say they only work for the Compatibility renderer.
bf99c4f
to
7d91d37
Compare
Thanks! I removed the notes that said the foveation settings only work on the compatibility renderer in my latest push |
7d91d37
to
76af8c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some other minor things but otherwise I think the XR code is looking good! I tested the changes out locally on my Quest 3 and even took a look at the different textures in renderdoc and it worked/looked as I expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OpenXR code looks good.
76af8c5
to
b9294f9
Compare
b9294f9
to
79f5a4d
Compare
This builds on top of PR #99551 and is consequently marked as a DRAFT until it can be merged
But instead of manually building the density map, it uses the
XR_FB_foveation_vulkan
extension to get the density map from the OpenXR runtime.So, you can use the same foveation settings that are currently used for OpenGL (setting the "Foveation Level" or "Foveation Dynamic"), and that should get used by the OpenXR runtime in order to build the density map that we're using.
In order to do that, it adds
XRInterface::get_vrs_texture_format()
which the interface can return any of these:XR_VRS_TEXTURE_FORMAT_UNIFIED
: This meansXRInterface::get_vrs_texture()
uses the same format as previously, and it doesn't matter whether or not the underlying mechanism is FDM or FSR, it runs through the shader and is converted to the right format. I'm open to renaming this!XR_VRS_TEXTURE_FORMAT_FRAGMENT_SHADING_RATE
: The VRS texture is in the format expected by fragment shading rate. I don't know that we'll ever use it this, but it's here for completenessXR_VRS_TEXTURE_FORMAT_FRAGMENT_DENSITY_MAP
: The VRS texture is in the format expected by fragment density map, which is whatXR_FB_foveation_vulkan
will give usIf
XR_FB_foveation_vulkan
isn't supported, then theOpenXRInterface
will fallback on the original "unified" texture that is generated within Godot, so VRS will continue to work as it has for any OpenXR runtime that doesn't support this extension.