Export AE Camera to Maya

All things .jsx

Moderator: Paul Tuersley

urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

Hey Russ, Try the link again. Same name, but it's now version 1.12. I was wrong twice about what the source of the bug was. It was due to me moving lines to the top of the script, which screwed up the assigning of some variables...it's kind of strange the script ran at all. Often if a variable has no value you get an error message, but this time it sliped by...the X and Y values were being divided by "null", the result of which was "NaN", because some variables were undefined. That's also why if you ran the script a second time, it would sometimes work because it remembered the values from the last try.

That should be fixed now, and should work in Jeff's "Script Launcher" (although, as he says on his website, the error checking doesn't work anymore...so nothing happens sometimes if there is an error...not sure if that can be fixed as yet).
ymmij
Posts: 28
Joined: December 1st, 2006, 1:20 pm

urbanspaceman wrote:
ymmij wrote:Are you saying that you have made a change to version 1.1?
Yes. I'm self taught in this programming thing, so I don't have a programmer's habits yet. I'll make a point of documenting my changes in the future, now that I know others are paying attention. : )

Thanks for adding that version #. I tried 1.12 but that seemed to introduce new problems. I had selected the camera, and I received three dialog boxes. First just said '512' on it, the second said '288' and the final said 'Unable to execute script at line 240.Execution halted'. I tried it with both 'layer name' and 'Source Name' and received the same results.

I went back to version 1.1 and the selection of the camera layer worked fine.

Cheers,

Russ
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

urbanspaceman wrote:there wasn't a big speed increase because writing the .ma file (what your code is doing, basically) wasn't what took that long
not exactly, it retrieves the data and writes them to file which is basically what an export script does.
urbanspaceman wrote:it's the code I'm using to imitate the "Covert Expression to Keyframes" assistant that is slow
actually I don't think you have to create a single keyframe in this script. Take a look at my version: exportCam.zip, which is based on your two scripts (AE_CameraToMaya and AE_CameraToMax). Note that I don't have Maya nor Max to test the script...

If you look inside the code you'll see that there is only one for loop, in which all data are retrieved at the same time (as strings). I've designed a little ui (AE 7 or later is required) to make it more user friendly. The progress bar works fine Windows, hopefully Adobe will fix it on Mac if it is broken (I think Lloyd has already mentioned this problem).

Image
urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

ymmij wrote:I tried 1.12 but that seemed to introduce new problems
That's what I get for trying to rush something on Friday at the end of the day! Now it's version 1.13.

And nab, that's so much for doing that. I'm going to look over your script tonight...I'm learning a lot about programming as I go, and you've got a good sense of how to make things more efficient. We've got some good team work happening here, it's great. Thanks, both you guys.
ymmij
Posts: 28
Joined: December 1st, 2006, 1:20 pm

urbanspaceman wrote:
ymmij wrote:I tried 1.12 but that seemed to introduce new problems
That's what I get for trying to rush something on Friday at the end of the day! Now it's version 1.13.

And nab, that's so much for doing that. I'm going to look over your script tonight...I'm learning a lot about programming as I go, and you've got a good sense of how to make things more efficient. We've got some good team work happening here, it's great. Thanks, both you guys.
Version 1.13 fixed up my problems. Great...back on track. Looks like nab has added a few of the interface extras to tidy this up. Look forward to your your next revision.

Russ
agrapha
Posts: 8
Joined: March 22nd, 2006, 11:04 am

This tool already exists, and a lot more. It was written years ago for the IMAX film Magnificent Desolation, and was rolled off to a series of publicly sold scripts.

Go to High-end 3D and download the Mocon set of scripts. Programmed by Barry Berman of 3Dmation. He used to sell this, but recently went open source with it.

http://www.3dmation.com


AG
Shayder
Posts: 8
Joined: April 8th, 2008, 10:50 am

Is there a way to get nulls or some sort of place holder to export as well? this would certainly help in the placement of 3d objects in maya.
urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

One of the reasons I wrote this script is because MoCon doesn't work. I purchased it a few years ago. Not that it was expensive, but I was very disappointed with it and upset that it didn't perform as promised, and I wasted a lot of time trying to get it to do what it's supposed to.

