UEVR icon indicating copy to clipboard operation
UEVR copied to clipboard

Update FoV dynamically when HMD FoV changes

Open Asxcvbn opened this issue 4 months ago • 3 comments

https://github.com/praydog/UEVR/issues/371

Note that this is a very simple and awkward fix of the issue and I dont think it is good to merge yet. I need some help improving it.

Key idea: OpenXR::update_matrices() is, i guess, called every frame. The projection matrix(for intricsic parameters) update are somehow skipped in the function. And since convergence settings are effectly changing the intricsic parameters, we got convergence settings ignored in uevr. So to fix it, we just force the projection matrix update every 100frames (in case it is expensive, which looks unlikely).

To improve it, I have 2 ideas.

  • (A) we force the projection matrix update every call of OpenXR::update_matrices(). But it can have some cost
  • (B) we cache this->views[0].fov and this->views[1].fov. if this call's these variables are different from our cached version, we update the projection matrix.

Asxcvbn avatar Sep 14 '25 06:09 Asxcvbn

Sorry for the awkward commit title. It is written without much mind and as a sentence it looks incorrect. We can fix it later when merging if it got updated and merged later.

Asxcvbn avatar Sep 14 '25 07:09 Asxcvbn

Selected road (B):

Implemented FOV change detection for dynamic projection matrix updates.

  • Mechanism: The FOV values for both eyes (8 floats total from this->views[0].fov and this->views[1].fov) are cached in this->last_fovs each frame.
  • Comparison: A memcmp checks for exact bitwise equality between the current and cached FOV data.
  • Action: On any change (fov_updated == true), the projection matrix is recalculated and the new FOV values are cached into this->last_fovs.

Asxcvbn avatar Sep 19 '25 08:09 Asxcvbn

@Asxcvbn you might update your PR title if you can. Maybe: Update FoV dynamically when HMD FoV changes?

I tested it and it works great!

@praydog this MR is a great improvement for users with 3D displays that use VRto3D, WibbleWobble, etc. It allows us to change the FoV dynamically to adjust the strength of the 3D effect. It is also useful for quickly finding the right horizontal FoV for the gameplay.

oneup03 avatar Sep 23 '25 05:09 oneup03