Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function QuickFOV(){
- //If you don't have an animated zoom, you can use this function to quickly calculate your FOV from Maya.
- var pi = Math.PI;
- var aspect = scene.defaultResolutionX() / scene.defaultResolutionY();
- d = new Dialog;
- d.title = "Paste Focal Length and Horizontal Film Aperture.";
- var focalLength = new LineEdit;
- var camAp = new LineEdit;
- focalLength.label = "Focal Length";
- focalLength.text = "";
- camAp.label = "Horizontal Film Aperture";
- camAp.text = "";
- var group = new GroupBox;
- group.add(focalLength);
- group.add(camAp);
- d.add(group);
- rc = d.exec();
- if (!rc){
- return;
- }
- function FOV(CamAp, FocLen){
- var CamApMM = CamAp * 25.4; //converts inches to mm
- var CamApVert = CamApMM / aspect;
- var xrad = (Math.atan((CamApVert/2) / FocLen)) * 2;
- var AngleOfView = xrad*180/pi;
- return AngleOfView;
- };
- MessageBox.information("Your FOV value is " + FOV(parseFloat(camAp.text), parseFloat(focalLength.text)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement