Skip to content

Commit

Permalink
Meta Quest 2 / 3 support (#219)
Browse files Browse the repository at this point in the history
* Android Support for The Mirror for Meta Quest 2/3

What does this do:
- Major engine upgrade to a much newer version of Godot Engine, with the fixes we helped with on the meta quest 3. (https://github.com/the-mirror-gdp/godot/tree/gordon/rebase-rc-2 to be merged)
- Adds performance advantages for quest2/quest3 and low end hardware.
- In theory fixes the intel crashing issues thanks to us removing our blur shader for the UI. (it was a huge performance hit)
- Allows the Game UI to be used from within VR, renders all existing UI. (Doesn't allow the build menu but this was out of scope for this work)
- Ensures the player is not visible for themselves on the local client, this will ensure no weird clipping happens.
- The mirror can run in standalone mode on the quest 2 and quest 3.
- Android doesn't flicker anymore. (Thanks to the Godot team for their amazing help ❤️) Use a spec constant to control whether the MultiMesh branch is used in the vertex shader. godotengine/godot#94289
- GameUI had to be moved to GameUI.instance as GameUI.instance is set based on if you are using VR or if you are using the Desktop UI, they are very different. GameUI.instance is useful because it ensures that you point at the correct UI and that you don't need to delete/readd the game UI, this was a major refactor and hugely painful to get working, there may be issues we do not know about without wider testing.
- Forces glow and various graphical settings off when using VR, this is because it must be disabled officially any post processing except MSAA should be disabled for VR, baring foveation and some settings under OpenXR.
- Removes the GameUI autoload and replaces it with the GameUI singleton using GameUI.instance.

This was a combination of the GodotEngine team's rendering fixes. Special thanks to them.
  • Loading branch information
RevoluPowered authored Jul 25, 2024
1 parent afe6630 commit 25d61f5
Show file tree
Hide file tree
Showing 258 changed files with 3,000 additions and 973 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/client-build-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ on:
template-download-url:
required: true
type: string
keep-openxr-binaries:
required: false
type: boolean
outputs:
url:
value: ${{ jobs.client-build-tool.outputs.url }}
Expand Down Expand Up @@ -158,6 +161,11 @@ jobs:
mv ./app-clone/mirror-godot-app/* .
ls -lah
- name: Remove VR contents if not required
if: ${{ !inputs.keep-openxr-binaries }}
run: |
rm -rf addons/godotopenxrvendors
- name: Use custom project file (required for custom splash screen)
if: ${{ inputs.custom-project-file }}
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/deployment-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
bucket-name: no-bucket
os: ${{ github.event.repository.name != 'the-mirror' && 'windows-mirror' || 'windows-latest' }}
# TODO: This will be dynamic in future and we can't do that immediately as we have to focus on the deployment side.
editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/f2020817/MirrorGodotEditorWindows.exe
template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/f2020817/windows_release_x86_64.exe
editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/35021301/MirrorGodotEditorWindows.exe
template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/35021301/windows_release_x86_64.exe
build-macos-client:
name: 🍎 Build MacOS Dev PR
uses: ./.github/workflows/client-build-tool.yml
Expand All @@ -61,8 +61,8 @@ jobs:
bucket-name: no-bucket
os: ${{ github.event.repository.name != 'the-mirror' && 'macos-mirror' || 'macos-latest' }}
# TODO: This will be dynamic in future and we can't do that immediately as we have to focus on the deployment side.
editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/f2020817/MirrorGodotEditorMac.app.zip
template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/f2020817/macos_template.app.zip
editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/35021301/MirrorGodotEditorMac.app.zip
template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/35021301/macos_template.app.zip
build-linux-client:
name: 🐧 Build Linux Dev PR
uses: ./.github/workflows/client-build-tool.yml
Expand All @@ -85,5 +85,5 @@ jobs:
bucket-name: no-bucket
os: ${{ github.event.repository.name != 'the-mirror' && 'linux-mirror' || 'ubuntu-22.04' }}
# TODO: This will be dynamic in future and we can't do that immediately as we have to focus on the deployment side.
editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/f2020817/MirrorGodotEditorLinux.x86_64
template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/f2020817/linux_release.x86_64
editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/35021301/MirrorGodotEditorLinux.x86_64
template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/35021301/linux_release.x86_64
2 changes: 1 addition & 1 deletion .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ jobs:
bucket-name: no-bucket
os: ${{ github.event.repository.name != 'the-mirror' && 'linux-mirror' || 'ubuntu-22.04' }}
editor-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/${{needs.get-or-build-engine.outputs.commit_hash}}/MirrorGodotEditorLinux.x86_64
template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/${{needs.get-or-build-engine.outputs.commit_hash}}/linux_release.x86_64
template-download-url: https://storage.googleapis.com/mirror_native_client_builds/Engine/${{needs.get-or-build-engine.outputs.commit_hash}}/linux_release.x86_64
121 changes: 120 additions & 1 deletion .github/workflows/engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ on:
self-hosted-runner:
required: true
type: boolean
deploy-to-gcp:
required: false
type: boolean
default: true
secrets:
GCP_BUCKET_UPLOAD:
required: true
required: false
outputs:
commit_hash:
value: ${{ jobs.build-windows.outputs.commit_hash }}
Expand Down Expand Up @@ -128,10 +132,12 @@ jobs:
name: ${{ matrix.artifact-name }}.exe

- uses: 'google-github-actions/auth@v2'
if: ${{ inputs.deploy-to-gcp }}
with:
credentials_json: '${{ secrets.GCP_BUCKET_UPLOAD }}'

- name: Upload binary
if: ${{ inputs.deploy-to-gcp }}
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: ./godot-engine/bin/${{ matrix.artifact-name }}.exe
Expand Down Expand Up @@ -269,10 +275,12 @@ jobs:
path: "./godot-engine/bin/${{ matrix.artifact-name }}.zip"

- uses: 'google-github-actions/auth@v2'
if: ${{ inputs.deploy-to-gcp }}
with:
credentials_json: '${{ secrets.GCP_BUCKET_UPLOAD }}'

- name: Upload binary
if: ${{ inputs.deploy-to-gcp }}
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: ./godot-engine/bin/${{ matrix.artifact-name }}.zip
Expand Down Expand Up @@ -381,10 +389,121 @@ jobs:
name: ${{ matrix.artifact-name }}

- uses: 'google-github-actions/auth@v2'
if: ${{ inputs.deploy-to-gcp }}
with:
credentials_json: '${{ secrets.GCP_BUCKET_UPLOAD }}'

- name: Upload binary
if: ${{ inputs.deploy-to-gcp }}
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: ./godot-engine/bin/${{ matrix.artifact-name }}
destination: ${{ matrix.bucket-name }}/${{steps.vars.outputs.sha_short}}/
build-android-linux:
runs-on: ${{ inputs.self-hosted-runner && 'linux-mirror' || 'ubuntu-22.04' }}
name: ${{ matrix.name }}
environment: ${{ inputs.environment }}
strategy:
fail-fast: false
matrix:
include:
- name: Android Template
cache-name: android-template
target: template_debug
strip: true
sconsflags: debug_symbols=no optimize=speed
bin: "./bin/godot.linuxbsd.template_debug.x86_64"
artifact-name: "android-template"
artifact: true
tests: no
bucket-name: mirror_native_client_builds/Engine

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Ninja 🥷
run: |
sudo apt-get install ninja-build
ninja --version
- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Check versions of the compiler
run: |
ldd --version
gcc --version
cmake --version
- name: Get short commit hash
id: vars
run: |
echo "Git hash: $(git rev-parse --short=8 HEAD)"
echo "sha_short=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT
- name: Ensuring git hash exists (or will fail job)
if: steps.vars.outputs.sha_short == ''
run: exit 1

- name: Setup Godot build cache
uses: ./godot-engine/.github/actions/godot-cache
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

- name: Setup scons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==4.4.0
scons --version
- name: Setup GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master

- name: Compilation (arm64)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} arch=arm64
platform: android
target: ${{ matrix.target }}
tests: ${{ matrix.tests }}

- name: Compilation (arm32)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} arch=arm32
platform: android
target: ${{ matrix.target }}
tests: ${{ matrix.tests }}

- name: Generate Godot templates
run: |
cd platform/android/java
./gradlew generateGodotTemplates
cd ../../..
ls -l bin/
zip -r android-template.zip bin/
- name: Upload artifact
uses: ./.github/actions/upload-artifact
if: ${{ matrix.artifact }}
with:
path: ./godot-engine/android-template.zip
name: ${{ matrix.artifact-name }}

- uses: 'google-github-actions/auth@v2'
if: ${{ inputs.deploy-to-gcp }}
with:
credentials_json: '${{ secrets.GCP_BUCKET_UPLOAD }}'

- name: Upload binary
if: ${{ inputs.deploy-to-gcp }}
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: ./godot-engine/bin/${{ matrix.artifact-name }}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ This repo is The Mirror's source code: the Godot app (client/server), the web se
1. Git clone the repository (you do **not** need to clone with submodules; they are optional)
2. Download the precompiled Mirror fork of Godot engine (required to use)

- Windows: [Download](https://storage.googleapis.com/mirror_native_client_builds/Engine/f2020817/MirrorGodotEditorWindows.exe)
- Mac: **v buggy**; taking contributions for fixes :) [Download](https://storage.googleapis.com/mirror_native_client_builds/Engine/f2020817/MirrorGodotEditorMac.app.zip). On Mac you will see a zip file; extract it and open the editor binary with CMD + Right-Click then select the Open option.
- Linux: [Download](https://storage.googleapis.com/mirror_native_client_builds/Engine/f2020817/MirrorGodotEditorLinux.x86_64)
- Windows: [Download](https://storage.googleapis.com/mirror_native_client_builds/Engine/35021301/MirrorGodotEditorWindows.exe)
- Mac: **v buggy**; taking contributions for fixes :) [Download](https://storage.googleapis.com/mirror_native_client_builds/Engine/35021301/MirrorGodotEditorMac.app.zip). On Mac you will see a zip file; extract it and open the editor binary with CMD + Right-Click then select the Open option.
- Linux: [Download](https://storage.googleapis.com/mirror_native_client_builds/Engine/35021301/MirrorGodotEditorLinux.x86_64)

1. Open the Godot editor (The Mirror fork), click import, and choose the `project.godot` from the `/mirror-godot-app` folder.
Note that if you see this popup, you can safely ignore it and proceed.
Expand Down
2 changes: 1 addition & 1 deletion mirror-docs/.github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
- name: 'Output Step'
env:
NEW_TAG: ${{ steps.version-bump.outputs.newTag }}
run: echo "new tag $NEW_TAG"
run: echo "new tag $NEW_TAG"
5 changes: 5 additions & 0 deletions mirror-godot-app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ node_modules

# Voxel terrain
voxels.db

# Fix broken files from being checked into the repo
# caused by the openxr modules
~*.dll
*.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ func _export_end() -> void:
print("finished export - making cicd specific binaries")
assert(not _path.is_empty())
assert(not _features.is_empty())
if _export_platform.is_empty():
if _export_platform.is_empty() or _export_platform == "android":
return
print("Export platform: ", _export_platform)
# We compress platforms we support, but not game server builds
# The game server builds are a special case and are uploaded in two files.
# They are uncompressed to gcp.
build_single_platform_for_distribution(_export_platform, _path)
print("Finished Exporting the compressed builds")


static func _get_platform_name(platform: EditorExportPlatform) -> String:
Expand All @@ -48,6 +50,8 @@ static func _get_platform_name(platform: EditorExportPlatform) -> String:
return "windows"
elif platform is EditorExportPlatformMacOS:
return "macos"
elif platform is EditorExportPlatformAndroid:
return "android"
return ""


Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions mirror-godot-app/addons/godotopenxrvendors/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore copies of the binaries Godot makes at startup
.bin/windows/*/*/~*.dll
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Change history for the Godot OpenXR loaders asset

## 3.0.0
- Merge GDExtension into a single implementation
- Upgrade Android, Gradle, Godot and Kotlin dependencies
- Add XR_FB_face_tracking support
- Update to OpenXR 1.0.34 headers
- Add XR_FB_render_model extension wrapper and OpenXRFBRenderModel node
- Add XR_FB_passthrough extension wrapper
- Add XR_FB_hand_tracking_mesh extension wrapper and OpenXRFbHandTrackingMesh node
- Add XR_FB_hand_tracking_aim support
- Update Meta OpenXR mobile SDK to version 62
- Add a developer-facing API for interacting with scene anchors
- Add support for developer-created spatial anchors via XR_FB_spatial_entity
- Add XR_FB_hand_tracking_capsules extension wrapper
- Add OpenXRFbPassthroughGeometry node
- Add OpenXRMetaPassthroughColorLut
- Add feature flags to Khronos loader for HTC
- Add XR_HTC_passthrough extension wrapper
- Add manifest entries to Pico and switch Pico to using the Khronos Loader

## 2.0.3
- Migrate the export scripts from gdscript to C++ via gdextension
- Manually request eye tracking permission if it's included in the app manifest
- Change how singletons are accessed
- Fix the plugin version for the export plugins
- Add OpenXR extension wrappers for fb_scene, fb_spatial_entity, fb_spatial_entity_query, fb_spatial_entity_container

## 2.0.0
- Update to the new Godot 4.2 Android plugin packaging format
- Update the plugin to Godot v2 Android plugin
- Update to the Godot 4.2 Android library
- Add warning when multiple loaders are selected
- Add configs for the OpenXR Eye gaze interaction extension
- Add the ability to customize supported Meta devices
- Add support for Quest 3 devices
- Update the directory structure for the v2 plugin
- Update Meta OpenXR mobile SDK to version 57
- Update the java version to 17
- Rename the plugin to 'Godot OpenXR Vendors'
- Add godot-cpp dependency
- Add OpenXR 1.0.30 headers
- Add support for the Meta scene capture API (Donated by [Migeran](https://migeran.com))

## 1.1.0
- Update Meta OpenXR loader to version 54
- Update PICO OpenXR loader to version 2.2.0
- Bump dependencies versions to match the latest Godot 4.x stable version (v4.0.3)

## 1.0.0
- First version
- Added support for Meta Quest loader
- Added support for Pico loader
- Added support for Khronos loader (Magic Leap 2, HTC, etc.)
- Added support for Lynx loader
- Add logic to automatically publish the Godot OpenXR loaders libraries to mavencentral on release
Loading

0 comments on commit 25d61f5

Please sign in to comment.