10-16-2019, 01:56 PM
(This post was last modified: 10-16-2019, 02:02 PM by MirceaKitsune.)
It's been a while since I got the chance to contribute something useful to core Xonotic. I put together a little script for everyone who has a VR headset, which easily allows switching between VR and non-VR mode. Obviously the DarkPlaces engine does not support Virtual Reality, meaning there are no niche features like head tracking... it does however support separated stereoscopy, which is all that's needed to get the visual part working if your headset is recognized as a standard display.
This script simply adjust the stereo settings and offers a convenient way of toggling r_stereo_separation. There are a few other things that must be changed in addition: The FOV needs to be a lot bigger when using a headset. You also have to adjust the value of vid_pixelheight to balance between stretching / compressing the 3D world versus the 2D HUD. Since you can't see the corners and edges of the screen, a custom HUD is also recommended... luminos_minimal_xhair is the closest option available out of the box, I might make a proper one later.
To install this script, add it to a cfg file in your data directory then call that file from autoexec.cfg (eg: exec vr.cfg). You can now open the console and use the commands vr_on and vr_off to toggle VR mode. Note: If you use a custom FOV or HUD setup, you should customize your preferences in the vr_off alias to avoid losing them once reverting the changes.
Let me know if you find any way to improve this script... for instance I haven't found how to get correct proportions for both the world and the HUD, vid_pixelheight will stretch either one or the other. If you have a headset tell me how the script preforms for you! Here are two screenshots showing the changes in action:
This script simply adjust the stereo settings and offers a convenient way of toggling r_stereo_separation. There are a few other things that must be changed in addition: The FOV needs to be a lot bigger when using a headset. You also have to adjust the value of vid_pixelheight to balance between stretching / compressing the 3D world versus the 2D HUD. Since you can't see the corners and edges of the screen, a custom HUD is also recommended... luminos_minimal_xhair is the closest option available out of the box, I might make a proper one later.
To install this script, add it to a cfg file in your data directory then call that file from autoexec.cfg (eg: exec vr.cfg). You can now open the console and use the commands vr_on and vr_off to toggle VR mode. Note: If you use a custom FOV or HUD setup, you should customize your preferences in the vr_off alias to avoid losing them once reverting the changes.
Code:
// vid_pixelheight 1 causes the HUD to be crushed horizontally, but world renders properly
// vid_pixelheight 2 causes the world to be stretched horizontally, but HUD renders properly
// vid_pixelheight 1.5 is the recommended compromise
r_stereo_separation 4
r_stereo_angle -0.5
// Alias for reverting VR settings
alias vr_off "r_stereo_horizontal 0; vid_pixelheight 1; fov 100; exec hud_luma.cfg"
// Alias for applying VR settings
alias vr_on "r_stereo_horizontal 1; vid_pixelheight 1.5; fov 140; exec hud_luminos_minimal_xhair.cfg"
Let me know if you find any way to improve this script... for instance I haven't found how to get correct proportions for both the world and the HUD, vid_pixelheight will stretch either one or the other. If you have a headset tell me how the script preforms for you! Here are two screenshots showing the changes in action: