Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VR script

#1
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.

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:

[Image: extLFVZ.jpg]
[Image: tzSjPMU.jpg]
<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Reply

#2
And here's the HUD for it, based on Luma but with everything centered around the crosshair. It's pretty small and compact, but it does the job and is quite readable on my headset!

Simply create the file hud_luma_vr.cfg in your data directory, paste the code below into it, then replace "exec hud_luminos_minimal_xhair.cfg" with "exec hud_luma_vr.cfg" inside "alias vr_on" in the script above. This will automatically set this HUD only when you enter VR mode then undo it once you exit.


Code:
//title Luma VR
//author sev, MirceaKitsune

seta hud_skin "luma"
seta hud_panel_bg "0"
seta hud_panel_bg_color "0 0.14 0.25"
seta hud_panel_bg_color_team "1"
seta hud_panel_bg_alpha "0.200000"
seta hud_panel_bg_border "2"
seta hud_panel_bg_padding "0"
seta hud_panel_fg_alpha "1"

seta hud_dock "0"
seta hud_dock_color "0 0 0"
seta hud_dock_color_team "1"
seta hud_dock_alpha "1"

seta hud_progressbar_alpha "0.6"
seta hud_progressbar_strength_color "1 0.39 0"
seta hud_progressbar_superweapons_color "0.77 0.67 0"
seta hud_progressbar_shield_color "0.36 1 0.07"
seta hud_progressbar_health_color "0.83 0.12 0"
seta hud_progressbar_armor_color "0.28 0.8 0"
seta hud_progressbar_fuel_color "0.77 0.67 0"
seta hud_progressbar_nexball_color "0.2 0.65 0.93"
seta hud_progressbar_speed_color "0.77 0.67 0"
seta hud_progressbar_acceleration_color "0.2 0.65 0.93"
seta hud_progressbar_acceleration_neg_color "0.86 0.35 0"
seta hud_progressbar_vehicles_ammo1_color "0.77 0.67 0"
seta hud_progressbar_vehicles_ammo2_color "0.86 0.35 0"

seta _hud_panelorder "3 1 9 0 4 11 7 12 8 6 14 23 22 2 16 5 15 10 13 17 18 19 20 21 24 25 "

seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_configure_grid_ysize "0.010000"

seta hud_panel_weapons_pos "0.340000 0.280000"
seta hud_panel_weapons_size "0.030000 0.440000"
seta hud_panel_weapons_bg "0"
seta hud_panel_weapons_bg_color ""
seta hud_panel_weapons_bg_color_team ""
seta hud_panel_weapons_bg_alpha ""
seta hud_panel_weapons_bg_border ""
seta hud_panel_weapons_bg_padding "0"
seta hud_panel_weapons_accuracy "0"
seta hud_panel_weapons_label "2"
seta hud_panel_weapons_label_scale "0.3"
seta hud_panel_weapons_complainbubble "1"
seta hud_panel_weapons_complainbubble_padding "0"
seta hud_panel_weapons_complainbubble_time "0"
seta hud_panel_weapons_complainbubble_fadetime "1"
seta hud_panel_weapons_complainbubble_color_outofammo "0.8 0.11 0"
seta hud_panel_weapons_complainbubble_color_donthave "0.88 0.75 0"
seta hud_panel_weapons_complainbubble_color_unavailable "0 0.71 1"
seta hud_panel_weapons_ammo "0"
seta hud_panel_weapons_ammo_color "0.58 1 0.04"
seta hud_panel_weapons_ammo_alpha "1"
seta hud_panel_weapons_aspect "1"
seta hud_panel_weapons_timeout "1"
seta hud_panel_weapons_timeout_effect "1"
seta hud_panel_weapons_timeout_fadebgmin "0.4"
seta hud_panel_weapons_timeout_fadefgmin "0.4"
seta hud_panel_weapons_timeout_speed_in "0.25"
seta hud_panel_weapons_timeout_speed_out "0.75"
seta hud_panel_weapons_onlyowned "1"
seta hud_panel_weapons_orderbyimpulse "1"
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
seta hud_panel_weapons_selection_radius "0"
seta hud_panel_weapons_selection_speed "10"

seta hud_panel_ammo_pos "0.390000 0.530000"
seta hud_panel_ammo_size "0.220000 0.040000"
seta hud_panel_ammo_bg "border_tab_south"
seta hud_panel_ammo_bg_color ""
seta hud_panel_ammo_bg_color_team ""
seta hud_panel_ammo_bg_alpha ""
seta hud_panel_ammo_bg_border ""
seta hud_panel_ammo_bg_padding ""
seta hud_panel_ammo_onlycurrent "0"
seta hud_panel_ammo_noncurrent_alpha "0.4"
seta hud_panel_ammo_noncurrent_scale "0.6"
seta hud_panel_ammo_iconalign "0"
seta hud_panel_ammo_progressbar "0"
seta hud_panel_ammo_progressbar_name "progressbar"
seta hud_panel_ammo_progressbar_xoffset "0"
seta hud_panel_ammo_text "1"

seta hud_panel_powerups_pos "0.380000 0.620000"
seta hud_panel_powerups_size "0.040000 0.100000"
seta hud_panel_powerups_bg "border_powerups"
seta hud_panel_powerups_bg_color ""
seta hud_panel_powerups_bg_color_team ""
seta hud_panel_powerups_bg_alpha ""
seta hud_panel_powerups_bg_border ""
seta hud_panel_powerups_bg_padding ""
seta hud_panel_powerups_iconalign "2"
seta hud_panel_powerups_baralign "2"
seta hud_panel_powerups_progressbar "1"
seta hud_panel_powerups_text "1"

seta hud_panel_healtharmor_pos "0.380000 0.570000"
seta hud_panel_healtharmor_size "0.240000 0.030000"
seta hud_panel_healtharmor_bg "border_default_south"
seta hud_panel_healtharmor_bg_color ""
seta hud_panel_healtharmor_bg_color_team ""
seta hud_panel_healtharmor_bg_alpha ""
seta hud_panel_healtharmor_bg_border "4"
seta hud_panel_healtharmor_bg_padding ""
seta hud_panel_healtharmor_combined "0"
seta hud_panel_healtharmor_flip "0"
seta hud_panel_healtharmor_iconalign "2"
seta hud_panel_healtharmor_baralign "2"
seta hud_panel_healtharmor_progressbar "1"
seta hud_panel_healtharmor_progressbar_health "progressbar"
seta hud_panel_healtharmor_progressbar_armor "progressbar"
seta hud_panel_healtharmor_progressbar_gfx "1"
seta hud_panel_healtharmor_progressbar_gfx_smooth "2"
seta hud_panel_healtharmor_text "1"

seta hud_panel_notify_pos "0.630000 0.280000"
seta hud_panel_notify_size "0.030000 0.440000"
seta hud_panel_notify_bg "0"
seta hud_panel_notify_bg_color ""
seta hud_panel_notify_bg_color_team ""
seta hud_panel_notify_bg_alpha ""
seta hud_panel_notify_bg_border ""
seta hud_panel_notify_bg_padding ""
seta hud_panel_notify_flip "0"
seta hud_panel_notify_fontsize "0.8"
seta hud_panel_notify_time "10"
seta hud_panel_notify_fadetime "3"
seta hud_panel_notify_icon_aspect "1"

seta hud_panel_timer_pos "0.390000 0.500000"
seta hud_panel_timer_size "0.040000 0.030000"
seta hud_panel_timer_bg "border_timer"
seta hud_panel_timer_bg_color ""
seta hud_panel_timer_bg_color_team ""
seta hud_panel_timer_bg_alpha ""
seta hud_panel_timer_bg_border ""
seta hud_panel_timer_bg_padding ""

