WiVRn / WiVRn

An OpenXR streaming application to a standalone headset
GNU General Public License v3.0
227 stars 36 forks source link

Into The Radius 2: Unplayable Due to Position Offset #96

Closed Riebeck-one closed 2 months ago

Riebeck-one commented 3 months ago

Starting Into The Radius 2 (which I believe natively runs on OpenXR) results in the game being displayed correctly in the HMD, but with such a significant position offset that it is unplayable most of the time, as I can be hundreds of meters away from the main menu. Each time I restart the game, my position changes, and if I'm lucky enough, I can spawn close enough to the game menu to select "start playing." However, even after that, there is a loading screen, and when I'm actually in the game, the huge position offset occurs once again, causing me to spawn outside of the map.

I tried other games like Phasmophobia (an OpenXR game) and Half-Life: Alyx (with Open Composite), and I did not encounter such issues.

Additionally, running the game through ALVR does not result in such a position offset.

Hardware:

Software:

xytovl commented 3 months ago

It seems origin was not initialized correctly, can you verify that https://github.com/Meumeu/WiVRn/tree/fix/tracking-origin-init fixes the issue?

Riebeck-one commented 3 months ago

I just tried this fix, and it didn't change anything unfortunately. However, I discovered something interesting. If I run the game without wearing the headset, wait until I get to the main menu, and then put on the headset, my position in the game is correct. I tried this several times, and it seems perfectly consistent. Unfortunately, I still can't play since I have to wear the headset to load my save, and after loading, I'm still off the map.

xytovl commented 3 months ago

I noticed there was an error in the recentering function, and published a client fix on the same branch.

Can you test with an apk from CI https://github.com/Meumeu/WiVRn/actions/workflows/Build.yml?query=branch%3Afix%2Ftracking-origin-init

This should fix recentering (long press on menu button), and may change the initial position too.

Riebeck-one commented 3 months ago

I recompiled the fix/tracking-origin-init branch and installed the APK from this link: https://github.com/Meumeu/WiVRn/actions/runs/10180260880, but the issue persists. It seems that recentering only adjusts the rotation and not the position.

just in case, here is WiVRn log when running the game :

WiVRn v0.17-11-g1d4124e starting
Service published: archlinux
Server started, PID 19858
 INFO [ipc_server_main]  'v24.0.0-61-ge4636ca15' starting up...
DEBUG [comp_main_create_system_compositor] Doing init 0x5bbfcc24ef90
 INFO [create_device] Created device and COMPUTE queue with QUEUE_GLOBAL_PRIORITY_MEDIUM.
 INFO [vk_print_device_info] Device info:
    name: AMD Radeon RX 7900 XTX (RADV NAVI31)
    vendor: 0x1002
    product: 0x744c
    deviceType: VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
    apiVersion: 1.3.278
    driverVersion: 0x06001004
 INFO [vk_print_features_info] Features:
    timestamp_compute_and_graphics: true
    timestamp_period: 10.000000
    timestamp_valid_bits: 64
    timeline_semaphore: true
 INFO [vk_print_external_handles_info] Supported images:
    VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT:
        color import=true export=true
        depth import=true export=true
 INFO [vk_print_external_handles_info] Supported fences:
    VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT: true
    VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT: true
 INFO [vk_print_external_handles_info] Supported semaphores:
    VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT(binary): true
    VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT(binary): true
    VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT(timeline): false
    VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT(timeline): true
[h264_vaapi @ 0x5bbfcc803e40] Driver does not support some wanted packed headers (wanted 0xd, found 0x1).
 INFO [comp_vulkan_formats_log] Supported formats:
    VK_FORMAT_R16G16B16A16_UNORM: true
    VK_FORMAT_R16G16B16A16_SFLOAT: true
    VK_FORMAT_R16G16B16_UNORM: false
    VK_FORMAT_R16G16B16_SFLOAT: false
    VK_FORMAT_R8G8B8A8_SRGB: true
    VK_FORMAT_B8G8R8A8_SRGB: true
    VK_FORMAT_R8G8B8_SRGB: false
    VK_FORMAT_R8G8B8A8_UNORM: true
    VK_FORMAT_B8G8R8A8_UNORM: true
    VK_FORMAT_R8G8B8_UNORM: false
    VK_FORMAT_B8G8R8_UNORM: false
    VK_FORMAT_R5G6B5_UNORM_PACK16: true
    VK_FORMAT_R32_SFLOAT: true
    VK_FORMAT_D32_SFLOAT: true
    VK_FORMAT_D16_UNORM: true
    VK_FORMAT_X8_D24_UNORM_PACK32: false
    VK_FORMAT_D24_UNORM_S8_UINT: false
    VK_FORMAT_D32_SFLOAT_S8_UINT: true
    VK_FORMAT_S8_UINT: true
 WARN [u_linux_try_to_set_realtime_priority_on_thread] Could not raise priority for thread 'Multi Client Module'
 INFO [print_linux_end_user_started_information] 
