Browse Source

XR demos: Add check for VRS/foveation in start vr script, and enable foveation in project settings (#1022)

Co-authored-by: Aaron Franke <[email protected]>
Bastiaan Olij 1 year ago
parent
commit
035e905a3e

+ 0 - 2
xr/openxr_character_centric_movement/.gitattributes

@@ -1,2 +0,0 @@
-# Normalize EOL for all files that Git considers text files.
-* text=auto eol=lf

+ 0 - 3
xr/openxr_character_centric_movement/.gitignore

@@ -1,5 +1,2 @@
-# Godot 4+ specific ignores
-.godot/
-
 # Ignore our Android build folder, should be installed by user if needed
 android/

+ 1 - 1
xr/openxr_character_centric_movement/README.md

@@ -5,7 +5,7 @@ This is based on the [Character body centric solution as explained in the room s
 
 Language: GDScript
 
-Renderer: compatibility
+Renderer: Compatibility
 
 ## How does it work?
 

+ 2 - 0
xr/openxr_character_centric_movement/project.godot

@@ -24,4 +24,6 @@ textures/vram_compression/import_etc2_astc=true
 [xr]
 
 openxr/enabled=true
+openxr/foveation_level=3
+openxr/foveation_dynamic=true
 shaders/enabled=true

+ 6 - 0
xr/openxr_character_centric_movement/start_vr.gd

@@ -23,6 +23,12 @@ func _ready():
 		# Make sure v-sync is off, v-sync is handled by OpenXR
 		DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)
 
+		# Enable VRS
+		if RenderingServer.get_rendering_device():
+			vp.vrs_mode = Viewport.VRS_XR
+		elif int(ProjectSettings.get_setting("xr/openxr/foveation_level")) == 0:
+			push_warning("OpenXR: Recommend setting Foveation level to High in Project Settings")
+
 		# Connect the OpenXR events
 		xr_interface.session_begun.connect(_on_openxr_session_begun)
 		xr_interface.session_visible.connect(_on_openxr_visible_state)

+ 0 - 2
xr/openxr_origin_centric_movement/.gitattributes

@@ -1,2 +0,0 @@
-# Normalize EOL for all files that Git considers text files.
-* text=auto eol=lf

+ 0 - 3
xr/openxr_origin_centric_movement/.gitignore

@@ -1,5 +1,2 @@
-# Godot 4+ specific ignores
-.godot/
-
 # Ignore our Android build folder, should be installed by user if needed
 android/

+ 1 - 1
xr/openxr_origin_centric_movement/README.md

@@ -5,7 +5,7 @@ This is based on the [Origin centric solution as explained in the room scale man
 
 Language: GDScript
 
-Renderer: compatibility
+Renderer: Compatibility
 
 ## How does it work?
 

+ 2 - 0
xr/openxr_origin_centric_movement/project.godot

@@ -24,4 +24,6 @@ textures/vram_compression/import_etc2_astc=true
 [xr]
 
 openxr/enabled=true
+openxr/foveation_level=3
+openxr/foveation_dynamic=true
 shaders/enabled=true

+ 6 - 0
xr/openxr_origin_centric_movement/start_vr.gd

@@ -23,6 +23,12 @@ func _ready():
 		# Make sure v-sync is off, v-sync is handled by OpenXR
 		DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)
 
+		# Enable VRS
+		if RenderingServer.get_rendering_device():
+			vp.vrs_mode = Viewport.VRS_XR
+		elif int(ProjectSettings.get_setting("xr/openxr/foveation_level")) == 0:
+			push_warning("OpenXR: Recommend setting Foveation level to High in Project Settings")
+
 		# Connect the OpenXR events
 		xr_interface.session_begun.connect(_on_openxr_session_begun)
 		xr_interface.session_visible.connect(_on_openxr_visible_state)