- Home /
Understanding Gun Scopes & Fov
I'm working to create a semi-realistic weapon simulator prototype. I am not asking for any code on "Sniper scope zooming", as that has been asked numerous times before.
At the moment I'm trying to implement scope magnification. For example, I'm attempting to implement a 4x magnification scope, where 200 yards(183 meters) would appear to be 50 yards(46 meters) within the scope. This is crucial for the Russian variety of scopes that have built-in range finding. (See below for picture) The ability of these scopes are distorted when fov comes into play.
Is there any way to correlate a scope's magnification to a camera's fieldOfView, or is there another way to deal with zooming altogether to achieve this effect?
Answer by robertbu · Jul 31, 2013 at 07:58 AM
You can find the equations for the field of view here:
http://docs.unity3d.com/Documentation/Manual/FrustumSizeAtDistance.html
Given a starting FOV, you can calculate the FOV to get a particular magnification like this:
var magnification = 4.0;
var factor = 2.0 * Mathf.Tan(0.5 * nonZoomedFOV * Mathf.Deg2Rad);
var zoomedFOV = 2.0 * Mathf.Atan(factor / (2.0 * magnification)) * Mathf.Rad2Deg;
This makes the assumption that having a magnification of 5X means you see 1/5 as much vertically.