Converting Vertical FOV to Horizontal FOV

3 views
Skip to first unread message

Luis Armengol

unread,
Jun 29, 2009, 2:57:28 PM6/29/09
to soft...@listproc.autodesk.com

Hi guys…

 

How can I convert a vertical FOV to Horizontal FOV. Im developing a plugin with an extern renderer but it only has horizontal FOV so I need to convert it.

 

Thanks in advance

Luis Armengol

Fabian Schnuer

unread,
Jun 29, 2009, 4:19:26 PM6/29/09
to soft...@listproc.autodesk.com
Well given a standard lens I think that should amount to:
VerticalFOV * ImageRatio = HorizontalFOV
400cm * 1.7777777 (16/9) = 711cm

Have a look at this.

http://www.tawbaware.com/maxlyons/calc.htm

Best regards,
Fabian

Antonin Messier-Turcotte

unread,
Jun 29, 2009, 4:52:11 PM6/29/09
to soft...@listproc.autodesk.com
Actually it's more complicated, the angle is not directly proportional to your ratio, I believe the right formula is:

Ratio = arctan (horizontal angle/2) / arctan (vertical angle/2)

2009/6/29 Fabian Schnuer <ad...@schnuer.com>

Antonin Messier-Turcotte

unread,
Jun 29, 2009, 4:55:25 PM6/29/09
to soft...@listproc.autodesk.com
Oh sorry Fabian, you were talking about lengths, but the formula I wrote should work for angles.

2009/6/29 Antonin Messier-Turcotte <anto...@gmail.com>

Luis Armengol

unread,
Jun 29, 2009, 5:03:22 PM6/29/09
to soft...@listproc.autodesk.com

Thanks to all for your help.

 

I was a radians/degrees conversion issue. In XSI scripting functions tan and atan works with degrees. In c++ those methods works in radians.

 

Regards

L

Fabian Schnuer

unread,
Jun 29, 2009, 7:28:02 PM6/29/09
to soft...@listproc.autodesk.com
Ah one of those things that comes around every once in a while and bites
you in the rear ;) And I should have probably been talking about angles
as length is a bit useless in this case.

-Fabian

Michael G

unread,
Jun 30, 2009, 2:32:49 AM6/30/09
to soft...@listproc.autodesk.com
Hi,
I do it like this:
// c is your camera object
if ((int)c.GetParameterValue(CString(L"fovtype"))==1) {
// calculate the proper FOV (horizontal -> vertical)
float hfov = (float)c.GetParameterValue(CString(L"fov"));
vfov=(float) (2* atan(1/(float)c.GetParameterValue(CString(L"aspect")) * tan(hfov/2*PI/180))*180/PI);
} else {
// keep vertical FOV
vfov=(float)c.GetParameterValue(CString(L"fov"));
}

Hope thats right and helps

Michael

Reply all
Reply to author
Forward
0 new messages