seta hud_panel_radar_pos "0.200000 0.280000"
seta hud_panel_radar_size "0.130000 0.220000"
seta hud_panel_radar_bg "border_radar"
seta hud_panel_radar_bg_color ""
seta hud_panel_radar_bg_color_team ""
seta hud_panel_radar_bg_alpha ""
seta hud_panel_radar_bg_border ""
seta hud_panel_radar_bg_padding "1"
seta hud_panel_radar_foreground_alpha "1"
seta hud_panel_radar_rotation "0"
seta hud_panel_radar_zoommode "0"
seta hud_panel_radar_scale "4096"
seta hud_panel_radar_maximized_scale "5120"
seta hud_panel_radar_maximized_size "0.5 0.5"
seta hud_panel_radar_maximized_rotation "1"
seta hud_panel_radar_maximized_zoommode "3"

seta hud_panel_score_pos "0.430000 0.170000"
seta hud_panel_score_size "0.140000 0.100000"
seta hud_panel_score_bg "0"
seta hud_panel_score_bg_color ""
seta hud_panel_score_bg_color_team ""
seta hud_panel_score_bg_alpha ""
seta hud_panel_score_bg_border ""
seta hud_panel_score_bg_padding ""
seta hud_panel_score_rankings "1"

seta hud_panel_racetimer_pos "0.200000 0.510000"
seta hud_panel_racetimer_size "0.130000 0.070000"
seta hud_panel_racetimer_bg "0"
seta hud_panel_racetimer_bg_color ""
seta hud_panel_racetimer_bg_color_team ""
seta hud_panel_racetimer_bg_alpha ""
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""

seta hud_panel_vote_pos "0.430000 0.620000"
seta hud_panel_vote_size "0.140000 0.100000"
seta hud_panel_vote_bg "border_default"
seta hud_panel_vote_bg_color ""
seta hud_panel_vote_bg_color_team ""
seta hud_panel_vote_bg_alpha ""
seta hud_panel_vote_bg_border ""
seta hud_panel_vote_bg_padding ""
seta hud_panel_vote_alreadyvoted_alpha "0.5"

seta hud_panel_modicons_pos "0.440000 0.470000"
seta hud_panel_modicons_size "0.040000 0.060000"
seta hud_panel_modicons_bg "0"
seta hud_panel_modicons_bg_color ""
seta hud_panel_modicons_bg_color_team ""
seta hud_panel_modicons_bg_alpha ""
seta hud_panel_modicons_bg_border ""
seta hud_panel_modicons_bg_padding ""
seta hud_panel_modicons_ca_layout "1"
seta hud_panel_modicons_dom_layout "1"
seta hud_panel_modicons_freezetag_layout "1"

seta hud_panel_pressedkeys_pos "0.430000 0.730000"
seta hud_panel_pressedkeys_size "0.140000 0.100000"
seta hud_panel_pressedkeys_bg "0"
seta hud_panel_pressedkeys_bg_color ""
seta hud_panel_pressedkeys_bg_color_team ""
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding "1"
seta hud_panel_pressedkeys_aspect "2"
seta hud_panel_pressedkeys_attack "0"

seta hud_panel_chat_pos "0.380000 0.280000"
seta hud_panel_chat_size "0.240000 0.100000"
seta hud_panel_chat_bg "0"
seta hud_panel_chat_bg_color ""
seta hud_panel_chat_bg_color_team ""
seta hud_panel_chat_bg_alpha ""
seta hud_panel_chat_bg_border ""
seta hud_panel_chat_bg_padding ""

seta hud_panel_engineinfo_pos "0.570000 0.500000"
seta hud_panel_engineinfo_size "0.040000 0.030000"
seta hud_panel_engineinfo_bg "border_engineinfo"
seta hud_panel_engineinfo_bg_color ""
seta hud_panel_engineinfo_bg_color_team ""
seta hud_panel_engineinfo_bg_alpha ""
seta hud_panel_engineinfo_bg_border ""
seta hud_panel_engineinfo_bg_padding ""
seta hud_panel_engineinfo_framecounter_time "0.1"
seta hud_panel_engineinfo_framecounter_decimals "0"

seta hud_panel_infomessages_pos "0.670000 0.510000"
seta hud_panel_infomessages_size "0.130000 0.070000"
seta hud_panel_infomessages_bg "0"
seta hud_panel_infomessages_bg_color ""
seta hud_panel_infomessages_bg_color_team ""
seta hud_panel_infomessages_bg_alpha ""
seta hud_panel_infomessages_bg_border ""
seta hud_panel_infomessages_bg_padding "0"
seta hud_panel_infomessages_flip "1"

