Skip to content

Commit 4857caa

Browse files
authored
Merge pull request #9114 from BastiaanOlij/openxr_reference_spaces
Add a help pages detailing out OpenXR settings.
2 parents 7c54d22 + 32be834 commit 4857caa

File tree

4 files changed

+254
-0
lines changed

4 files changed

+254
-0
lines changed
Binary file not shown.

tutorials/xr/img/openxr_settings.webp

31.5 KB
Binary file not shown.

tutorials/xr/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Advanced topics
2626
:maxdepth: 1
2727
:name: openxr-advanced-topics
2828

29+
openxr_settings
2930
xr_action_map
3031
xr_room_scale
3132
openxr_hand_tracking

tutorials/xr/openxr_settings.rst

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
.. _doc_openxr_settings:
2+
3+
OpenXR Settings
4+
===============
5+
6+
OpenXR has its own set of settings that are applied when OpenXR starts.
7+
While it is possible for OpenXR extensions implemented through Godot plugins to add additional settings,
8+
we will only discuss the settings in the core of Godot here.
9+
10+
.. image:: img/openxr_settings.png
11+
12+
Enabled
13+
-------
14+
15+
This setting enables the OpenXR module when Godot starts.
16+
This is required when the Vulkan backend is used.
17+
For other backends you can enable OpenXR at any time by calling ``initialize`` on the :ref:`OpenXRInterface <class_openxrinterface>`.
18+
19+
This also needs to be enabled to get access to the action map editor.
20+
21+
You can use the ``--xr-mode on`` command line switch to force this to on.
22+
23+
Default Action Map
24+
------------------
25+
26+
This specifies the path of the action map file that OpenXR will load and communicate to the XR Runtime.
27+
28+
Form Factor
29+
-----------
30+
31+
This specifies whether your game is designed for:
32+
33+
- ``Head Mounted`` devices such as a Meta Quest, Valve Index, or Magic Leap,
34+
- ``Handheld`` devices such as phones.
35+
36+
If the device on which you run your game does not match the selection here, OpenXR will fail to initialise.
37+
38+
View Configuration
39+
------------------
40+
41+
This specifies the view configuration your game is designed for:
42+
43+
- ``Mono``, your game provides a single image output. E.g. phone based AR;
44+
- ``Stereo``, your game provides stereo image output. E.g. head mounted devices.
45+
46+
If the device on which you run your game does not match the selection here, OpenXR will fail to initialise.
47+
48+
.. note::
49+
OpenXR has additional view configurations for very specific devices that Godot doesn't support yet.
50+
For instance, Varjo headsets have a quad view configuration that outputs two sets of stereo images.
51+
These may be supported in the near future.
52+
53+
Reference Space
54+
---------------
55+
56+
Within XR all elements like the player's head and hands are tracked within a tracking volume.
57+
At the base of this tracking volume is our origin point, which maps our virtual space to the real space.
58+
There are however different scenarios that place this point in different locations,
59+
depending on the XR system used.
60+
In OpenXR these scenarios are well defined and selected by setting a reference space.
61+
62+
Local
63+
^^^^^
64+
65+
The local reference space places our origin point at the player's head by default.
66+
Some XR runtimes will do this each time your game starts, others will make the position persist over sessions.
67+
68+
This reference space however does not prevent the user from walking away so you will need to detect if the user does so
69+
if you wish to prevent the user from leaving the vehicle they are controlling, which could potentially be game breaking.
70+
71+
This reference space is the best option for games like flight simulators or racing simulators
72+
where we want to place the :ref:`XROrigin3D <class_xrorigin3d>` node where the player's head should be.
73+
74+
When the user enacts the recenter option on their headset, the method of which is different per XR runtime,
75+
the XR runtime will move the :ref:`XRCamera3D <class_xrcamera3d>` to the :ref:`XROrigin3D <class_xrorigin3d>` node.
76+
The :ref:`OpenXRInterface <class_openxrinterface>` will also emit the ``pose_recentered`` signal
77+
so your game can react accordingly.
78+
79+
.. Note::
80+
Any other XR tracked elements such as controllers or anchors will also be adjusted accordingly.
81+
82+
.. Warning::
83+
You should **not** call ``center_on_hmd`` when using this reference space.
84+
85+
Stage
86+
^^^^^
87+
88+
The stage reference space is our default reference space and places our origin point at the center of our play space.
89+
For XR runtimes that allow you to draw out a guardian boundary this location and its orientation is often set by the user.
90+
Other XR runtimes may decide on the placement of this point by other means.
91+
It is however a stationary point in the real world.
92+
93+
This reference space is the best option for room scale games where the user is expected to walk around a larger space,
94+
or for games where there is a need to switch between game modes.
95+
See :ref:`Room Scale <doc_xr_room_scale>` for more information.
96+
97+
When the user enacts the recenter option on their headset, the method of which is different per XR runtime,
98+
the XR runtime will not change the origin point.
99+
The :ref:`OpenXRInterface <class_openxrinterface>` will emit the ``pose_recentered`` signal
100+
and it is up to the game to react appropriately.
101+
Not doing so will prevent your game from being accepted on various stores.
102+
103+
In Godot you can do this by calling the ``center_on_hmd`` function on the :ref:`XRServer <class_xrserver>`:
104+
105+
- Calling ``XRServer.center_on_hmd(XRServer.RESET_BUT_KEEP_TILT, true)`` will move the :ref:`XRCamera3D <class_xrcamera3d>` node
106+
to the :ref:`XROrigin3D <class_xrorigin3d>` node similar to the ``Local`` reference space.
107+
- Calling ``XRServer.center_on_hmd(XRServer.RESET_BUT_KEEP_TILT, true)`` will move the :ref:`XRCamera3D <class_xrcamera3d>` node
108+
above the :ref:`XROrigin3D <class_xrorigin3d>` node keeping the player's height, similar to the ``Local Floor`` reference space.
109+
110+
.. Note::
111+
Any other XR tracked elements such as controllers or anchors will also be adjusted accordingly.
112+
113+
Local Floor
114+
^^^^^^^^^^^
115+
116+
The local floor reference space is similar to the local reference space as it positions the origin point where the player is.
117+
In this mode however the height of the player is kept.
118+
Same as with the local reference space, some XR runtimes will persist this location over sessions.
119+
120+
It is thus not guaranteed the player will be standing on the origin point,
121+
the only guarantee is that they were standing there when the user last recentered.
122+
The player is thus also free to walk away.
123+
124+
This reference space is the best option of games where the user is expected to stand in the same location
125+
or for AR type games where the user's interface elements are bound to the origin node
126+
and are quickly placed at the player's location on recenter.
127+
128+
When the user enacts the recenter option on their headset, the method of which is different per XR runtime,
129+
the XR runtime will move the :ref:`XRCamera3D <class_xrcamera3d>` above the :ref:`XROrigin3D <class_xrorigin3d>` node
130+
but keeping the player's height.
131+
The :ref:`OpenXRInterface <class_openxrinterface>` will also emit the ``pose_recentered`` signal
132+
so your game can react accordingly.
133+
134+
.. Warning::
135+
Be careful using this mode in combination with virtual movement of the player.
136+
The user recentering in this scenario can be unpredictable unless you counter the move when handling the recenter signal.
137+
This can even be game breaking as the effect in this scenario would be the player teleporting to whatever abstract location
138+
the origin point was placed at during virtual movement, including the ability for players teleporting into
139+
locations that should be off limits.
140+
It is better to use the Stage mode in this scenario and limit resetting to orientation only when a ``pose_recentered`` signal is received.
141+
142+
.. Note::
143+
Any other XR tracked elements such as controllers or anchors will also be adjusted accordingly.
144+
145+
.. Warning::
146+
You should **not** call ``center_on_hmd`` when using this reference space.
147+
148+
Environment Blend Mode
149+
----------------------
150+
151+
The environment blend mode defines how our rendered output is blended into "the real world" provided this is supported by the headset.
152+
153+
- ``Opaque`` means our output obscures the real world, we are in VR mode.
154+
- ``Additive`` means our output is added to the real world,
155+
this is an AR mode where optics do not allow us to fully obscure the real world (e.g. Hololens),
156+
- ``Alpha`` means our output is blended with the real world using the alpha output (viewport should have transparent background enabled),
157+
this is an AR mode where optics can fully obscure the real world (Magic Leap, all pass through devices, etc.).
158+
159+
If a mode is selected that is not supported by the headset, the first available mode will be selected.
160+
161+
.. Note::
162+
Some OpenXR devices have separate systems for enabling/disabling passthrough.
163+
From Godot 4.3 onwards selecting the alpha blend mode will also perform these extra steps.
164+
This does require the latest vendor plugin to be installed.
165+
166+
Foveation Level
167+
---------------
168+
169+
Sets the foveation level used when rendering provided this feature is supported by the hardware used.
170+
Foveation is a technique where the further away from the center of the viewport we render content, the lower resolution we render at.
171+
Most XR runtimes only support fixed foveation, but some will take eye tracking into account and use the focal point for this effect.
172+
173+
The higher the level, the better the performance gains, but also the more reduction in quality there is in the users peripheral vision.
174+
175+
.. Note::
176+
**Compatibility renderer only**,
177+
for Mobile and Forward+ renderer, set the ``vrs_mode`` property on :ref:`Viewport <class_viewport>` to ``VRS_XR``.
178+
179+
.. Warning::
180+
This feature is disabled if post effects are used such as glow, bloom, or DOF.
181+
182+
Foveation Dynamic
183+
-----------------
184+
185+
When enabled the foveation level will be adjusted automatically depending on current GPU load.
186+
It will be adjusted between low and the select foveation level in the previous setting.
187+
It is therefore best to combine this setting with foveation level set to high.
188+
189+
.. Note::
190+
**Compatibility renderer only**
191+
192+
Submit Depth Buffer
193+
-------------------
194+
195+
If enabled an OpenXR supplied depth buffer will be used while rendering which is submitted alongside the rendered image.
196+
The XR runtime can use this for improved reprojection.
197+
198+
.. Note::
199+
Enabling this feature will disable stencil support during rendering.
200+
Not many XR runtimes make use of this,
201+
it is advised to leave this setting off unless it provides noticeable benefits for your use case.
202+
203+
Startup Alert
204+
-------------
205+
206+
If enabled this will result in an alert message presented to the user if OpenXR fails to start.
207+
We don't always receive feedback from the XR system as to why starting fails. If we do we log this to the console.
208+
Common failure reasons are:
209+
210+
- No OpenXR runtime is installed on the host system.
211+
- Microsofts WMR OpenXR runtime is currently active, this only supports DirectX and will fail if OpenGL or Vulkan is used.
212+
- SteamVR is used but no headset is connected/turned on.
213+
214+
Disable this if you support a fallback mode in your game so it can be played in desktop mode when no VR headset is connected,
215+
or if you're handling the failure condition yourself by checking ``OpenXRInterface.is_initialized()``.
216+
217+
Extensions
218+
----------
219+
220+
This subsection provides access to various optional OpenXR extensions.
221+
222+
Hand Tracking
223+
^^^^^^^^^^^^^
224+
225+
This enables the hand tracking extension when supported by the device used. This is on by default for legacy reasons.
226+
The hand tracking extension provides access to data that allows you to visualise the user's hands with correct finger positions.
227+
Depending on platform capabilities the hand tracking data can be inferred from controller inputs, come from data gloves,
228+
come from optical hand tracking sensors or any other applicable source.
229+
230+
If your game only supports controllers this should be turned off.
231+
232+
See the chapter on :ref:`hand tracking <doc_openxr_hand_tracking>` for additional details.
233+
234+
Eye Gaze Interaction
235+
^^^^^^^^^^^^^^^^^^^^
236+
237+
This enables the eye gaze interaction extension when supported by the device used.
238+
When enabled we will get feedback from eye tracking through a pose situated between the user's eyes
239+
orientated in the direction the user is looking. This will be a unified orientation.
240+
241+
In order to use this functionality you need to edit your action map and add a new pose action,
242+
say ``eye_pose``.
243+
Now add a new interaction profile for the eye gaze interaction and map the ``eye_pose``:
244+
245+
.. image:: img/openxr_eye_gaze_interaction.webp
246+
247+
Don't forget to save!
248+
249+
Next add a new :ref:`XRController3D <class_xrcontroller3d>` node to your origin node
250+
and set its ``tracker`` property to ``/user/eyes_ext``
251+
and set its ``pose`` property to ``eye_pose``.
252+
253+
Now you can add things to this controller node such as a raycast, and control things with your eyes.

0 commit comments

Comments
 (0)