Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Vindicus999
2025-06-07 23:33:27 +00:00
4 changed files with 14 additions and 7 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ Configuration is done on server side, in `$XDG_CONFIG_HOME/wivrn/config.json` or
All elements are optional and have default values.
## `scale`
Default value: `0.5`, `0.4` if headset supports eye tracking
Default value: `0.5`, `0.35` if headset supports eye tracking
Controls the size of the video stream, either a number between 0 and 1 or a pair of numbers between 0 and 1. If two numbers are provided the first one is horizontal scale and the second vertical.
Scaling is applied in a foveated fashion: the center has a 1:1 ratio and the rest is scaled so that the total number of pixels matches the desired scale.
+12 -3
View File
@@ -160,6 +160,13 @@ static float angles_to_center(float e, float l, float r)
return (e - l) / (r - l) * 2 - 1;
}
static float convergence_angle(float eye_x, float gaze_yaw)
{
const float c = 0.5; // simutaled convergence distance
auto b = c * std::sin(gaze_yaw) - eye_x;
return std::asin(b / c);
}
void fill_param_2d(
float c,
size_t foveated_dim,
@@ -224,9 +231,11 @@ void wivrn_foveation::compute_params(
.w = views[i].pose.orientation.w};
auto view = yaw_pitch(view_quat);
auto converge_angle = std::copysign(std::atan(std::abs(views[i].pose.position.x) / CONVERGENCE_DIST_M), views[i].pose.position.x);
tan_center[i].x = angles_to_center(e.x - view.x - converge_angle, views[i].fov.angleLeft, views[i].fov.angleRight);
tan_center[i].y = angles_to_center(-view.y - e.y, views[i].fov.angleUp, views[i].fov.angleDown);
auto angle_x = convergence_angle(views[i].pose.position.x, e.x);
tan_center[i].x = angles_to_center(view.x + angle_x, views[i].fov.angleLeft, views[i].fov.angleRight);
auto offset_y = (views[i].fov.angleDown + views[i].fov.angleUp) / 2;
tan_center[i].y = angles_to_center(-view.y - e.y, views[i].fov.angleUp, views[i].fov.angleDown) + offset_y;
}
}
-2
View File
@@ -28,8 +28,6 @@
struct render_resources;
#define CONVERGENCE_DIST_M 1.5
namespace wivrn
{
+1 -1
View File
@@ -351,7 +351,7 @@ std::vector<encoder_settings> get_encoder_settings(wivrn_vk_bundle & bundle, uin
uint64_t bitrate = config.bitrate.value_or(default_bitrate);
std::array<double, 2> default_scale;
default_scale.fill(info.eye_gaze ? 0.4 : 0.5);
default_scale.fill(info.eye_gaze ? 0.35 : 0.5);
auto scale = config.scale.value_or(default_scale);
check_scale(config.encoder_passthrough->name,