################################################################################
#                                                                              #
#                        The Monado service has started.                       #
#                                                                              #
################################################################################
 INFO [client_loop] Client 1 connected
 INFO [ipc_handle_instance_describe_client] Client info:
    id: 1
    application_name: 'envision-openxr-prober'
    pid: 6220
    extensions:
        ext_hand_tracking_enabled: false
        ext_eye_gaze_interaction_enabled: false
        ext_hand_interaction_enabled: false
 INFO [client_loop] Client disconnected.
 INFO [client_loop] Client 2 connected
 INFO [ipc_handle_instance_describe_client] Client info:
    id: 2
    application_name: 'OpenComposite_wine64-preloader'
    pid: 20084
    extensions:
        ext_hand_tracking_enabled: true
        ext_eye_gaze_interaction_enabled: false
        ext_hand_interaction_enabled: false
 INFO [client_loop] Client 3 connected
 INFO [ipc_handle_instance_describe_client] Client info:
    id: 3
    application_name: 'wineopenxr test instance'
    pid: 20084
    extensions:
        ext_hand_tracking_enabled: false
        ext_eye_gaze_interaction_enabled: false
        ext_hand_interaction_enabled: false
 INFO [client_loop] Client disconnected.
 INFO [client_loop] Client disconnected.
 INFO [client_loop] Client 4 connected
 INFO [ipc_handle_instance_describe_client] Client info:
    id: 4
    application_name: 'IntoTheRadius2'
    pid: 20173
    extensions:
        ext_hand_tracking_enabled: true
        ext_eye_gaze_interaction_enabled: false
        ext_hand_interaction_enabled: false
 INFO [client_loop] Client disconnected.
xytovl commented 3 months ago

We don't log relevant information for this.

If you have some development skills, it would be interesting to know:

Riebeck-one commented 3 months ago

I don't have those skills, unfortunately. I think I'll just wait for someone with more experience and the same problem to help you.

Thanks for trying to help me.

xytovl commented 3 months ago

I have added some debug lines for client and server in https://github.com/Meumeu/WiVRn/tree/test/issue-96

For server, it needs XRT_LOG=info to print the additional data (it will be very verbose). On client you can capture logs using adb logcat, the relevant lines are "stage/local offset: ", you can use adb logcat -e "local offset" to filter them.

Riebeck-one commented 3 months ago

Here are the server log : WiVRn_Server_log.txt And the client log:

adb logcat -e  "local offset"
--------- beginning of main
08-01 13:24:50.881  7425  7503 I WiVRn   : [2024-08-01 13:24:50.881] [WiVRn] [info] stage/local offset: 0, -1.3374841, 0
xytovl commented 3 months ago

According to those logs, the position reported by WiVRn is about 1m from origin. How far were you from the menu in the game?

Riebeck-one commented 3 months ago

It really depends. Most of the time, I can't even see where I am (probably under the map), but it's random. Sometimes I spawn 5 meters away from the menu, and other times it's about 100 meters away. The only way I can consistently be at the right distance from the menu is by connecting to WiVRn from the Quest, then removing it so it goes into sleep mode, running the game on Steam, and letting it go to the menu before putting the Quest back on.

xytovl commented 3 months ago

I mean, the logs you posted give a distance of around 1m and I need to know if this matches the distance in the game.

Can you check again what position is reported in logs (server logs should be sufficent) when distance is large in-game.

Riebeck-one commented 3 months ago

Okay, I just tried several times by only restarting the game without restarting the WiVRn connection. The first time, I couldn't see where I was; the second time, I was right in front of the menu as it is supposed to be; and the third time, I was about 30 meters away from it, as you can see in this screenshot: image

There is only these lines of log for the client:

adb logcat -e "local offset" --------- beginning of main 08-01 15:14:30.793 5815 5894 I WiVRn : [2024-08-01 15:14:30.793] [WiVRn] [info] stage/local offset: 0, -1.2091378, 0 And this is the log for the server from the three times I ran the game: WiVRn_log.txt

From what I can see, the position in the game does not seem to be related to what the log returns.

Riebeck-one commented 3 months ago

Okay, so I found a way to consistently play the game, even though it's not sustainable in the long run. All I have to do is put my quest to sleep anytime there is a loading screen and turn it back on when the loading is done. This way, I spawn correctly in the game. When I do this (putting the quest to sleep), there is a sudden change in the head position returned by the server. It goes from something like : INFO [update_tracking] head position: 0.023796,1.263465,0.007255 To something like : INFO [update_tracking] head position: 4.546057,-1.212925,1.258573 instantly

Riebeck-one commented 2 months ago

I tested again since there was an update for both Wivrn and the game itself, and this issue seems to be resolved.