[GUIDE] Finding the Mathematically Correct FOV & Multimon Settings For ANY Monitor Setup

Make your game even better
MrPapaBear
PPM
Posts: 98
Joined: June 2nd, 2020, 10:34 am

Re: Finding the Mathematically Correct FOV For ANY Monitor Setup

Post by MrPapaBear » July 26th, 2021, 10:47 pm

Wow then i got it pretty much correct calculated besides the little Error in the Instructions. Thank you. This is really a difference to setting it in-game, this really feels so much more realistic now. I just need to learn to drive again, because now it really is like small World- big truck. :gamer1: :shok:
MrPapaBear
PPM
Posts: 98
Joined: June 2nd, 2020, 10:34 am

Re: Finding the Mathematically Correct FOV For ANY Monitor Setup

Post by MrPapaBear » July 27th, 2021, 1:14 am

See this is what i was struggling with "2arctan" how the heck do i get that in a Calculator. I can do tan but how is it 2 tan? This is properly a question others will have too.
a1337cookie
Posts: 142
Joined: June 14th, 2021, 2:11 am

Re: Finding the Mathematically Correct FOV For ANY Monitor Setup

Post by a1337cookie » July 27th, 2021, 1:49 am

Ah, arctan means the same thing as inverse tan, sometimes written as tan^-1 or tan⁻¹. You can access it from most calculators by pressing 2nd/shift, then tan. I like writing arctan since it's the easiest and least confusing form in my opinion.

2arctan() means the same thing as 2*arctan(), the multiplication is implied. In your calculator, usually you can just type 2, then tan⁻¹, and it will know you are multiplying. In general, my formulas can be entered into a calculator exactly as they appear, and it should work. Just have to be careful with the parentheses; when in doubt, add parentheses around every variable that you are substituting.

Glad that the settings worked out for you by the way!
User avatar
Foxman
Posts: 23
Joined: February 18th, 2020, 11:06 pm
Location: New Zealand

Re: Finding the Mathematically Correct FOV For ANY Monitor Setup

Post by Foxman » July 27th, 2021, 3:17 pm

Thanks again for the help a1337cookie! I've managed to get things looking more or less perfect from my perspective. The view is stretched slightly through the lenses as expected but everything lines up so I can happily overlook the small amount of distortion. When things are in motion it's not something I notice at all. The only downside is that because my camera is placed at a different angle to my own head, the recorded view looks further off so I'll need to experiment with different placement to try and minimise that. Will hopefully get some new footage this weekend but here's where it's at so far from the drivers seat.

Image
a1337cookie
Posts: 142
Joined: June 14th, 2021, 2:11 am

Re: Finding the Mathematically Correct FOV For ANY Monitor Setup

Post by a1337cookie » July 31st, 2021, 10:42 am

Update 6: Finally added universal formula section and wrapped up vertical FOV section. Prerequisites section updated, with reference to new post about setting up virtual screen space. New things added to miscellaneous info section. Lots of small wording changes, and fixed mistake in vertical FOV section. Probably the last major update, I have nothing else planned at this time.
a1337cookie
Posts: 142
Joined: June 14th, 2021, 2:11 am

Re: Finding the Mathematically Correct FOV & Multimon Settings For ANY Monitor Setup

Post by a1337cookie » August 9th, 2021, 2:19 am

Off-Center Parallel Duals

Image

For off-center views, you will need to utilize the frustum subrect functions in multimon_config.sii to cut off a certain portion of the view, moving the center of projection to line up with one monitor. There are two important numbers: camera FOV, and subrect ratio. Here is a formula you can use to find them; it assumes there are two adjacent parallel monitors, and that the camera should be centered on monitor 1. You will need the width of both monitors (including bezels) and the distance from your eyes to monitor 1. For bezel correction, find the width of the two screens together, counting the inner bezels but not the outer ones. That can be used to find the corrected subrect ratio.

Code: Select all

x₁: monitor 1 width
x₂: monitor 2 width
y: distance from eyes to monitor 1
z: camera FOV

	z = 2arctan(((x₁/2)+x₂)/y)

s: subrect ratio

	s = (x₁+x₂)/(x₁+2x₂)

w: screen width
s': corrected subrect ratio

	s' = s(w/(x₁+x₂))