seta hud_panel_physics_pos "0.520000 0.470000"
seta hud_panel_physics_size "0.040000 0.060000"
seta hud_panel_physics_bg "0"
seta hud_panel_physics_bg_color ""
seta hud_panel_physics_bg_color_team ""
seta hud_panel_physics_bg_alpha "0.7"
seta hud_panel_physics_bg_border ""
seta hud_panel_physics_bg_padding ""
seta hud_panel_physics_speed_unit_show "1"
seta hud_panel_physics_speed_max "1800"
seta hud_panel_physics_speed_vertical "0"
seta hud_panel_physics_topspeed "1"
seta hud_panel_physics_topspeed_time "4"
seta hud_panel_physics_acceleration_max "1.5"
seta hud_panel_physics_acceleration_vertical "0"
seta hud_panel_physics_flip "0"
seta hud_panel_physics_baralign "0"
seta hud_panel_physics_progressbar "1"
seta hud_panel_physics_acceleration_progressbar_mode "0"
seta hud_panel_physics_acceleration_progressbar_scale "1"
seta hud_panel_physics_acceleration_progressbar_nonlinear "0"
seta hud_panel_physics_text "1"
seta hud_panel_physics_text_scale "0.7"

seta hud_panel_centerprint_pos "0.380000 0.390000"
seta hud_panel_centerprint_size "0.240000 0.070000"
seta hud_panel_centerprint_bg "0"
seta hud_panel_centerprint_bg_color ""
seta hud_panel_centerprint_bg_color_team ""
seta hud_panel_centerprint_bg_alpha ""
seta hud_panel_centerprint_bg_border ""
seta hud_panel_centerprint_bg_padding ""
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_fade_subsequent "1"
seta hud_panel_centerprint_fade_subsequent_passone "3"
seta hud_panel_centerprint_fade_subsequent_passone_minalpha "0.5"
seta hud_panel_centerprint_fade_subsequent_passtwo "10"
seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "0.5"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"

seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_minigameboard_bg "border_small"
seta hud_panel_minigameboard_bg_color ""
seta hud_panel_minigameboard_bg_color_team ""
seta hud_panel_minigameboard_bg_alpha ""
seta hud_panel_minigameboard_bg_border ""
seta hud_panel_minigameboard_bg_padding ""

seta hud_panel_minigamestatus_pos "0.74 0.15"
seta hud_panel_minigamestatus_size "0.2 0.60"
seta hud_panel_minigamestatus_bg "border_small"
seta hud_panel_minigamestatus_bg_color ""
seta hud_panel_minigamestatus_bg_color_team ""
seta hud_panel_minigamestatus_bg_alpha ""
seta hud_panel_minigamestatus_bg_border ""
seta hud_panel_minigamestatus_bg_padding ""

seta hud_panel_minigamehelp_pos "0.22 0.78"
seta hud_panel_minigamehelp_size "0.50 0.20"
seta hud_panel_minigamehelp_bg ""
seta hud_panel_minigamehelp_bg_color ""
seta hud_panel_minigamehelp_bg_color_team ""
seta hud_panel_minigamehelp_bg_alpha ""
seta hud_panel_minigamehelp_bg_border ""
seta hud_panel_minigamehelp_bg_padding ""

seta hud_panel_minigamemenu_pos "0 0.26"
seta hud_panel_minigamemenu_size "0.2 0.49"
seta hud_panel_minigamemenu_bg "border_small"
seta hud_panel_minigamemenu_bg_color ""
seta hud_panel_minigamemenu_bg_color_team ""
seta hud_panel_minigamemenu_bg_alpha ""
seta hud_panel_minigamemenu_bg_border ""
seta hud_panel_minigamemenu_bg_padding ""

seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "border_default"
seta hud_panel_mapvote_bg_color ""
seta hud_panel_mapvote_bg_color_team ""
seta hud_panel_mapvote_bg_alpha ""
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
seta hud_panel_mapvote_highlight_border "1"

seta hud_panel_itemstime_pos "0.580000 0.620000"
seta hud_panel_itemstime_size "0.040000 0.100000"
seta hud_panel_itemstime_bg "border_itemstime"
seta hud_panel_itemstime_bg_color ""
seta hud_panel_itemstime_bg_color_team ""
seta hud_panel_itemstime_bg_alpha ""
seta hud_panel_itemstime_bg_border ""
seta hud_panel_itemstime_bg_padding ""
seta hud_panel_itemstime_iconalign "0"
seta hud_panel_itemstime_progressbar "1"
seta hud_panel_itemstime_progressbar_name "progressbar"
seta hud_panel_itemstime_progressbar_reduced "0"
seta hud_panel_itemstime_text "1"
seta hud_panel_itemstime_ratio "2"
seta hud_panel_itemstime_dynamicsize "1"

seta hud_panel_quickmenu_pos "0.670000 0.280000"
seta hud_panel_quickmenu_size "0.130000 0.220000"
seta hud_panel_quickmenu_bg "border_quickmenu"
seta hud_panel_quickmenu_bg_color ""
seta hud_panel_quickmenu_bg_color_team ""
seta hud_panel_quickmenu_bg_alpha ""
seta hud_panel_quickmenu_bg_border ""
seta hud_panel_quickmenu_bg_padding ""
seta hud_panel_quickmenu_align "0"

seta hud_panel_scoreboard_pos "0.150000 0.150000"
seta hud_panel_scoreboard_size "0.700000 0.700000"
seta hud_panel_scoreboard_bg "border_default"
seta hud_panel_scoreboard_bg_color "0 0.3 0.5"
seta hud_panel_scoreboard_bg_color_team ""
seta hud_panel_scoreboard_bg_alpha "0.7"
seta hud_panel_scoreboard_bg_border ""
seta hud_panel_scoreboard_bg_padding ""
seta hud_panel_scoreboard_fadeinspeed "10"
seta hud_panel_scoreboard_fadeoutspeed "5"
seta hud_panel_scoreboard_respawntime_decimals "1"
seta hud_panel_scoreboard_table_bg_alpha "0"
seta hud_panel_scoreboard_table_bg_scale "0.25"
seta hud_panel_scoreboard_table_fg_alpha "0.9"
seta hud_panel_scoreboard_table_fg_alpha_self "1"
seta hud_panel_scoreboard_table_highlight "1"
seta hud_panel_scoreboard_table_highlight_alpha "0.2"
seta hud_panel_scoreboard_table_highlight_alpha_self "0.4"
seta hud_panel_scoreboard_bg_teams_color_team "0"
seta hud_panel_scoreboard_accuracy_doublerows "0"
seta hud_panel_scoreboard_accuracy_nocolors "0"

seta hud_panel_stomach_pos ""
seta hud_panel_stomach_size ""
seta hud_panel_stomach_bg ""
seta hud_panel_stomach_bg_color ""
seta hud_panel_stomach_bg_color_team ""
seta hud_panel_stomach_bg_alpha ""
seta hud_panel_stomach_bg_border ""
seta hud_panel_stomach_bg_padding ""

menu_sync
[Image: iJzEvvw.jpg]
[Image: oSlwoe9.jpg]
<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Reply

#3
Here's a better one showing how I positioned everything. The layout may seem silly when looking at it on a monitor, but with a headset it quickly makes sense: The closer something is to the crosshair (screen center) the easier it is to read as you don't have to move your eyes too far. The panel background is set to 0.2 opacity so it doesn't obscure the view as much... I also enabled the FPS counter so you can see see how much performance you're getting with your headset.

[Image: dPaSYC5.jpg]
<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  [Script] Full realtime world lighting, using static light entities MirceaKitsune 4 3,701 03-23-2015, 12:33 PM
Last Post: Lee_Stricklin
Brick A script engine written in QuakeC Melanosuchus 9 7,101 10-14-2014, 02:01 AM
Last Post: Melanosuchus
  [solved] 'all' script problems xeros 4 3,587 10-16-2010, 03:37 PM
Last Post: xeros

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-