- Home /
How can I extract the FOV information from the projection matrix?
Hello. I made a somewhat similar inquiry a few days ago. But I'm currently trying to patch Unity games for stereo 3D support. I need to account for changes in FOV and I'm not sure how to extract the FOV information from the projection matrix. I really don't know much about coding. I'm currently using a custom wrapper to dump & edit the vertex & pixel shaders (in ASM).
Thanks in advance.
Answer by Luckymouse · Dec 27, 2015 at 11:05 AM
I use the unity_CameraProjection matrix to calculate the FOV in shader. Here is the formula:
float t = unity_CameraProjection._m11;
const float Rad2Deg = 180 / UNITY_PI;
float fov = atan(1.0f / t ) * 2.0 * Rad2Deg;
If you want to calculate in C#, check out the link here.
Your answer
Follow this Question
Related Questions
Possible to use an oblique frustum camera and still be able to change the fov? 1 Answer
How do I get an off-center camera view, without breaking FOV & aspect ratio? 1 Answer
With a perspective camera: Distance independent size gameobject 5 Answers
Can you serialize custom camera projection matrices? 1 Answer
WorldToViewportPoint and ViewportToWorldPoint math 2 Answers