Tip: use degree mode on your calculator
Note: if you have trouble reading the subscripts (₁,₂), zoom in your browser
Accompanying diagram:

Image


Instructions:
  1. Find the camera FOV (z) and corrected subrect ratio (s') using the above formulas.
  2. In multimon_config.sii, change the horizontal_fov_override of your monitor to the camera FOV (z).
  3. Set the frustum_subrect_width and height to the corrected subrect ratio (s').
  4. Use frustum_subrect_y to center the image vertically; set it to (1-s')/2.
  5. Use frustum_subrect_x to shift the image horizontally:
    > If monitor 2 is left of monitor 1, set it to (s/2)-(s'/2).
    > If monitor 2 is right of monitor 1, set it to 1-(s/2)-(s'/2).
  6. Inner bezels can be corrected driver-side (Surround, Eyefinity).
a1337cookie
Posts: 142
Joined: June 14th, 2021, 2:11 am

Re: Finding the Mathematically Correct FOV & Multimon Settings For ANY Monitor Setup

Post by a1337cookie » August 9th, 2021, 2:20 am

Perpendicular Mismatched Multi-View Setups

This section is for setups where the monitors are physically different sizes, but you are still perpendicular to all of them. Common examples include 2 mismatched monitors or a bigger center monitor with 2 smaller matching side monitors. Example:

Image


In this case, the FOVs of the monitors will be different.

Image

To find them, we want to find the eye distance from one monitor that will allow us to be perpendicular to the other. Using that distance, we can calculate the FOV for that monitor. You can then apply the same process for the other monitor to find the FOV for that one. Here is the formula; you will need to know the width of monitors 1 and 2 (including bezels) and the angle between them. For bezel correction, you will also need the screen width (without bezels) of each monitor to find the subrect ratio.

Code: Select all

x₁: monitor 1 width
x₂: monitor 2 width
A: angle between monitors
y: distance from eyes to monitor 1

	y = x₁/(2tan(A)) + x₂/(2sin(A))

z: FOV of monitor 1

	z = 2arctan(x₁/(2y))

x: monitor width (of one monitor, with bezels)
w: screen width (of one monitor, without bezels)
s: subrect ratio (of that monitor)

	s = w/x

Tip: use degree mode on your calculator
Note: if you have trouble reading the subscripts (₁,₂), zoom in your browser
Accompanying diagram:

Image

Note: If you have three screens, work with just two adjacent ones at a time (middle and left, or middle and right). If your left and right screen are identical and at the same angle, just do one side, the other side will be the same. However, if the monitors are different, you may need to adjust the monitor angles to make sure you can be perpendicular to all of them. Finding (y) of middle monitor using the middle and left screens should give you the same result as finding (y) of middle monitor using the middle and right screens. If you are unsure of how to figure this out, ask me and I will help you.


Instructions:
  1. Find the FOV (z) and subrect ratio (s) of each monitor using the above formulas.
  2. In multimon_config.sii, change the horizontal_fov_override of each monitor to the FOV (z) of that monitor.
  3. Set horizontal_fov_relative_offset to 0 for all monitors.
  4. Set the heading_offset for each monitor:
    > For center monitor, set to 0.
    > For left monitor, set to A. (angle of left monitor)
    > For right monitor, set to -A. (angle of right monitor, but negative)
  5. Set the frustum_subrect_width and height of each monitor to the subrect ratio (s) for that monitor.
  6. Use frustum_subrect_y to center the image vertically; set it to (1-s)/2 for each monitor.
  7. Use frustum_subrect_x to center the image horizontally; set it to (1-s)/2 for each monitor.


Now as long as you sit perpendicular to all monitors, or at the distance (y) that you found (same thing), the views should look correct. Note that the above formulas work for matching perpendicular monitors too, it's just unnecessary, since the FOV is simply the monitor angle. However, the formula for distance from the monitor (y) may be of use, if you want to know what exact distance will put you perpendicular to all monitors.
Last edited by a1337cookie on September 16th, 2021, 4:16 am, edited 1 time in total.
a1337cookie
Posts: 142
Joined: June 14th, 2021, 2:11 am

Re: Finding the Mathematically Correct FOV & Multimon Settings For ANY Monitor Setup

Post by a1337cookie » August 9th, 2021, 2:22 am

Non-Perpendicular Multi-View Setups

This section goes over setups consisting of a centered middle monitor view, with adjacent side view(s) that may be non-perpendicular and/or a different size. A common case would be if you don't have room to (or otherwise can't) angle your side monitor(s) further forward, but sitting perpendicular to them would leave you too far away. With this, you can sit closer to your center monitor, while still getting the correct view on your non-perpendicular side monitor(s). Example:

Image


In this case, to get the correct view, the side view must overlap the center, and then be cut down using frustum subrect.

Image


Now, here are the calculations. Bear with me, there's quite a bit here. First, finding the FOV for the center monitor is easy, use the same formula as with a single screen setup. You need your eye distance from the monitor, and the screen's width.

Code: Select all

x: screen width (without bezels)
y: distance from eyes to monitor
z: camera FOV

	z = 2arctan(x/(2y))

Tip: use degree mode on your calculator
Next, we need the FOV of the side view and the subrect ratio (how much to cut off). If you have three monitors, only work with two adjacent ones at a time (middle and left, or middle and right). The following formulas assume that monitor 1 is the center one, and monitor 2 is adjacent to it at angle A. You will need the width of both monitors (include bezels), distance to center monitor, and angle between monitors. (Note: The helper variables are present to make calculation easier and presentation neater, they are otherwise not important. However, variables e and f are the distances from your eyes to the edges of monitor 2. You could technically skip some calculations by just measuring e and f, although the result may be less accurate.)

Code: Select all

x₁: monitor 1 width
x₂: monitor 2 width
A: angle between monitors
y: distance from eyes to monitor 1
a: helper variable
c: helper variable
e: helper variable
f: helper variable
z: FOV of monitor 2

	a = x₁tan(A)/2
	
	c = x₁/(2cos(A))
	
	e = √((a+y)² + c² - 2(a+y)(c)cos(90-A))		<--- Note the square root

	f = √((a+y)² + (c+x₂)² - 2(a+y)(c+x₂)cos(90-A))	<--- Note the square root
	
	IF e > f, THEN z = 2arccos((a+y)cos(A)/e), ELSE z = 2arccos((a+y)cos(A)/f)

s: subrect ratio of monitor 2

	s = x₂/(2(a+y)cos(A)tan(z/2))

Tip: use degree mode on your calculator
Note: if you have trouble reading the subscripts (₁,₂), zoom in your browser
Accompanying diagram:

Image


The following calculation is for bezel correction of the side views. The center view has already been corrected, as the calculated FOV already compensates for the bezels.

Code: Select all

x: monitor width (of one monitor, with bezels)
w: screen width (of one monitor, without bezels)
s: subrect ratio (of that monitor)
s': corrected subrect ratio (of that monitor)

	s' = s(w/x)


Instructions:
  1. Find the FOV (z) for all monitors, and the corrected subrect ratio (s') of each side monitor, using the above formulas.
  2. In multimon_config.sii, change the horizontal_fov_override of each monitor to the FOV (z) of that monitor.
  3. Set horizontal_fov_relative_offset to 0 for all monitors.
  4. Set the heading_offset for each monitor:
    > For center monitor, set to 0.
    > For left monitor, set to A. (angle of left monitor)
    > For right monitor, set to -A. (angle of right monitor, but negative)
  5. Set the frustum_subrect_width and height of each side monitor to the corrected subrect ratio (s') for that monitor.
  6. Use frustum_subrect_y to center the image vertically; set it to (1-s')/2 for each side monitor.
  7. Use frustum_subrect_x to shift the image horizontally:
    > For left monitor, set it to (s/2)-(s'/2).
    > For right monitor, set it to 1-(s/2)-(s'/2).


Note that these formulas also work for the perpendicular matching and perpendicular mismatched setups. In fact, it can even work for emulating a single view setup using multiple views; the monitor angle is simply 0°. You may want to do this if you don't have any driver-side bezel correction, such as if you are bypassing surround. You can use this for bezel correction, but the game performance will likely suffer, since you are rendering more camera views.
Last edited by a1337cookie on September 16th, 2021, 4:07 am, edited 1 time in total.
a1337cookie
Posts: 142
Joined: June 14th, 2021, 2:11 am

Re: Finding the Mathematically Correct FOV & Multimon Settings For ANY Monitor Setup

Post by a1337cookie » August 9th, 2021, 2:24 am

Shifting View Vertically

By default, the view will look correct if your eye level is at the center of the screen. However, you can change that if your screen is not positioned that way. In fact, it can be desirable to move your eye level upwards, as it can let you see more of your dashboard below. This is a way to mitigate one of the downsides of using lower FOV.

Real life:

Image

In Game:

Image


Perpendicular Setups

If you sit perpendicular to your monitor(s), here is the procedure. First, if you have two or more monitors adjacent to each other, you can find the perfect eye distance which will put you perpendicular to all monitors. Use this formula from an earlier section, repeating until you have a (y) value for each monitor.

Code: Select all

x₁: monitor 1 width
x₂: monitor 2 width
A: angle between monitors
y: distance from eyes to monitor 1

	y = x₁/(2tan(A)) + x₂/(2sin(A))

Tip: use degree mode on your calculator
Note: if you have trouble reading the subscripts (₁,₂), zoom in your browser
For the vertical FOV calculation, you will need the height of the screen (without bezels), the angle of your monitor (for center, the angle is 0°), and the distance from your eyes to the monitor (found above, or by measuring). Then, decide how much higher or lower you want your eye level to be, as a percentage of the height of the screen. For example, a normalized vertical displacement of 0.25 would put your eye level at 75% up from the bottom of the screen.

Code: Select all

h: screen height (without bezels)
A: monitor angle
y: distance from eyes to monitor
n: normalized vertical displacement
v: vertical FOV

	v = 2arctan((0.5+|n|)h/y)	<--- Note the absolute value on n

s: subrect ratio

	s = 1/(1+2|n|)			<--- Note the absolute value on n

Tip: use degree mode on your calculator
The above can be repeated for each monitor in your setup. The following instructions are intended for a multimon file which does NOT have horizontal FOV overrides applied already.


Instructions:
  1. Find the vertical FOV (v) and the subrect ratio (s) for all monitors, using the above formulas.
  2. In multimon_config.sii, change the vertical_fov_override of each monitor to the vertical FOV (v) of that monitor.
  3. Set horizontal_fov_relative_offset to 0 for all monitors.
  4. Set the heading_offset for each monitor:
    > For center monitor, set to 0.
    > For left monitor, set to A. (angle of left monitor)
    > For right monitor, set to -A. (angle of right monitor, but negative)
  5. Set the frustum_subrect_width and height of each monitor to the subrect ratio (s) for that monitor.
  6. Use frustum_subrect_x to center the image horizontally; set it to (1-s)/2 for each monitor.
  7. Use frustum_subrect_y to shift the image vertically:
    > For shifting eye level upwards (n>0), set it to 0.
    > For shifting eye level downwards (n<0), set it to 1-s.


Now as long as your eye level is at the height you used in the calculations (e.g. 75% up from bottom of screen for n=0.25), and you stay perpendicular to all monitors, your view will look correct.


Non-Perpendicular Setups

Once again, the above steps are for setups where you are perpendicular to the monitor(s). If your setup is not perpendicular, you will be shifting the view both vertically and horizontally. The easiest way to get the correct view is to do the horizontal and vertical portions independently.

For example, you would first do the procedure for non-perpendicular multiview setups, which would give you the correct horizontal view. Then, you would do the shifting vertically procedure above, but with a few key differences. The screen height and angle are straightforward, but you need to do something different for eye distance.

The distance to the center screen can be used as normal. For the side monitors, you need the “perpendicular distance”, which is the closest distance from your eyes to the imaginary plane that your screen is a part of. Using the same variables from the non-perpendicular multiview procedure, you can find that distance using this formula.

Code: Select all

(a+y)cos(A)
Then, the result can be used as the proper eye distance in the shifting vertically formulas. Finally, the rest of the instructions can be followed, except DO NOT change frustum_subrect_x or width.

I probably didn’t explain that very well, so if you need additional guidance on this, let me know.
a1337cookie
Posts: 142
Joined: June 14th, 2021, 2:11 am

Re: Finding the Mathematically Correct FOV & Multimon Settings For ANY Monitor Setup

Post by a1337cookie » August 9th, 2021, 2:25 am

Universal Formula

Warning, this is intended for advanced users, it will be quite math heavy. When measuring, I highly recommend physically placing something where your head will be and marking a reference point, representing the center of your head. Also, display an image on your monitor that will help you find the center of the screen, such as this one.

Image

We will use the head position as the origin in a 3D coordinate space, where positive x is forward, positive y is right, and positive z is up. The units can be whatever you prefer (millimeters, inches), just keep it consistent. We will also use the pitch and yaw of the monitor (I’m ignoring roll for now, it complicates things and is rarely useful). Positive pitch is tilting the screen down, while positive yaw is swiveling the screen left.

The following formulas will assume that you have a rectangular screen somewhere in front of you, and that the front of the screen is visible (not turned completely away from you). The formulas will calculate the horizontal and vertical FOV you need, as well as the subrect width, height, x, and y. Repeat the process for each monitor in your setup.

You will need to find:
  • The x, y, and z location of the CENTER of the screen relative to your head position.
    Image
  • The pitch and yaw of the screen relative to your straight forward view. A centered perpendicular monitor is 0°.
    Image
    Image
  • The width and height of the screen without bezels. For portrait orientation monitors, the height will be larger than the width.

====================================================================================================
x: screen x position
y: screen y position
z: screen z position
Y: screen pitch
Z: screen yaw
w: screen width
h: screen height
Fh: horizontal FOV
Fv: vertical FOV

Code: Select all

a = y*tan(|Z|)

b = y/(cos(|Z|)) - w/2

c = √((a+x)² + (b+w)² - 2(a+x)(b+w)cos(90-|Z|))		<--- Note the square root

d = √((a+x)² + b² - 2(a+x)(b)cos(90-|Z|))		<--- Note the square root

p = (a+x)cos(|Z|)

IF c > d, THEN Fh = 2arccos(p/c), ELSE Fh = 2arccos(p/d)

Code: Select all

i = z*tan(|Y|)

j = z/(cos(|Y|)) - h/2

k = √((i+x)² + (j+h)² - 2(i+x)(j+h)cos(90-|Y|))		<--- Note the square root

l = √((i+x)² + j² - 2(i+x)(j)cos(90-|Y|))		<--- Note the square root

q = (i+x)cos(|Y|)

IF k > l, THEN Fv = 2arccos(q/k), ELSE Fv = 2arccos(q/l)

sw: subrect width
sh: subrect height
sx: subrect x
sy: subrect y

sw = w/(2(p)tan(Fh/2))

sh = h/(2(q)tan(Fv/2))

IF arctan(y/x) > Z, THEN sx = 1-sw, ELSE sx = 0, CONDITION -90° < arctan(y/x) < 90°

IF arctan(z/x) > Y, THEN sy = 1-sh, ELSE sy = 0, CONDITION -90° < arctan(z/x) < 90°

Tip: use degree mode on your calculator
Note: if you have trouble reading the subscripts (h,v), zoom in your browser
====================================================================================================


Accompanying diagrams:

Image

Image


Instructions:
  1. Find the horizontal FOV (Fh), vertical FOV (Fv), subrect width (sw), subrect height (sh), subrect x (sx), and subrect y (sy) of each monitor using the above formulas.
  2. Repeat the following steps (3 to 7) for all monitors in multimon_config.sii using the values you found for each monitor. Ignore any “dummy” or unrendered monitors in the file.
  3. Set horizontal and vertical_fov_relative_offset to 0.
  4. Set the heading_offset to the negative yaw (-Z), and set the pitch_offset to the pitch (Y).
  5. Change the horizontal_fov_override to the horizontal FOV (Fh), and change the vertical_fov_override to the vertical FOV (Fv).
  6. Set the frustum_subrect_x to the subrect x (sx), and set the frustum_subrect_y to the subrect y (sy).
  7. Set the frustum_subrect_width to the subrect width (sw), and set the frustum_subrect_height to the subrect height (sh).


It might be tricky to measure the x, y, and z position of the monitor, since there's no coordinate grid to guide you. Luckily, you can usually do some easier measurements, such as head position to screen center, or from one screen to another, and use trigonometry to figure out the coordinates. Every setup will be different, so if you need help, ask me and I can give you some suggestions.
Last edited by a1337cookie on September 16th, 2021, 4:12 am, edited 1 time in total.
Post Reply