Skip to content

Commit 2684eda

Browse files
committed
OpenXR: Add passthrough demo
1 parent 41171d8 commit 2684eda

File tree

25 files changed

+3146
-21
lines changed

25 files changed

+3146
-21
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Godot 4+ specific ignores
2+
.godot/
3+
.editorconfig
4+
/android/
5+
6+
# Ignore vendor plugin add on folder, should be installed by user if needed
7+
addons/godotopenxrvendors/
8+
9+
# We do want to include editor presets, they are important for configuring standalone headsets
10+
!export_presets.cfg
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
![Screenshot](screenshots/passthrough_in_quest.png)
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+
1.77 KB
Loading
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://biwe2rkf2ev74"
6+
path.s3tc="res://.godot/imported/pattern.png-cf6f03dfd1cdd4bc35da3414e912103d.s3tc.ctex"
7+
path.etc2="res://.godot/imported/pattern.png-cf6f03dfd1cdd4bc35da3414e912103d.etc2.ctex"
8+
metadata={
9+
"imported_formats": ["s3tc_bptc", "etc2_astc"],
10+
"vram_texture": true
11+
}
12+
13+
[deps]
14+
15+
source_file="res://assets/pattern.png"
16+
dest_files=["res://.godot/imported/pattern.png-cf6f03dfd1cdd4bc35da3414e912103d.s3tc.ctex", "res://.godot/imported/pattern.png-cf6f03dfd1cdd4bc35da3414e912103d.etc2.ctex"]
17+
18+
[params]
19+
20+
compress/mode=2
21+
compress/high_quality=false
22+
compress/lossy_quality=0.7
23+
compress/uastc_level=0
24+
compress/rdo_quality_loss=0.0
25+
compress/hdr_compression=1
26+
compress/normal_map=0
27+
compress/channel_pack=0
28+
mipmaps/generate=true
29+
mipmaps/limit=-1
30+
roughness/mode=0
31+
roughness/src_normal=""
32+
process/channel_remap/red=0
33+
process/channel_remap/green=1
34+
process/channel_remap/blue=2
35+
process/channel_remap/alpha=3
36+
process/fix_alpha_border=true
37+
process/premult_alpha=false
38+
process/normal_map_invert_y=false
39+
process/hdr_as_srgb=false
40+
process/hdr_clamp_exposure=false
41+
process/size_limit=0
42+
detect_3d/compress_to=0

0 commit comments

Comments
 (0)