Created
August 12, 2022 15:17
-
-
Save bvibber/f024b19bd548ab468afd88fcd1b0cd90 to your computer and use it in GitHub Desktop.
Calculate ideal viewing distance such that in-game FOV matches angular size in player's vision
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calculate ideal viewing distance such that | |
// in-game FOV matches angular size in player's | |
// vision. | |
// 34" 21:9 "ultrawide" | |
// approx 90-degree horizontal FOV in MSFS | |
distance({ | |
h_px: 3440, | |
v_px: 1440, | |
diagonal_in: 34, | |
fov_deg: 90, | |
}); | |
// 48" 4K monitor | |
// approx 70-degree horizontal FOV in MSFS | |
distance({ | |
h_px: 3840, | |
v_px: 2160, | |
diagonal_in: 48, | |
fov_deg: 70, | |
}); | |
function round1(val) { | |
return Math.round(val * 10) / 10; | |
} | |
function round2(val) { | |
return Math.round(val * 100) / 100; | |
} | |
function distance({h_px, v_px, diagonal_in, fov_deg}) { | |
// Derived data... | |
let aspect = h_px / v_px; | |
let diagonal_px = Math.sqrt(h_px * h_px + v_px * v_px); | |
let h_in = diagonal_in * h_px / diagonal_px; | |
let v_in = diagonal_in * v_px / diagonal_px; | |
let fov_rad = fov_deg * Math.PI / 180; | |
// Calc the viewing distance such that | |
// half of the FOV (from center to edge) is | |
// equal to half the width of the viewing plane | |
// | |
// Math.tan(fov_rad / 2) * dist == h_in / 2 | |
// | |
let dist = (h_in / 2) / Math.tan(fov_rad / 2); | |
console.log(`for ${round1(diagonal_in)} in diagonal with ${round2(aspect)} aspect and ${fov_deg} degree FOV`); | |
console.log(`${round1(h_in)} x ${round1(v_in)} inches viewing plane`); | |
console.log(`${round1(dist)} inches recommended viewing distance`); | |
console.log(''); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for 34 in diagonal with 2.39 aspect and 90 degree FOV | |
31.4 x 13.1 inches viewing plane | |
15.7 inches recommended viewing distance | |
for 48 in diagonal with 1.78 aspect and 70 degree FOV | |
41.8 x 23.5 inches viewing plane | |
29.9 inches recommended viewing distance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment