Calculate Angle of View

float $aperture = `getAttr perspShape.hfa`;
float $fl = `getAttr perspShape.focalLength`;
float $fov = $aperture * 0.5 / ( $fl * 0.03937 );
$fov = 2.0*atan($fov) / 3.14159 * 180.0;
print(" angle of view in degrees: " + $fov);

This piece calculates angle-of-view of a camera from its Focal Length and Horizontal Film Aperture.

Advertisements

1 Comment

Filed under MEL

One response to “Calculate Angle of View

  1. Thanks, this have been helpful for me converting maya camera to RIB format. But where do you get the number 0.03937 from?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s