|
| 1 | +# OpenXR Passthrough Demo |
| 2 | + |
| 3 | +This is a demo showing OpenXR's passthrough functionality |
| 4 | + |
| 5 | +Language: GDScript |
| 6 | + |
| 7 | +Renderer: Compatibility |
| 8 | + |
| 9 | +> [!NOTE] |
| 10 | +> |
| 11 | +> This demo requires Godot 4.5 or later |
| 12 | +
|
| 13 | +## Screenshots |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +## How does it work? |
| 18 | + |
| 19 | +Passthrough is a feature available on a number of XR headsets. |
| 20 | +It uses the cameras on the device to show the real world inside of the headset. |
| 21 | + |
| 22 | +This demo shows how to correctly set up passthrough. |
| 23 | +While the demo will attempt to start in passthrough mode (see the OpenXR Project settings), |
| 24 | +there are extra steps to perform that you will find in `main.gd`. |
| 25 | +The most important being enabling the viewport's transparent background feature. |
| 26 | + |
| 27 | +Note that the environment is also set up to use the sky for ambient color and reflections, |
| 28 | +even after the background has been made transparent. |
| 29 | +While not part of this demo, |
| 30 | +this allows for accurate light estimation in headsets that support this feature. |
| 31 | + |
| 32 | +Finally there is an example of using the `shadow_to_opacity` feature to cut out |
| 33 | +a box shape. |
| 34 | +A use case for this is allowing the user to anchor that box where their keyboard |
| 35 | +is positioned, and in doing so keeping the keyboard visible to the user. |
| 36 | +You can only see the effect properly in headset as the editor viewport does not |
| 37 | +enable a transparent background. |
| 38 | + |
| 39 | +> [!IMPORTANT] |
| 40 | +> In order to save space in this repo, the OpenXR Vendor plugin is not included |
| 41 | +> but related settings are part of this demo! |
| 42 | +> Please install it from the asset library first. |
| 43 | +
|
| 44 | +## Action map |
| 45 | + |
| 46 | +This demo project has a barebones action map as we're only dealing with positioning. |
| 47 | + |
| 48 | +## Running on PCVR |
| 49 | + |
| 50 | +This project can be run as normal for PCVR however only a few runtimes actually support passthrough in this way. |
| 51 | +For some you still need to install the OpenXR vendors plugin as passthrough support can rely on vendor extensions. |
| 52 | + |
| 53 | +Ensure that an OpenXR runtime has been installed. |
| 54 | + |
| 55 | +## Running on standalone VR |
| 56 | + |
| 57 | +This demo works best on standalone headsets as many support passthrough. |
| 58 | + |
| 59 | +You **must** install the Android build templates and OpenXR vendors plugin. |
| 60 | +This project does include an `export_preset.cfg` file with example setups for some of these devices. |
| 61 | +Please follow [the instructions for deploying on Android in the manual](https://docs.godotengine.org/en/stable/tutorials/xr/deploying_to_android.html). |
| 62 | + |
| 63 | + |
0 commit comments