Advertisement
MikeOverbeck

QuickFOV

Jul 2nd, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. function QuickFOV(){
  2. //If you don't have an animated zoom, you can use this function to quickly calculate your FOV from Maya.
  3. var pi = Math.PI;
  4. var aspect = scene.defaultResolutionX() / scene.defaultResolutionY();
  5.  
  6. d = new Dialog;
  7. d.title = "Paste Focal Length and Horizontal Film Aperture.";
  8. var focalLength = new LineEdit;
  9. var camAp = new LineEdit;
  10. focalLength.label = "Focal Length";
  11. focalLength.text = "";
  12. camAp.label = "Horizontal Film Aperture";
  13. camAp.text = "";
  14. var group = new GroupBox;
  15. group.add(focalLength);
  16. group.add(camAp);
  17. d.add(group);
  18. rc = d.exec();
  19. if (!rc){
  20. return;
  21. }
  22.  
  23.  
  24. function FOV(CamAp, FocLen){
  25. var CamApMM = CamAp * 25.4; //converts inches to mm
  26. var CamApVert = CamApMM / aspect;
  27. var xrad = (Math.atan((CamApVert/2) / FocLen)) * 2;
  28. var AngleOfView = xrad*180/pi;
  29. return AngleOfView;
  30. };
  31. MessageBox.information("Your FOV value is " + FOV(parseFloat(camAp.text), parseFloat(focalLength.text)));
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement