2
\$\begingroup\$

so I have the value of the FoV in degrees,
now I need to convert it to a zoom value of 2x, or 3x, for scopes and binoculars.

I placed some objects equally distanced between each other,
but when I zoom in from FoV 100 to FoV 90, (and I am calling that a 2x zoom), the visible objects in the edges of the reticle are not the ones I expected.
Yes, I am using this big FoV of 100 to 10 just to try to calculate the 2x, 3x value properly.

So I need the ending/maximum FoV to be at 10 degrees.

what happens in the highest zoom levels, from FoV 30 to 10, is that the zooming becomes too high and hard to control, so I wonder if I am calculating it wrong?

I mean, should the FoV steps, to let results of zoom 2x, zoom 3x, be not a fixed value like:
FoV 100 = zoom 1x
FoV 90 = zoom 2x
FoV 80 = zoom 3x
I should instead use some calculation to give me a result something like (or not like):
FoV 100 = zoom 1x
FoV 85 = zoom 2x
FoV 73 = zoom 3x
and what could be such calculation?

or should I use some other rule, like impose some FoV limits and fixed fov values instead of making any calculation?

\$\endgroup\$
7
  • 2
    \$\begingroup\$ 10x tells nothing about FoV. See The Truth About The X Optical Zoom and How do I convert lens focal length (mm) to x-times optical zoom?. Pick a reference point and a linear transformation of arctan that works for you. See also Virtual Cameras at Khan Academy. \$\endgroup\$
    – Theraot
    May 27, 2017 at 21:37
  • \$\begingroup\$ @Theraot I think I understand, I read the Nx is relative to the self lens minimum zoom capacity, what is pointless. But in a game, I think we expect something like a proportional increase in visible size (2x would show the object 2x bigger, 3x would be 3x bigger..), but that at near the maximum zoom it is still a nice to control the zooming in/out. \$\endgroup\$ May 27, 2017 at 22:17
  • \$\begingroup\$ Play with the formula. Try something along the lines of FOV = parameter_a* Math.Atan2(parameter_b,parameter_c*zoom) \$\endgroup\$
    – Theraot
    May 27, 2017 at 22:25
  • \$\begingroup\$ @Theraot must be that (it is a parabola calculation right?), I found this site desmos.com/calculator/lac2i0bgum, it let me prepare specific parabolas for 4x or 6x zoom times (x*10) with specific min and max FoV (y), now I am trying to make a generic formula that let me input the min, the max and a mid point, and may be that one you say will fit, let me try it. \$\endgroup\$ May 27, 2017 at 22:41
  • \$\begingroup\$ this site shows the full calc log, I think will do! emathhelp.net/calculators/algebra-2/parabola-calculator \$\endgroup\$ May 27, 2017 at 23:02

1 Answer 1

4
\$\begingroup\$

Technically changing the FOV isn't zooming, but it does the same thing, so let's not take that into account.

You can calculate the size of the view plane where the object lies using trigonometric functions:

width = tan(FOVX) * dist
height = tan(FOVY) * dist

(Make sure the angles are in radians, and FOVX is the horizontal FOV, which is equal to FOVY * aspect ratio)

Here is where you'll have to decide what you mean by zoom 2x. You can think in separate axes, and halve the width and height of the view plane at the object's position. This makes the object feel like it's doubled, but because it's in 2d, it will actually have an area 4 times larger than on the default value. If you want to make the area twice as big, then you'll have to multiply the width and height of the object by the square root of 2. For simplicity I'm going to refer to this value (either x or sqrt(x) for a zoom of x) as ZOOM_FACTOR.

Now we can reverse the algorithm I used above to find the width and height of the view plane. Because the sizes of this plane are linear (aka. a view plane at distance d is half as big as a plane at distance 2d), we can simplify it. The algorithm becomes

newFOVY = atan(tan(FOVY) / ZOOM_FACTOR)

This first calculates the size of the plane at distance of 1 with tan(FOVY), then calculates the new plane's size, then runs uses the result to calculate the new fov. As always, the input and output angles are in radians.

You can achieve the same thing by making the left, right, top and bottom parts of the projection matrix smaller or bigger depending on what you need.

\$\endgroup\$
4
  • \$\begingroup\$ do you think I could set a minimum FoV to be reached? it worked nicely using a max angle in degrees of 75 (that I converted to RAD), and gave me this results for 4 zoom steps (in degrees): 75, 62, 51, 43. I wonder if I could tweak that formula to let me go from 75 to 10 in 4 nice steps, any idea? yes, it seems my original question is missing a highlight for the minimum zoom level request, sry. \$\endgroup\$ May 27, 2017 at 22:11
  • \$\begingroup\$ I wonder if a parabola could be used? \$\endgroup\$ May 27, 2017 at 22:22
  • 1
    \$\begingroup\$ @AquariusPower Calculate the sizes for FOV 75 and FOV 10, then divide the difference between these value by 4 and multiply it by the current step's id (e.g. for a zoom of 3x multiply it by 3), subtract it from the default size and divide the result by the default size. Then you can run it back through the atan to get the FOV, basically: default = tan(75 / 180 * pi), newFOV = atan((default - tan(10 / 180 * pi) * STEP) / default) or simplified atan(1 - tan(10 / 180 * pi) * STEP / default) \$\endgroup\$
    – Bálint
    May 28, 2017 at 9:02
  • 1
    \$\begingroup\$ I think the algorithm should be: newFOVY = 2 * atan(tan(0.5 * FOVY) / ZOOM_FACTOR) since circular functions only work in right-angled triangle. \$\endgroup\$
    – Junkun Lin
    Dec 12, 2017 at 9:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .