modifying performCamera.mel

david | mel script,rendering,tutorials | Tuesday, July 3rd, 2007

When you create a camera in Maya there are many attributes you can change to define the type of camera. The attribute I change most often is the "focal length". This is usually either a creative decision but maybe a practical one when matching live-action footage. If I set focal length to 10 then I get a wide-angle lens and if I set it to 70 I get a narrow (or long) lens. I've been doing this long enough to have a feel for what a 20mm lens looks like - but here's the problem. The view through the camera will only look like I expect if the "film aperture" is also set correctly.

Have a look at the following two pictures. Both use a 20mm lens and are in the same location - but they have different "Vertical Film Aperture" settings.focal20_filmBack1.jpg

focal20_filmBack2.jpg

The view through the camera is obviously very different. Maya provides several apperture presets in the in the "Film Gate" drop-down menu under the "Film Back" tab in the camera's attribute editor window.cameraAttributes.jpg

These may be a good start point if you are matching a real-world camera.

If several animators are all working on the same project it makes sense to have some rules about how cameras are set up. That way when the director asks for a 20mm camera the view will be what he or she expects. Which brings me to the subject of this post...

I once wrote a simple mel script so that everybody could easily create cameras with the attributes we all agreed upon. I gave it to all the animators. I asked them to use it. I thought that would ensure that our cameras were created consistently. I was wrong. It's just too easy for people to forget about my script and go to the "Create" menu and make a camera - with maya's default attributes. This can lead to problems much later in the project.

I have since taken a more hardline approach and modified performCamera.mel, the mel script that maya uses when ever it creates a camera. With the modified script installed on everybody's machine, the only way they can make a non-standard camera is if they do it on purpose.

My modified version now contains my own set of prefered attributes, which I tend to use 99% of the time. So when I create a camera the only thing I need to set is the focal length.

The modified version still lets you use the option box UI to create a customised camera, but the values you set are only used for that camera and are not stored as preferences.

You can download the modified performCamera.mel script here. Extract it and put it in your local scripts folder (so it will be used instead of the one that came with maya). Each change I made has been commented with the string // DJ MOD so you can see what I did and, if you wish, set your own preferences.

Powered by WordPress | Based on a theme by Roy Tanck