I studied Mr. Berman's script and I figured out why it wasn't working. He didn't write in the proper code for the rotations. You may not notice this if you use MoCon and your animation only has simple moves on one axis (a camera pan, for example), but as soon as you use two rotation axes, you're screwed and your camera is pointing in the wrong direction. This makes the script useless to me.

He didn't really do the focal length properly either, so you have to use Maya as a calculator to give you the values you need to enter into the script. Again, this was no good to me, because I don't have Maya on my machine at home or work. It was a hassle to stop the Maya artists I was working with and ask them give me the filmback values (and then find out it didn't matter, the camera's pointing the wrong way!). I've learned that this is totally unnecessary...all the field of view (FOV), focal length, and aperture are are the dimensions of a 4 sided pyramid. If you have 2 of the dimensions you can figure out the third, and then you just have to know where to plug the values in to the other software. All the information is already there in After Effects, you shouldn't have to go to Maya to figure it out.

The scaling is a problem too. Every time I gave the .ma file to an animator the camera was so big that the animator couldn't find the camera. All I did was divide everything by 100, and the problem was solved.

So I speak from experience...MoCon performed so badly, it drove me to pick up a book on linear algebra! And I went to art college, not programming school!
urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

Shayder wrote:Is there a way to get nulls or some sort of place holder to export as well? this would certainly help in the placement of 3d objects in maya.
Hey Shayder, I'm working on that right now. Keep checking this thread. I've done a rough version for Lightwave, did a project with it, and it worked great. I'm spending some time to make it easier to use, make the code faster (thanks to nab), and to add a few more features, like non-uniform scaling.
agrapha
Posts: 8
Joined: March 22nd, 2006, 11:04 am

I disagree. Mocon has worked flawlessly for me for 2 years, and seen service in several high-end productions. It has its limits, to be sure, but I would not disparage it so quickly. There are things I would like to change about it...if only it were open source. (oh wait, it is).

The reason the number out of AE into Maya is so large is that it maintains parity of units between the apps. That is critical when passing information between the several 3d and 2d apps it supports.

as a note, it is best to stay in default centimeters at all times, and you are fine, first off. One centimeter can equal whatever scale you tell it to. It is just a number. It can be a foot, inch, meter, car-length... the unit is up to you. (Granger Units to you old EIAS folks). I also prefer the full-ap over any other mode. And yes, that could be more automated.

If starting from AE, that is where the image size issue begins. i.e. a 4096 wide image is already a large frame, but add the 3D camera to that, the numbers get bigger. Dividing the values by 100 is a good scaling approach, but that too is arbitrary.

Sorry you had a hard time with it. I hope the extravagant $20 price tag did not hurt. I am happy that you are finding other ways to crack into the data sharing that all apps must have.


AG
3dmation
Posts: 2
Joined: January 19th, 2006, 6:40 pm
Location: Los Angeles

I was just told I was flamed here, so was encouraged to respond. I'm sorry this person feels this way about MoCon. I know that MoCon is used in several companies to do film, tv and game compositing. Whenever someone submits bugs, I work through them, and have always given upgrades for free. The latest version, I've opened as open source, and have encouraged people to develop upgrades that they want so that we can release updates for all at once.

You mentioned that rotation code wasn't included, and sorry, you are incorrect. The rotation parameters are split between AE's rotation and orientation attributes. This was done to prevent node lock in certain instances. In the notes, this is mentioned, and tells the user to plan their animation accordingly.

Focal length has always been included, and film back is needed, especially when using mixed cameras vs render formats. Many packages support film back directly in their compositor for this reason (ie, Nuke, Fusion). Because AE doesn't, doesn't make that feature an oversight in MoCon.

I think that's about it. It sounded like their was a bit of anger in the posts, and I think that's regrettable. MoCon has always strived to be a useful, friendly and approachable tool, extending the abilities of AE and allowing more freedom towards compositing and effects. It's a shame you think otherwise.

Barry Berman
3Dmation Visual Effects
urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

It wasn't quite anger, it was frustration. I know it wasn't that professional, but it was genuine. I apologise if my post came across as unfriendly, and I admit there's a bit of hyperbole in there. I have struggled with to get MoCon to work about 5 times in the last 2 years, with almost no success, and I get a bit emotional about it.

Every time I tried it the camera was pointing in the wrong direction. Did I use it incorrectly? Perhaps. To be fair I never contacted you Barry to ask for your advice. I assumed I was using it incorrectly and must be dumb.

