AE3D EXPORT - AE scene to Maya, Max, and Lightwave

What's up at aenhancers.com

Moderators: Disciple, zlovatt

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

AE3D EXPORT

This is a combination of the other export scripts I've posted lately, along with some new features, into one easy-to-use script. I've tried to make it as simple and as compatible as I could. I avoided using recent scripting so that it would still work in AE 6.5 (although unfortunately, the user feedback doesn't work in AE7 or 8 on a Mac...Adobe really needs to fix that. In some cases the script can take a while and it's good to know it's doing something).

Simply select the layers you want to export and the plug in with spit out a text file that can be read by Maya, 3ds Max, or Lightwave. It will export any camera, and turn any other AE layer into a null/dummy/locator object in the 3D packages.

Image

This should work on almost all AE animations, including ones that have parenting, auto-orientation, and even non-uniform scaling. There are a few rare cases where it won't work, like with negative scale values, or when layers get "sheared" (this happens with a combination of non-uniform scaling, parenting, and rotation, causing rectangles to "lean"...it's best avoided anyway!).

NB. The file for 3ds Max is not a .max scene file, but a script that can be run from within Max. The other exports are regular scene files.

I haven't had a chance to extensively test this yet, so if you make use of it an it doesn't work, or you come across a bad bug, let me know and I'll do my best to fix it. Special thanks to Nab who helped me improve on the early versions and suggested how to put them together.

http://www.urbanspaceman.net/shared/AEs ... Export.jsx

Go nuts, and make 3D your bitch! :)
Shayder
Posts: 8
Joined: April 8th, 2008, 10:50 am

Hey Urbanspaceman, thanks for the script, it sounds promising. I tried it and I get this error, "Unable to execute script at line 50. null is not an object".

When I first tried to use the script I created a comp and used 3 solids. I made them 3d and positioned them around. Then I made a camera and moved it past the layers with slight lateral movement. I ran the script and got this error. I tried it again thinking that you could only use nulls. replaced the solids with nulls and got the same error.

I am using CS3.

Thanks again, I think this could be a great script once the bugs are worked out!
urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

That was the bit that took the name of your AE project and put it in the save as box. As that's not essential to the scripts function, I've removed it for now...I haven't had a chance to check things like that on a PC or in CS3, which I will soon. "Null is not an object" means that a variable is empty that shouldn't be...it's not referring to the layer object called a null is this case. Save any further bugs, the plug in should work on every type of layer...nulls, solids, lights, audio layers, etc.
urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

I've uploaded a small update...this is v. 1.06.

Okay, I had a chance this evening to test the script in CS3 and on a PC, as well as double check some things in Max and Maya. After a few bug fixes, everything seems to be okay. I think I'll be using it on another project very soon, using AE and Lightwave. :)
ymmij
Posts: 28
Joined: December 1st, 2006, 1:20 pm

urbanspaceman wrote:I've uploaded a small update...this is v. 1.06.

Okay, I had a chance this evening to test the script in CS3 and on a PC, as well as double check some things in Max and Maya. After a few bug fixes, everything seems to be okay. I think I'll be using it on another project very soon, using AE and Lightwave. :)
I opened an existing AE project which used an earlier version 'exportcam' (v1.1). This was the last good working version of exportcam. I then selected the camera, and used the lastest version AE3D Export v1.06 and created the camera for Maya 2008. The result was different to the exportcam v1.1. I camera was way off the center and my models could not be seen. I then tried the export after select the 'shift the comp center to 0,0,0'. This time I could see the models by everything was way off in the distance.

I tried a brand new project and things worked as expected with exportcam 1.1 but not luck with AE3D 1.06.

I tried uploading the camera files, but when I did I get an error from the board saying that it does not recognize .ma. Then changed the extension to .txt and it did not like that.

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

I believe I know what's happening. It's not quite a bug, but a change in my decision making.

The code in exportcam 1.1 and AE3D 1.06 for the camera is almost identical, except that exportcam scaled down things by 100. If you are mixing the 2 plug ins during one project there will be a mismatch of units multiplied by 100.

Would be interested to hear the opinion of Maya users, to see what is the best decision to make. It's a program I'm still learning about.

Agrapha expressed the need to preserve the pixel values in case one wanted to go back to AE at some point. So I decided to to make 1 AE pixel = 1 cm, and give the option to switch off the shifting of 0,0,0 (which would change all position values and not match AE anymore). This worked fine, but I had to scale up the locators by 100 times to see them.

My goal is to create a simple plug-in that is uncluttered with unnecessary options...so I'm seeing if I can avoid adding a 'change units' button.

At the moment, 1 AE pixel = 1 cm in all three 3D packages...I kind of like the simplicity and consistency of that.

But it may be slightly awkward to work in these dimensions in Maya...I may switch to 1 AE pixel = 1 m instead.

Lightwave is the 3D program I'm most familiar with. In that app there is a button that allows you to scale the grid (and cameras, lights, nulls) by 10 times by clicking a button. This doesn't alter the keyframes, it just allows you to view things at a comfortable size. I have not found the equivalent of this in Maya, so I'm a bit stuck in deciding which units to use, because things are looking too small or too big. Some more advice from Maya experts would help.

No idea why the .ma file wouldn't work from a new project, Russ, especially if it worked the first time. I've been testing with Maya 7 it hasn't complained yet.
ymmij
Posts: 28
Joined: December 1st, 2006, 1:20 pm

urbanspaceman wrote:I believe I know what's happening. It's not quite a bug, but a change in my decision making.

The code in exportcam 1.1 and AE3D 1.06 for the camera is almost identical, except that exportcam scaled down things by 100. If you are mixing the 2 plug ins during one project there will be a mismatch of units multiplied by 100.

Would be interested to hear the opinion of Maya users, to see what is the best decision to make. It's a program I'm still learning about.

Agrapha expressed the need to preserve the pixel values in case one wanted to go back to AE at some point. So I decided to to make 1 AE pixel = 1 cm, and give the option to switch off the shifting of 0,0,0 (which would change all position values and not match AE anymore). This worked fine, but I had to scale up the locators by 100 times to see them.

My goal is to create a simple plug-in that is uncluttered with unnecessary options...so I'm seeing if I can avoid adding a 'change units' button.

At the moment, 1 AE pixel = 1 cm in all three 3D packages...I kind of like the simplicity and consistency of that.

But it may be slightly awkward to work in these dimensions in Maya...I may switch to 1 AE pixel = 1 m instead.

Lightwave is the 3D program I'm most familiar with. In that app there is a button that allows you to scale the grid (and cameras, lights, nulls) by 10 times by clicking a button. This doesn't alter the keyframes, it just allows you to view things at a comfortable size. I have not found the equivalent of this in Maya, so I'm a bit stuck in deciding which units to use, because things are looking too small or too big. Some more advice from Maya experts would help.

No idea why the .ma file wouldn't work from a new project, Russ, especially if it worked the first time. I've been testing with Maya 7 it hasn't complained yet.
I have to say that I was liking the way things were working before. No need to do anything in Maya. I am not the expert in Maya either, but have to do a bit of work going between AE and Maya so really interested in seeing this work out.

Perhaps someone else can clue me in as to what changes I have to make in Maya as far as these units are concerned. Outside of that, the option to scale would be fine with me ( I understand your reluctance).

As far as the previous file not working, it now makes sense. I opened up my comp and exported the camera, but with the unit change you have made, and my not accomodating this in Maya it was off the charts.

Need help on this one.

Thanks,

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

What you could do for the time being is attach everything in Maya to a node at 0,0,0 and scale it up 100 times. Or you could attach everything in AE to a parent in the comp center and scale down 100 times. Then the two world's would match up.

This would not be something you would need to do every time...it's only necessary because you have already started a project in the middle of this change I've made. I'm asking some other Maya users what they think would work best...either keep 1 pixel = 1 cm, or 1 pixel = 0.01 cm, or 1 pixel = 1m, etc. With the change I've made you can now bring the camera back into AE (AE reads cameras from .ma files) and everything still matches up...it's good to keep this option just in case, which is why I thought Agrapha had a valid point in maintaining the values. I'll try out some different units in Maya and see if this makes any difference.
Shayder
Posts: 8
Joined: April 8th, 2008, 10:50 am

hey urbanspaceman,

The script works pretty good! My only issue seems to be the scaling thing you guys are talking about. When the camera is imported into maya the nulls are huge and the distances apart are huge as well. This is becomes a pain because if I want to replace a null with a polygon object, they are so far from the origin of creation that it becomes a pain to find the grid make the poly then move it to where the null is.

I could parent everything to a locator and then scale that but will that throw off my settings if I try to go back into AE?

How many pixels are there in a cm?

Anyways this script is already awesome!

Thanks,

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

A new update, v. 1.08. (same link as above)

http://www.urbanspaceman.net/shared/AEs ... Export.jsx
Shayder wrote:How many pixels are there in a cm?
That's the thing, pixels are relative units. It's a bit like asking "how many cm wide are 100 apples?". Since apples come in all shapes and sizes, just like pixels, there is no answer. Think of your computer monitor resolution: you can set your monitor to 1280 pixels wide, but you may have a 15', a 17', or a 21' monitor. So in each case a pixel would be a different size in inches.

So when going from AE (pixels) to 3D software (cm), the choice is arbitrary. Making 1 pixel = 1 cm is as good a convention as any.
Shayder wrote:Anyways this script is already awesome!
Glad you like it. It was a labour of love, that's for sure.

I spent some more time playing with Maya and I think I was right to divide AE's position values by 100 in the first place, and Russ was right that it was better before. It appears Maya likes to work with small numbers and is stubborn about changing this. If I'm going to have 1 pixel = 1 cm, Maya would prefer I call it 0.01 meters, and not 1 cm. So now I have set the world units to meters.

I also added a perspective camera in a comfortable position that should allow you to see the whole AE scene when you open up the .ma file. I also increased the size of the grid so it will not get lost so easily. Now the camera and the locators look normal sized as well.

Since this is an export script, the more I think about it the more it makes sense to pick a method that makes it comfortable to work in the 3D package, and assume that the camera isn't going to be sent back to AE again (since you already have a copy of it in AE, anyway). If there is a need to go check back with AE for the position of something, all you have to do is move a decimal point (eg. if something is at X=1.00 in Maya, it's at X=100 in AE).

If anyone here completes a project with it, make sure you tell me how it went, and even some links of videos online. Cheers!
ymmij
Posts: 28
Joined: December 1st, 2006, 1:20 pm

urbanspaceman wrote:A new update, v. 1.08. (same link as above)

http://www.urbanspaceman.net/shared/AEs ... Export.jsx
Shayder wrote:How many pixels are there in a cm?
That's the thing, pixels are relative units. It's a bit like asking "how many cm wide are 100 apples?". Since apples come in all shapes and sizes, just like pixels, there is no answer. Think of your computer monitor resolution: you can set your monitor to 1280 pixels wide, but you may have a 15', a 17', or a 21' monitor. So in each case a pixel would be a different size in inches.

So when going from AE (pixels) to 3D software (cm), the choice is arbitrary. Making 1 pixel = 1 cm is as good a convention as any.
Shayder wrote:Anyways this script is already awesome!
Glad you like it. It was a labour of love, that's for sure.

I spent some more time playing with Maya and I think I was right to divide AE's position values by 100 in the first place, and Russ was right that it was better before. It appears Maya likes to work with small numbers and is stubborn about changing this. If I'm going to have 1 pixel = 1 cm, Maya would prefer I call it 0.01 meters, and not 1 cm. So now I have set the world units to meters.

I also added a perspective camera in a comfortable position that should allow you to see the whole AE scene when you open up the .ma file. I also increased the size of the grid so it will not get lost so easily. Now the camera and the locators look normal sized as well.

Since this is an export script, the more I think about it the more it makes sense to pick a method that makes it comfortable to work in the 3D package, and assume that the camera isn't going to be sent back to AE again (since you already have a copy of it in AE, anyway). If there is a need to go check back with AE for the position of something, all you have to do is move a decimal point (eg. if something is at X=1.00 in Maya, it's at X=100 in AE).

If anyone here completes a project with it, make sure you tell me how it went, and even some links of videos online. Cheers!
Glad to see this change back to the original. Makes more sense to me. I gave it a shot and working well. Just a couple of things to note:
1. When I open the exported project I get this message: // Warning: Could not find an appropriate startup camera: front. A substitute will be used.
Normally A new scene normally adds 4 cameras. They are persp/top/front/side. Your setup is missing the last 3. I guess this is what the objection is about
2. The animated camera is incredibly small. I have to scale it by 100. Did not have this problem before.

I was able to open the original comp I had made with exportcam 1.1 and export the camera along with the solids for locators and everything was matching.

Great stuff.

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

Hi, it's me again. Well this time I seem to have more issues with 1.08 than version 1.06. I have been testing with making 3 layers plus the camera. In 1.06 it imported properly but had the space and size issues. In 1.08 importing into Maya caused some new issues. It looks like it imported the 3 layers but only one is visible as a locator. The other 2 exist in the hypergraph but are shown as not existing (white and angled). Space still seems to be an issue but not as bad. I have Maya 8.5.

Also I did something a little different this last time. In AE I created a null and had parented the camera to it. I rotated the null and moved the camera up and down at the same time. When I imported it to Maya I had the above mentioned problems as well as some camera movement issues. It mirrored the null rotation fine but the up and down movement seemed to send the camera into apoplectic fits. It rotated this way and that like a madman.

So for me version 1.06 was closer to working than 1.08.

Again thanks for all the work on your behalf.
urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

Hey Shayder, did you get the tiny camera syndrome that Russ had? I can't reproduce it...everything looks normal over here.

I have some guesses as to what the problem might be...but could you send me your AE project? I have to check this out step by step...send it to contact at urbanspaceman dot net, if you please.
Shayder
Posts: 8
Joined: April 8th, 2008, 10:50 am

urbanspaceman, Yes, I did get the tiny camera syndrome as well. I forgot to include that in my email to you.
urbanspaceman
Posts: 54
Joined: December 12th, 2007, 9:56 am
Location: London
Contact:

Hi Guys, new version uploaded. v1.11.

What caused Shayder's problems were the names of the layers. Some were too long, and 3 of them had the same name, which Maya doesn't understand. So I've added some new code that takes care of this. It basically changes the names, processes them, and then changes them back.

I've also increased the camera size by 100 times, which should get it looking normal again.

Some other new additions:

- front, top, and side cameras in Maya now included
- unanimated layers now have only one keyframe at frame 1 in the 3D packages. This makes things more efficient, especially for 3ds Max, which is very slow in importing (so a shortened scene file helps)
- the preview range of the animation is now set properly in Max

Enjoy!
Post Reply