# MEL - Angle of View

 02 February 2013 #1 Limbus Respect The Architect   portfolio Florian von Behr 3D Artist The Scope GmbH & Co. KG Bremen, Germany   Join Date: Jan 2003 Posts: 485 MEL - Angle of View Hi there, is there any way to read the Angle of View (instead of the Focal Lenght) of a camera via MEL or and expression? It seems there is no getAttr or setAttr for it. If this is not possible, how would I calculate the AOV from the Focal Length? Cheers, Florian share quote
 02 February 2013 #2 Nyro Lurking   portfolio A. D. Vertex Slinger Munich, Germany   Join Date: Dec 2006 Posts: 1,436 Sure: You need to known factors: the focal length f and the size of the camera aperture d (actually the film/ccd sensor size, but in Maya this would be the effective aperture). By default, aperture is equal to a 35mm image. While there are actually 3 angles of view (vertical, horizontal and diagonal), Maya only shows us the horizontal angle, as calculated by the following formula: angle of view = 2 x atan(d / (2xf)); In MEL: `````` float \$d = 35; // film width float \$f = 50; // focal length float \$ratio = \$d / (2 * \$f); float \$a = 2 * atan(\$ratio); // angle in radians \$a = rad_to_deg(\$a); // angle in degrees`````` In Python: ``````import math def aov(d,f): a = 2 * math.atan(float(d) / (2*float(f))) a = math.degrees(a) return a a = aov(35,35) print a`````` Note that Maya seems to use some rounding internally, so the resulting values are not exactly identical. __________________ aweControlPicker (GUI Picker for Maya) share quote
 02 February 2013 #3 Limbus Respect The Architect   portfolio Florian von Behr 3D Artist The Scope GmbH & Co. KG Bremen, Germany   Join Date: Jan 2003 Posts: 485 Vielen Dank. Gonna try it tomorrow. Cheers, Florian share quote
 02 February 2013 #4 CGTalk Moderation Expert   Join Date: Sep 2003 Posts: 1,066,473 Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.