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] Implement XR_FB_space_warp extension #222

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

Conversation

devloglogan
Copy link
Collaborator

@devloglogan devloglogan commented Oct 25, 2024

Adds an extension wrapper implementation of XR_FB_space_warp.

Setup

In order to test AppSW out (compatibility renderer only at the moment):

Then you should be able to build the plugin like normal. Currently in this PR, AppSW is enabled by default, so no need to enable it.

Debug View

UPDATED (2024-11-5): I've added a new Meta Space Warp sample project to this PR, feel free to use that for testing.

I've (minimally) added multiple scenarios of moving elements in the demo project (particles/multimesh/skeleton) for testing purposes. If you'd like a visual of the underlying motion vectors that are generated, you can use the following adb command.

adb shell setprop debug.oculus.spaceWarpDebug 1 && adb shell setprop debug.oculus.MVOverlay 4 && adb shell setprop debug.oculus.MVOverlay.Alpha 0.8 && adb shell input keyevent "KEYCODE_POWER" && adb shell input keyevent "KEYCODE_POWER"

Sometimes I find the project crashes when running the above command, but the debug view is visible upon restarting the app. To exit this view mode you can run:

adb shell setprop debug.oculus.spaceWarpDebug 0 && adb shell input keyevent "KEYCODE_POWER" && adb shell input keyevent "KEYCODE_POWER"

To Do

UPDATED (2024-11-5): These have all been completed.

  • Account for locomotion by properly setting appSpaceDeltaPose.
  • Enable the use of the XR_COMPOSITION_LAYER_SPACE_WARP_INFO_FRAME_SKIP_BIT_FB flag to skip frames of spacewarp.
  • Have the extension not enabled by default, and determine the best way for users to enable/disable it.

Copy link
Collaborator

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is looking great so far!

Some additional notes about the demo

  • I think this should get it's own sample rather than modifying the main "demo" project
  • There is no plain MeshInstance3D moving, only the more advanced cases. We should have the simplest case shown too
  • Having a button to enable/disable AppSW would be nice
  • I think we should add a plane with a very busy texture (plaid?) behind all the moving objects to make the artifacts more obvious

@devloglogan
Copy link
Collaborator Author

@dsnopek I'd done the previous XR sample projects as their own PRs following the merging of the corresponding extensions. I had planned to just keep the simple test scene in the demo project while this PR remained as a draft. I see nothing wrong with expanding on it and just adding an XR sample project to this PR as well though! I will do that.

@devloglogan devloglogan force-pushed the fb-space-warp branch 3 times, most recently from 4b64881 to a9620f2 Compare November 4, 2024 17:54
@devloglogan devloglogan force-pushed the fb-space-warp branch 3 times, most recently from ae73152 to ad2b8fa Compare November 5, 2024 21:42
@devloglogan
Copy link
Collaborator Author

I've added a fair amount of updates:

  • Moved the test scene into its own "Meta Space Warp" sample project, included in this PR.
    • Added a normal, moving MeshInstance3D to the scene
    • Space warp can now be enabled/disabled by pressing the A button.
    • Added movement/turning with the analog sticks.
    • Added a CC0 grass texture behind moving objects so users can see space warp artifacts more easily.
  • Added a project setting for enabling space warp.
  • Space warp is now automatically disabled if a non-opengl renderer is being used.
  • Added a skip_space_warp_frame() function to skip space warp for the following frame.
  • I believe I'm now accounting for locomotion correctly in appSpaceDeltaPose.

I will open this PR once godotengine/godot#97151 is merged!

Copy link
Collaborator

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

This is starting to look really good! I especially like all the changes to the sample project - it'll make it very easy for developers to see the sort of artifacts that AppSW can generate, and seeing them also helps us confirm that things are doing what we would expect :-)

@devloglogan devloglogan force-pushed the fb-space-warp branch 2 times, most recently from a21de58 to b0d49cd Compare November 6, 2024 19:49
Comment on lines +232 to +234
void OpenXRFbSpaceWarpExtensionWrapper::set_space_warp_enabled(bool p_enable) {
enabled = p_enable;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a use-case for this setter, given space warp can also be enabled via the project settings?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. There may be whole parts of the game where you do or don't want to use space warp. For example, in menus or other non-performance intensive areas, you may want to leave it off, and only turn it on when you enter real gameplay.

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.

3 participants