*** Version 2.0 of this script is available @ http://www.mattworkman.com/2014/01/04/previs-camera-tools-v2-0-for-maya-mel/ ” ***

The Script

I wrote this script earlier this year to automate creating cameras in Maya.  You can chose three common film backs:

  • Arri Alexa 1080 16×9
  • Red Epic 5k 16×9
  • Red MX 4k 16×9

Then you can chose to create the camera from the active viewport.  Watch the video if you want to see the script in action.

This saves a TON of time when creating new cameras in a scene without having to manually enter the filmback information and start from the origin when placing the camera.

Matt Workman Previs Tools: Camera Script v1.0 Code

// radio button group
window -title "Matt Workman Previs Tools" -rtf true previsWindow;
columnLayout;
radioButtonGrp
     -numberOfRadioButtons 3
     -label "Camera Type"
     -labelArray3 "Arri Alexa 16x9" "Red Epic 5k 16x9" "Red MX 4k 16x9"
     -select 1
     cameraType;

separator -w 500 -style "single";

radioButtonGrp
     -numberOfRadioButtons 2
     -label "Create Camera at"
     -labelArray2 "Current View" "Origin"
     -select 1
     fromView;

separator -w 500 -style "single";

button -label "Create Camera" -command "makeObj()" myBtn1;
showWindow previsWindow;

proc makeObj()
{
     if (`radioButtonGrp -q -select fromView` == 1)
     {
          if (`radioButtonGrp -q -select cameraType` == 1) makeCamera 0.935 0.526 "CamAlexa01" 1;
          if (`radioButtonGrp -q -select cameraType` == 2) makeCamera 1.02 0.571 "CamEpic01" 1;
          if (`radioButtonGrp -q -select cameraType` == 3) makeCamera 0.870 0.489 "CamREDMX01" 1;
     }
     if (`radioButtonGrp -q -select fromView` == 2)
     {
          if (`radioButtonGrp -q -select cameraType` == 1) makeCamera 0.935 0.526 "CamAlexa01" 0;
          if (`radioButtonGrp -q -select cameraType` == 2) makeCamera 1.02 0.571 "CamEpic01" 0;
          if (`radioButtonGrp -q -select cameraType` == 3) makeCamera 0.870 0.489 "CamREDMX01" 0;
     }
}

proc makeCamera( float $hfa, float $vfa, string $cName, int $fromV )
{
     if( $fromV == 0 )
     {
          camera
               -centerOfInterest 5 -focalLength 35 -lensSqueezeRatio 1 -cameraScale 1
               -horizontalFilmAperture $hfa -horizontalFilmOffset 0 -verticalFilmAperture $vfa -verticalFilmOffset 0
               -filmFit Fill -overscan 1 -motionBlur 0 -shutterAngle 180 -nearClipPlane 0.1 -farClipPlane 100000
               -orthographic 0 -orthographicWidth 30 -panZoomEnabled 0 -horizontalPan 0 -verticalPan 0 -zoom 1
               -n $cName;

          objectMoveCommand;
          cameraMakeNode 1 "";
          scale 30 30 30;
     }

     if ( $fromV == 1 )
     {
          camera
               -centerOfInterest 5 -focalLength 35 -lensSqueezeRatio 1 -cameraScale 1
               -horizontalFilmAperture $hfa -horizontalFilmOffset 0 -verticalFilmAperture $vfa -verticalFilmOffset 0
               -filmFit Fill -overscan 1 -motionBlur 0 -shutterAngle 180 -nearClipPlane 0.1 -farClipPlane 100000
               -orthographic 0 -orthographicWidth 30 -panZoomEnabled 0 -horizontalPan 0 -verticalPan 0 -zoom 1
               -n $cName;
          objectMoveCommand;
          cameraMakeNode 1 "";
          scale 30 30 30;

          $currentPanel = `getPanel -withFocus`;
          $currentCam = `modelPanel -query -camera $currentPanel `;
          print $currentCam;
          float $camPos[] = `xform -query -translation $currentCam`;
          float $camRot[] = `xform -query -rotation $currentCam`;
          move $camPos[0] $camPos[1] $camPos[2];
          rotate $camRot[0] $camRot[1] $camRot[2];
     }
}

9 thoughts on “MW Previs Tools: Camera Script v1.0

      • I’ve worked in Maya for over 13 years. I have done lots of work with film plates and CG comped it. However most of the time my cameras where generated by Boujou or SynthEyes Camera Trackers. I am now working on a stop motion film where most of the cameras moves are going to be made in Maya and then exported to After Effects. So having a rig like yours will certainly help create realistic camera moves for sure. Nice job.

  1. Hi Matt,

    Thanks for the usefull plugin. It really makes much easier to create a camera.

    Also It’s been couple of days I’m looking for a solution for HUD’s for the camera as in shot number, lens size, etc. And I haven’t found a reliable plugin. However I have fund HUD manager (www.creativecrash.com/maya/script/hud-manager)which is doing what I really needed but still some features are missing.

    It would be greate if you could include the HUD posibilities as well in your next update.

    Im doing a short film, if you are interested to know more about it please see the link. yasushazush.com/the-passage

    Cheers
    Yasush

  2. Hey Matt,

    very cool Idea!
    I just got one big question about your Aperture Sizes. Maya uses Inch values which I have to convert from Cm when I go to Red.com and look for the Red Epix X sensor size.
    It´s listed as 27.7mm (h) x 14.6mm (v)
    When I convert it precise I get
    1.090in (h) x 0.574in (v)

    You got in your Script:
    1.020in (h) x 0.571in (v)

    Why? Where is the bug?

    Next thing is that Maya relates there focal length to 35mm equivalent. So don´t you have to mutliply the “Crop Factor” when you alter the “Camera Aperture”?

    Big questions for me too, because I´m not sure if that is all right as is.

    Best regards! And I´m glad for feedback!

    • Hey!

      Glad you like the script, please check out the updated version of the script v2.0! http://www.mattworkman.com/2014/01/04/previs-camera-tools-v2-0-for-maya-mel/

      I appreciate the feedback about the sensor size/film back, it actually made me go back and check my numbers. However, I do believe my conversion were correct. I use the Abel Cine Digital Sensor chart for my film back data.

      http://resources.abelcine.com/files/2010/08/35mm_DigitalSensors_13.jpg

      They list the Red Epic/Scarlet 16:9 @ 25.9mm x 14.5mm. The 27.7mm is perhaps for a full frame Epic, which is actually something I should consider putting in.

      You are correct that Maya expects inches for the sensor size, which I really don’t understand in the first place. If I remember correctly Maya rounds to the second or third decimal. Going by the Abel chart the filmbacks have the correct number, but if you want the full frame 27.7mm then you are correct then numbers are off.

      However, I think that in practice you wouldn’t really notice much difference if you were using it for previs. If you are trying to match an actual Epic frame to the Maya camera then it might be a problem, but you might want to have Boujou or Nuke generate the 3D camera for you anyway.

      I don’t believe you need to include the “crop factor” for this script. In the new script you can assign a focal length by the way! Crop Factor is used to compare the same physical lens on different film backs, so a 7D has a crop factor of 1.3x compared to a 5DMKIII. But this script changes the filmback so you can just use the focal lengths with out worrying about the crop factor, which is actually the point of the script in the first place. Where if you want to compare a 35mm on a 5D and 7D, you just switch the filmback and leave the focal length.

      I could be mistaken, but from my understanding the maths are sound. I could ask a friend of mine at The Mill or the Technodolly US rep to double check me though.

      Cheers,

      Matt

Leave a Reply

Your email address will not be published. Required fields are marked *


+ nine = 14

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>