Over those years I gained enough new scripting knowledge to investigate what was going on. Instead of adding to the open source code of MoCon, I decided to start over and create something that would fit my particular needs, which is animation for television. If you want to take what I'm doing and add it to MoCon, I support that (as long as it's kept free of course)...it just made the most sense to me personally to build something new from the ground up, because I wanted a deeper understanding.

To be clear, I didn't say that you didn't include focal length and rotation in the plug in. A filmback setting for video cameras, though, isn't included...so what do you do if you're not imitating a film camera? I personally find it confusing and a little hard to use starting from AE that doesn't work in any real world units. (What I've basically done is made all video camera filmbacks 1 inch tall, 1.333 inches wide for SD, 1.777 inches for widescreen SD. Are these the actual dimensions of the real thing? I believe there are too many kinds of video cameras out there and there there's no standard. Correct me if I don't understand this, but the only reason to imitate the aperture size exactly is to match depth of field settings. On a TV schedule there's usually not enough time to bother imitating this exactly...with film compositing I can see it being important some of the time)

And, as I said, I've never got the rotations to work. Even when I worked the way you recommended (which I did read), it still didn't match. Maybe on that one occasion I made a mistake, but I had to move on at that point after struggling for a few days. After studying your script I see what you've done...you are reading the Y value of orientation and X and Z rotation values and copying them directly into Maya. In theory this should work as long as you don't touch the other rotations values and don't use parenting, but I couldn't get it to match even when I did that and tried all the different rotation orders in Maya.

Assuming I did make a mistake in that case and it does work, the way you've written the rotations is, to be frank, too limited for me (It's less hyperbolic to say that then "it doesn't work properly"). There are many cases where you must use parents or different rotation orders. I understand that you can't please everyone, and I can't blame someone for spending a lot of time on perfecting a script that does this reverse workflow which so few people use.

Again, if you want to incorporate my improvements into MoCon, feel free. We can also work together on that if you wish as well, once I've finished the full script which combines export to Lightwave and MAX.

Ryan
urbanspaceman.net
3dmation
Posts: 2
Joined: January 19th, 2006, 6:40 pm
Location: Los Angeles

What you've made isn't really a film back for video cameras, similar but not the same. The film back for a video camera would be the size of the chip itself and some animation packages even include that. What you've decided to use for that is something based on the aspect ratio which can be useful too. Note this ability IS in MoCon, as the custom filmback option, you put in your own custom height and width. However, having a 'use aspect ratio option' sounds like a quick and dirty way of ignoring doing the full route. Using a film back option, allows you to extend more abilities, not just dof, but also projections like in a 3D package. AE will eventually add that option in it, no doubt in my mind. I'll take you up on your offer of adding the other export options, and take a look at what you are doing with your export code. It's possible, I can correct for the node lock fix under the hood, giving rotation freedom AND error correction. I'll keep an eye on it, and get that update out after tax season. I've got a bunch of updates to get in there.

Barry Berman
3Dmation Visual Effects
urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

3Dmation wrote:What you've decided to use for that is something based on the aspect ratio which can be useful too.
That's exactly right. I'm no expert, but I'd guess some of the best video cameras have a chip that's an inch high. Most home video cameras are probably much smaller. So I thought I'd make it simple and use "1". An option like "default AE camera" or something similar would help...for people who don't really need to match the film back size exactly or don't have a real world camera to match at all (it's the field of view angle that's much more important, anyway. Could also be called "Virtual camera" or something similar). Yes, you are right that you've included the custom filmback option...but it took me a while to figure out I could just type in 4:3 or 16:9 ratios for video and it would basically work.
Shayder
Posts: 8
Joined: April 8th, 2008, 10:50 am

I just want to say that I really appreciate the work that you guys are doing and I can't wait until you add some of the changes you are talking about. Especially the ability to export nulls to act as placeholders.

I am really not a technical animator, in fact very not technical, as I don't use the command line in Maya that much at all. So when I read what you had to do in order to use the Mocon scripts I didn't install them. I like the ease in which urbanspacemans script worked in AE. I may force myself to become a little more familiar with the command line as I know it helps the work flow but I find my self doing more administrative work than actual animating.

I do hope that you guys can collaborate on creating a new improved set of tools and that you will receive back double all that this good karma will bring.
Post Reply