Skip to content

Instantly share code, notes, and snippets.

@codyhan94
Last active November 18, 2021 01:18
Show Gist options
  • Save codyhan94/648149bbad957792aefb8e070649d7d3 to your computer and use it in GitHub Desktop.
Save codyhan94/648149bbad957792aefb8e070649d7d3 to your computer and use it in GitHub Desktop.

overwatch is 16MF9 while source is 4ML3, search these terms in this discord for some definitions for them. let us arbitrarily set your screen resolution to w x h for width/height.

note. i call fortnite 80hML in the examples below; this is not exactly true, fortnite is 16MI9, see this document for more information about FILM notation

intro

the key idea here is to match focal length between games (or more precisely FoVs), which is the normal distance from the camera (you) to the canvas upon which the game is drawn. matching this length causes objects moving at the same velocities in both FoVs to have the same motion on your screen, which is arguably the most important part of aiming.

how do we calculate focal length? if we know how our game scales its implicit image, and its nominal FoV, then we can compute the focal length with some geometry/trig. you are one question or google search away from figuring out your nominal FoV and which dimension it measures (vertical, horizontal), so we will assume you know FoV and use the horizontal dimension for calculations here as most FoVs measure horizontally.

------ w ------
       |     /
     f | A /
       | /
       o

above is a picture of the setup for the computation. A = FoV/2 because we are drawing a normal from the camera to the canvas which bisects the canvas. w is the width of your screen in pixels and f is the focal length that we are interested in. a little bit of high school trig yields:

tan(FoV/2) = (w/2) / f
f = (w/2) / tan(FoV/2)                  (1)

[OW@1920, 103]: f = (1920/2) / tan(103/2 deg) = 763.61848 px

armed with this, we can go do the inverse calculation to find the FoV we need on a different measurement. suppose we know f and w - then we can rearrange the equation to solve for FoV:

tan(FoV/2) = (w/2) / f
FoV = 2 * arctan(w/2f)

to figure out the required FoV for your new game, we need to know the dimensions of its implicit resolution and which dimension it locks - even though we are playing on w x h resolution on it (where w and h come from the old resolution), we cannot use the same values of w and h if the implicit image has a different ratio than the original, because the game adjusts its FoV to fill your screen rather than match some arbitrary focal length that you want. following are two examples, one to convert to 4ML3 (source, QL) and the other to 80hML (fortnite).

OW103 to 4ML3 example

in 4ML3 the vertical FoV is locked, so we can compute it:

FoV = 2 * arctan(h/2f)

[OW@1920x1080, 103]: FoV = 2 * arctan(1080 / (2 * 763.61848)) = 70.532 deg

now that we know the vertical FoV, we can compute the horizontal FoV from it (which is NOT vFoV * aspect_ratio) by using the focal length as a pivot:

f = (w/2) / tan(hFoV/2) = (h/2) / tan(vFoV/2)
tan(hFoV/2) = tan(vFoV/2) * (w/h)
hFoV = arctan(tan(vFoV/2) * w/h) * 2

the final line is what you would find if you googled "converting between horizontal and vertical FoV" and the reason it is not a simple multiplication of aspect ratio is because FoVs are a rectangular projection of angles extending into 3D space. let's plug in the values that we have to arrive at our final answer...

hFoV = arctan(tan(70.532/2 deg) * 4/3) * 2 = 86.631 deg

note that if you just plug this directly into a calculator you will get your result in radians; multiply by 180/pi to get your answer in degrees (or if you are using google search bar as your calculator [as you should!] you can just add "in deg" to the end of the query).

OW103 to 80hML example (1080p, 1440p)

now let us consider converting to 80hML (fortnite). fortnite has no FoV slider but because of its unique way of resizing the image, you can match a focal length by changing your resolution. recall that 80hML means that your horizontal FoV is locked at 80 deg, but you can get more vertical FoV by changing your resolution. suppose we want to match the focal length of 103 OW. Then we use the equation (1) because we know the hFoV to find

763.61848 = (w/2) / tan(80/2 deg)
w = 1251.5 px

which suggests that you should change your resolution to 1252x1080 to have a focal length that matches OW103.

suppose you are playing on a 1440p monitor so that you want 1440 pixels in the vertical dimension. then we recalculate the focal length from OW103 first (or whatever you want to start with) using (1):

f = (w/2) / tan(FoV/2)
f = (2560/2) / tan(103/2 deg)
f = 1018.15797 px

Plug again into (1) while fixing hFoV to be 80 and you get

1018.15797 = (w/2) / tan(80/2 deg)
w = 1708.67

so you should play on 1709x1440 to get the same focal length as OW103.

i have used OW103 as a "starting point" often here; there is nothing special about it, all it does is specify some focal length that you prefer. if you have played another game a lot and are used to aiming in it, then compute its focal length using equation (1) and follow the examples in the conversions to get your FoV in another game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment