Skip to content

Commit

Permalink
Dashboard and settings minor rehearsal (#1893)
Browse files Browse the repository at this point in the history
* Disable adapt to framerate by default. Remove dynamic oculus foveation toggle.

* Add 'Donate to ALVR button' in About tab.

* Add Hand Gestures Setup Page. Change SoftwareRequirements tab for linux setup.

* Default sharpening to 0.5

* Remove commented code. Remove unnecessary import.

* Reformat code. Remove commented code. Remove unnecessary import.

* Update hand tracking controller bindings

* Updated distrobox guide

* Fix table on hand tracking bindings wiki

* Rename label to Only Touch

* Set only touch to be true by default. Added note about disabling/enabling gestures on wiki. Small rename for older names for only touch in setup wizard.

* Restore adapt to framerate toggle to be true by default

* Added automatic audio script download/placement for alvr

* Added platform-specific cfg's for linux code

* Fixed link after testing

* Remove reqwest and use ureq instead. Add more platform cfgs in setup to not even show unnecessary buttons for platfo
rms.

* Re-added OpenUrl for windows

* Added specific cfg checks for windows to prevent compile errors on macos

* Moved platform specific import to function. Changed windows platform cfgs. Reformat

* Fix incorrect OpenUrl import for windows

* Remove whitespaces
  • Loading branch information
Meister1593 committed Nov 14, 2023
1 parent 5c62378 commit aaeecf5
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 88 deletions.
4 changes: 4 additions & 0 deletions alvr/dashboard/src/dashboard/components/about.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ This is a fork of ALVR that works with Meta Quest and other standalone headsets.
"Latest release",
"https://github.com/alvr-org/ALVR/releases/latest",
);
ui.hyperlink_to(
"Donate to ALVR on Open Collective",
"https://opencollective.com/alvr",
);
}
147 changes: 110 additions & 37 deletions alvr/dashboard/src/dashboard/components/setup_wizard.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
use alvr_packets::{FirewallRulesAction, ServerRequest};
use crate::dashboard::basic_components;
use alvr_common::{error, warn};
use alvr_packets::{FirewallRulesAction, PathValuePair, ServerRequest};
use eframe::{
egui::{Button, Label, Layout, OpenUrl, RichText, Ui},
egui::{Button, Label, Layout, RichText, Ui},
emath::Align,
};
use std::error::Error;
use std::{
fs::{self, File},
io,
};

pub enum SetupWizardRequest {
ServerRequest(ServerRequest),
Expand All @@ -15,10 +22,10 @@ enum Page {
ResetSettings = 1,
HardwareRequirements = 2,
SoftwareRequirements = 3,
Firewall = 4,
// PerformancePreset,
Recommendations = 5,
Finished = 6,
HandGestures = 4,
Firewall = 5,
Recommendations = 6,
Finished = 7,
}

fn index_to_page(index: usize) -> Page {
Expand All @@ -27,9 +34,10 @@ fn index_to_page(index: usize) -> Page {
1 => Page::ResetSettings,
2 => Page::HardwareRequirements,
3 => Page::SoftwareRequirements,
4 => Page::Firewall,
5 => Page::Recommendations,
6 => Page::Finished,
4 => Page::HandGestures,
5 => Page::Firewall,
6 => Page::Recommendations,
7 => Page::Finished,
_ => unreachable!(),
}
}
Expand Down Expand Up @@ -57,12 +65,14 @@ fn page_content(

pub struct SetupWizard {
page: Page,
only_touch: bool,
}

impl SetupWizard {
pub fn new() -> Self {
Self {
page: Page::Welcome,
only_touch: true,
}
}

Expand Down Expand Up @@ -110,15 +120,74 @@ impl SetupWizard {
Make sure you have at least one output audio device.",
|_| (),
),
Page::SoftwareRequirements => page_content(
Page::SoftwareRequirements => {
page_content(
ui,
"Software requirements",
if cfg!(windows) {
r"To stream the headset microphone on Windows you need to install VB-Cable or Voicemeeter."
} else if cfg!(target_os = "linux") {
r"To stream the headset microphone on Linux, you might be required to use pipewire and On connect/On disconnect script.
Script is not 100% stable and might cause some instability issues with pipewire, but it should work."
} else {
r"N/A"
},
|ui| {
#[cfg(windows)]
if ui.button("Download VB-Cable").clicked() {
ui.ctx().open_url(crate::dashboard::egui::OpenUrl::same_tab(
"https://vb-audio.com/Cable/",
));
}

#[cfg(target_os = "linux")]
if ui
.button("Download and set 'On connect/On disconnect' script")
.clicked()
{
match download_and_prepare_audio_script() {
Ok(audio_script_path) => {
request =
Some(SetupWizardRequest::ServerRequest(
ServerRequest::SetValues(vec![
PathValuePair {
path: alvr_packets::parse_path(
"session_settings.connection.on_connect_script",
),
value: serde_json::Value::String(audio_script_path.clone()),
},
PathValuePair {
path: alvr_packets::parse_path(
"session_settings.connection.on_disconnect_script",
),
value: serde_json::Value::String(audio_script_path.clone()),
},
]),
));
warn!("Successfully downloaded and set On connect / On disconnect script")
}
Err(e) => error!("{e}"),
}
}
},
)
}
Page::HandGestures => page_content(
ui,
"Software requirements",
r"To stream the Quest microphone on Windows you need to install VB-Cable or Voicemeeter.
On Linux some feaures are not working and should be disabled (foveated encoding and color correction) and some need a proper environment setup to have them working (game audio and microphone streaming).",
"Hand Gestures",
r"ALVR allows you to use Hand Tracking and emulate controller buttons using it.
By default, controller button emulation is set to prevent accidental clicks. You can re-enable gestures by disabling slider bellow.",
|ui| {
if ui.button("Download VB-Cable").clicked() {
ui.ctx()
.open_url(OpenUrl::same_tab("https://vb-audio.com/Cable/"));
ui.label("Only touch");
if basic_components::switch(ui, &mut self.only_touch).changed() {
request = Some(SetupWizardRequest::ServerRequest(
ServerRequest::SetValues(vec![PathValuePair {
path: alvr_packets::parse_path(
"session_settings.headset.controllers.content.gestures.content.only_touch",
),
value: serde_json::Value::Bool(self.only_touch),
}]),
));
}
},
),
Expand All @@ -135,30 +204,10 @@ This requires administrator rights!",
}
},
),
// Page::PerformancePreset => {
// ui.label(
// r#"Performance preset
// Please choose preset that fits your setup. This will adjust some settings for you.
// "#,
// );
// ui.horizontal(|ui| {
// // TODO correct preset strings
// if ui.button("Compatibility").clicked() {
// // request = Some(DashboardRequest::PresetInvocation(
// // "compatibility".to_string(),
// // ));
// }
// if ui.button("Visual quality").clicked() {
// // request = Some(DashboardRequest::PresetInvocation(
// // "visual_quality".to_string(),
// // ));
// }
// });
// }
Page::Recommendations => page_content(
ui,
"Recommendations",
r"ALVR supports multiple types of PC hardware and headsets but not all work correctly with default settings. For example some AMD video cards work only with the HEVC codec and GearVR does not support foveated encoding. Please try tweaking different settings if your ALVR experience is broken or not optimal.",
r"ALVR supports multiple types of PC hardware and headsets but not all might work correctly with default settings. Please try tweaking different settings like encoder, bitrate and others if your ALVR experience is great or not optimal.",
|_| (),
),
Page::Finished => page_content(
Expand Down Expand Up @@ -193,3 +242,27 @@ This requires administrator rights!",
request
}
}

#[cfg(target_os = "linux")]
fn download_and_prepare_audio_script() -> Result<String, Box<dyn Error>> {
use std::os::unix::fs::PermissionsExt;

let response = ureq::get(
"https://raw.githubusercontent.com/alvr-org/ALVR-Distrobox-Linux-Guide/main/audio-setup.sh",
)
.call()?;

let layout = alvr_filesystem::filesystem_layout_invalid();
let config_path = layout
.config_dir
.to_str()
.ok_or("Couldn't get config dir")?;
let audio_script_path = format!("{}/audio-setup.sh", config_path);
let mut out = File::create(audio_script_path.clone())?;

let script_body = response.into_string()?;
io::copy(&mut script_body.as_bytes(), &mut out)?;
fs::set_permissions(audio_script_path.clone(), fs::Permissions::from_mode(0o755))?;

Ok(audio_script_path)
}
7 changes: 2 additions & 5 deletions alvr/session/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,6 @@ pub struct VideoConfig {

pub clientside_foveation: Switch<ClientsideFoveationConfig>,

pub dynamic_oculus_foveation: bool,

#[schema(flag = "steamvr-restart")]
pub color_correction: Switch<ColorCorrectionConfig>,
}
Expand Down Expand Up @@ -1267,7 +1265,6 @@ pub fn session_settings_default() -> SettingsDefault {
vertical_offset_deg: 0.0,
},
},
dynamic_oculus_foveation: true,
color_correction: SwitchDefault {
enabled: true,
content: ColorCorrectionConfigDefault {
Expand All @@ -1276,7 +1273,7 @@ pub fn session_settings_default() -> SettingsDefault {
contrast: 0.,
saturation: 0.5,
gamma: 1.,
sharpening: 0.,
sharpening: 0.5,
},
},
},
Expand Down Expand Up @@ -1414,7 +1411,7 @@ pub fn session_settings_default() -> SettingsDefault {
enabled: true,
content: HandGestureConfigDefault {
gui_collapsed: true,
only_touch: false,
only_touch: true,
pinch_touch_distance: 0.0,
pinch_trigger_distance: 0.25,
curl_touch_distance: 2.0,
Expand Down
22 changes: 8 additions & 14 deletions wiki/ALVR-in-distrobox.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@

4. Firewall configuration is skipped entirely and setup firewall configuration is broken, so it might not work in case you have strict firewall (alvr docs should have info about that) (Low priority TODO).

5. Don't use SteamVR Beta (1.26+) version, it contains a lot of breaking changes that are yet to be tested to work with.

6. Some nvidia users might experience 307 steamvr crash - seemingly related to 530 driver, update or downgrade, should resolve the issue.

7. At the moment, most of the podman portability issues were fixed, but it's not done, so if you happen to have any kind of issues while running both this and other distroboxes from your system, please report them. I created some issues at podman side ([documentation issue](https://github.com/containers/podman/issues/18375), [storage configuration issue, which prevents complete isolation from runtime containers at the moment](https://github.com/containers/storage/issues/1587)) and [created PR](https://github.com/89luca89/distrobox/pull/718) for distrobox (WIP) to upstream the changes.

8. This script unlikely to work on external disks.
5. This script unlikely to work on external disks.

## Installing alvr distrobox

Expand Down Expand Up @@ -55,11 +49,11 @@ After installing ALVR you may want to configure it and steamvr to run at best qu

2. **Preferred framerate:** If you know that you will have lower fps than usual (for instance, VRChat), run at lower fps. This is because when reprojection (this is what allows for smooth view despite being at low fps) goes lower than twice the amount of specified framerate - it fails to reproject and will look worse. So for example, you can run at 72hz if you know you're expecting low framerate, and 120hz if you are going to play something like Beat Saber, which is unlikely to run at low fps.

3. **Encoder preset:** Quality
3. **Encoder preset:** Balanced

4. **Game Audio & Microphone:** Set to pipewire as has been said in installation. ALVR uses default audio sink for audio, and doesn't care about volume (it's controlled only onboard audio on headset), and automatic audio scripts mutes default audio by default to prevent mirroring. As for microphone, every time ALVR is connected on headset, on connect script creates audio source named **ALVR-MIC-Source**, which can be used in game as default microphone, if you set it at least once. No need to un-set it back to default. And when headset disconnects it automatically clears audio source and restores back to previous microphone.

5. **Bitrate:** Adaptive, maximum bitrate: 150 mbps, minimum bitrate: 100 mbps.
5. **Bitrate:** Constant, bitrate: 350-450 mbps for h264 wireless/700 mbit-1 gbit cabled, 100-150 mbps for HEVC.

6. **Foveated rendering:** This highly depends on given headset, but generally default settings should be OK for Quest 2. For **pico neo 3** i would recommend setting center region width to 0.8 and height to 0.75, shifts to 0 and edge ratios can be set at 6-7, and for the same **pico neo 3** disable oculus foveation level and dynamic oculus foveation.

Expand All @@ -73,13 +67,13 @@ After installing ALVR you may want to configure it and steamvr to run at best qu

### AMD-specific configuration:

1. Preferred codec: HEVC, h264 looked choppy and has visual "blocking".
1. Preferred codec: HEVC, h264 works too.

2. Reduce color banding: turn on, makes image smoother.
2. Reduce color banding: turn on, might make image smoother.

### Nvidia-specific configuration (needs feedback):

1. Preferred codec: h264
1. Preferred codec: h264, HEVC works too

After that, restart your headset using power button and it will automatically restart steamvr once, applying all changes.

Expand All @@ -93,9 +87,9 @@ Inside SteamVR you also may need to change settings to improve experience. Open

3. **Video tab: Fade To Grid** on app hang - this will lock your view to last frame when app hangs instead of dropping you into steamvr void, completely optional but you may prefer that.

4. **Video tab: Disable Advanced Supersample Filtering**
4. **Video tab: Disable Advanced Supersample Filtering**

5. **Video tab: Per-application video settings** - Use Legacy Reprojection Mode for specific game. This can drastically change experience from being very uncomfortable, rubber-banding, to straight up perfect. This essentially disables reprojection on SteamVR side and leaves it to the client. Make sure to enable it for each game you will play. If you don't see that button, it is possible that you didn't apply patch from installation script, which means that opening each game video settings will take a while and may not even catch up at all after multiple minutes. If you want to apply that patch, get into the container (read bellow in the end how to do that) and run the `./patch_bindings_spam.sh` with absolute path to your steamvr inside container directory (relative to scripts folder, `installation/arch-alvr/.local/share/Steam/steamapps/SteamVR`).
5. **Video tab: Per-application video settings** - Use Legacy Reprojection Mode for specific game. This can drastically change experience from being very uncomfortable, rubber-banding, to straight up perfect. This essentially disables reprojection on SteamVR side and leaves it to the client. Make sure to enable it for each game you will play.

6. **Developer tab: Set steamvr as openxr runtime** - this ensures that games using openxr (such as Bonelab, or Beat Saber) will use SteamVR.

Expand Down
46 changes: 14 additions & 32 deletions wiki/Hand-tracking-controller-bindings.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,20 @@
Current bindings for ALVR 14.0.0
Current bindings for ALVR 20
===

There's no trackpad/joystick position mapping.
To control state of gestures, you can toggle `Headset -> Controllers -> Gestures -> Only touch`
Enabled state means that gestures won't be triggered, disabled would mean all gestures are activated.

Oculus Rift S
Gestures
---
|Action|w/ handtracking pinch|w/o pinch|
|-|-|-|
|Trigger|index + thumb pinch|index finger curl|
|Joystick press|thumb press towards palm|thumb press towards palm|
|Grip press|middle, ring, pinky fingers curl|middle, ring, pinky fingers curl|
|A|right ring + thumb pinch| N/A |
|B|right middle + thumb pinch| N/A |
|X|left ring + thumb pinch| N/A |
|Y|left middle + thumb pinch| N/A |
|Menu button|left pinky + thumb pinch| N/A |
|Action|Handtracking pinch|
|-|-|
|Trigger|Pinch thumb and index|
|Joystick click|Curl thumb to palm|
|Grip|Curl middle, ring and little|
|Y/B|Pinch thumb and middle|
|X/A|Pinch thumb and ring|
|Menu button|Pinch thumb and little on left hand|

Valve Index
Joystick
---
|Action|w/ handtracking pinch|w/o pinch|
|-|-|-|
|Trigger|index finger curl|index finger curl|
|Grip press|middle, ring, pinky fingers curl|middle, ring, pinky fingers curl|
|Trackpad press|thumb press towards palm|thumb press towards palm|
|A|middle + thumb pinch| N/A |
|B|index + thumb pinch| N/A |
|System button|ring + thumb pinch| N/A |

HTC Vive
---
|Action|w/ handtracking pinch|w/o pinch|
|-|-|-|
|Trigger|index finger curl|index finger curl|
|Grip press|middle, ring, pinky fingers curl|middle, ring, pinky fingers curl|
|Trackpad press|thumb press towards palm|thumb press towards palm|
|Menu button|middle + thumb pinch| N/A |
|System button|ring + thumb pinch| N/A |
Activation is done through curling all 4 fingers and touching top of hand with thumb

0 comments on commit aaeecf5

Please sign in to comment.