I have changed the script to make the camera move up instead of down. (redownoad from link on first post)
Your After Effects scenes do point out that the camera and z-distance calculations are off. I am not sure how to correct it at this time.
When I made the 2.49 version of this script I simply cloned an existing exporter that supported Maya, Max and Lightwave. Lightwave was the closest match at that time. So the camera math is essentially for lightwave. I made this script public with the hope that someone a bit more savy on calculations might be able to offer up some suggestions. But all I can offer at this time is to say āplay with the camera sensor size and focal lengthā.
I have wanted to revisit the concept of how to implement a Blender unit in After Effects I just have not had the time.
Thank you for the update I understand that youāre busy, thatās what makes me thankful even more I often think that many people posting here (or in other places, doing regular tutorials, writing free plugins, scripts etc.) are almost like superheroes
I wish I could help more. Thereās one more thing that comes to my mind - I had a chance to check PFHoe by Pixel Farm (it was the cheapest tracking solution at one moment) in the past and it had the ability to export script files for Blender 2.49. There were feature requests on their forum to update for 2.5 but they havenāt done it so far. This software is now discontinued so I think thatās it. But maybe there is something in the code that PFHoe was producing which could help here. I donāt know, maybe itās AE problem. If you want to look into the code hereās an example script file I got some time ago:
Itās for 2.49 however, so I possibly itās useless. Thanks again
Well, Atom said the script is not finished, updating it would take much time. I guess we just have to wait, maybe somebody comes up with a solution. I really need that functionality too. Someday weāll get there.
Atom, if youāre reading this - have you archived the old version somewhere? The one which was working with blender 2.49? I googled like crazy but all the links are dead. We can still use it, save the file then open in new Blender. I thinks itās a good workaround for now. Thanks
Iād gladly help with this script, but Iām not good enough with jsx. I tried to go through this several times and gave up.
I think that the math here is a bit too complex and conversion can be done easier. For example I noticed that angles are used to convert AEās lens to blenderās lens. This is not necessary. Iām sure about it, because I made all the calculations myself for the exporter from Blender to AE which is included in Blender. I didnāt at all use angles and everything sits precisely where it should.
I can do all the math, but I would have problems implementing it into existing script that I donāt quite understand.
Wow! Bartek Skorupa and Atom in one thread Iām crazy about using two-way workflow between Blender and After Effects so your script Bartek is just sooooo useful. Now we need the other half Iāve used the contact form on your website some time ago to ask you about any solutions but I donāt know if the form is working. Do you remember getting my message? If you didnāt have time to answer no problem - weāre all so busy these days.
Back to the topic - I donāt have any programming skills, Iām just a user that needs some features, so I cannot really help. I can test, I can feedback. I really think we need those scripts, tracking in AE is just so easy and fast (if thereās a problem we can use the Foundryās plugin which helps even more). It would be great to take that data into Blender.
Bartek - Iāve published in this thread an old code exported from PFhoe. It was a cheap tracking software which could export data to Blender. It was Blender 2.49, however, so I donāt know how useful is this data.
I am willing to field questions for the parts of the code that are confusing. Remember, I built this from an existing working exporter for Maya, Max and Light Wave. So some math conversions for the camera may have been needed for those applications.
collectValueAtCurrentTime_XZY_Camera is where all animations data that will be written out for the camera is collected, calculated and returned to the caller. Put override values here to test your ability to alter the output stream.
Also getFLenOrFOVorZFacFromZoom has some math I do not understand.
You can ignore anything related to Masking at this time. It was a work in progress even in the 2.49 script. I left some code in there so I would not have to look it up again.
I wrote a javscript version of our beloved python dir() function and it is available in the script. It is called pythonDIR (). If you want to examine a javascript variable you can pass it to pythonDir and it will try to return a string of attributes like dir. You can pass the results to a javascript alert() function to popup a message box with that variables attributes.
Usage:
myStr = pythonDir(unknownVar);
alert(myStr);
Be warned not to leave an alert inside a loop, there is no way to stop a javascript once it is lanuched under After Effects.
Thanks for working on this. Iāve been using AE CS6, which has built in 3D camera tracking that works quite well, not to mention easily and quickly. Iād love to be able to build my composition in AE, and export a camera and some nulls to Blender in order to create some 3D text or objects with Cycles rendering.
@loogas: Sorry for the late reply, but I am finally looking back into making this script work better. After some research I realize that the script is missing the sensor size for your footage. While the script can look at the After Effects camera sensor size, it canāt really know what sensor size the footage was shot with. Do you happen to know what camera was used to for the footage you have posted? If so, it might be possible to simply set the After Effects lens and sensor size to match the lens and sensor of the camera that shot your footage.
As a side note (if you happen to have some time to read it ;)):
Iāve been checking online tutorials to look into camera āinterchangeabilityā between different packages - 3dmsax, maya, pftrack, nuke, after effects, cinema4d - and this functionality is there. I wonder how they achieved in on the coding side. I mean you donāt even have to know what was the camera that the footage was shot with etc.
I donāt know how many people would need this functionality in Blender but something like this was a major feature in the last 3dsmax (you can import whole scene data into AE and back) and is being advertised for the upcoming update of AE (great interoperability with Cinema 4d). I really donāt want to leave Blender and learn another package, all over again
Thanks for the info, I see the Canon is a 36mm x 24mm sensor now. I was digging around in the After Effects javascript API and I just canāt find any reference to the sensor size, after the camera is created in After Effects. All you have is zoom and FOV. I have a math request posted on aenhancers.com and hope someone chimes in. But I think for worst case scenario, the exporter can still work for motion graphics even if the camera is off for footage tracking. I was looking into Bartek Skorupaās exporter code hoping to reverse engineer his camera export, but it is still a work-in-progress.
I have revised the After Effects To Blender exporter to update it for Blender 2.6.6 api changes.
Instead of trying to match the camera to one type of footage or lens I decided to match the After Effects Camera to Bartek Skorupaās Blender To After Effects Export script. I think this makes the most sense for us Blender users because it is in the official release of Blender. The CS5 version of this javascript will now reliably transfer a camera back to Blender with the lens settings matching Bartekās Exporter. So you can export using Bartekās script to After Effects, make changes and send it back to Blender with this CS5 version of the javascript and there should be no camera distortion. This should give more confidence to the two-way pipeline from Blender to After Effects and back to Blender for Motionographers.
As far as tracking and camera matching tasks, however, we are still in untested waters.
For example I noticed that angles are used to convert AEās lens to blenderās lens. This is not necessary.
@Bartek: Thanks for the tip, I have revised the lens zoom calculation with a magic # that seems to match your export code for tested camera zooms. I transfered 5 cameras with different zoom values from Blender2AE2Blender without any distortion to the lens or LOC/ROT of the cameras.
There is a lot of math in the exporter that I donāt understand either, having taken it from the Maya/Max/Lightwave exporter years ago. Internally I think the original authors of that script turned After Effects zoom values in to radians for internal calculations and thus it needs converted back for final output.
@Atom: Letās assume that I do all the math. If I do it and give you all the formulas, would you be able to implement this in your exporter?
Letās say I give you data like this:
location.x = AE_position_x * something minus something else plus comp_width
location.y = blabliblebli.
When it comes to camera data, Iād assume using default camera settings (I mean sensor, āfitā etc.) and match all the math to those settings.
Math here should be easy. Iād assume that we have the access to āzoomā value in AE. If so - I can easily create a proper equation, like:
blender_lens = comp_width * something minus something times zoom.
Will it help?
Maybe this way we could somehow ignore all those crazy āRadiansToDegreesToRadiansAgainToAnythingElseThatIsNotNeededā stuff?
There are still some things going on in the javascript exporter that I am not sure about (like layers being created on-the-fly and then discarded). So Iād rather not try to fix something until it is broken. At this point all we need is more testing to identify any camera cases, if any, that are still not working.
I agree the javascript code I present is cluttered and messy. I left a lot of experimental code in the script, but commented out, hoping to return to it when I get more time. Mainly I do think it is possible to extract mask information in After Effects and translate it into curve objects inside Blender. However, my adventures into trying to extract particle data from Particular have lead to a deadend due to Trapcodeās failure to expose properties to the After Effects API.
Itās nice to see youāre still trying to figure things out guys
Well, the only thing I can do to help is to keep testing, so I did. Itās better but still something is off.
First of all, you have to know I didnāt export anything from Blender, then back to Blender. Iāve used a situation I face almost every day - Iāve tracked the footage inside AE (fast track, not fully tested), created a scene, a camera and some 3d solids for reference.
Letās say I want to take this to Blender (itās an unused shot from a tornadoes and destruction music video I did a while ago), add stuff to the ground, the building in the background, and then render to compose in AE.
Iāve run the script (I hope Iāve used the correct version, the bottom one from the first page of this thread: ATOM_AE2Blender26_04162013.jsx) in CS6 and CS5. Then I tried to use the resulting .py files in Blender 2.66a - it doesnāt work, some error. But this doesnāt matter - we cannot expect Atom to keep updating it all the time Iāve run it in Blender 2.63a and here it works, it creates the scene and stuff. The camera seems to be shifted in its position to the right. Whatās more, if I use the ouput from CS6, the camera is below the ground (but again, letās leave CS6 for now, if it works at least in CS5 thatās gonna be great).
I thought first that maybe camera parenting to a scene-controlling null is a problem, but if you unparent it so it displays itās true position in space and then export, you get the same result.
I hope this doesnāt discourage you Atom (and Bartek ;)). Zhajym reported it works for him - could you tell us more? Have you created a scene in Blender, went to AE, then back to Blender, or it all started in AE?
If you need the scene and my files to look into them, like with the previous case youāve checked, you can find them here:
By the way:
Even though I donāt like marketing mumbo jumbo about how great the dynamic link between AE and Premiere is (it can fail you in some really demanding situations) it usually works nice, so what do you mean Veggiet by saying that AE is not compatible with Premiere? They work great together. Premiere is and editing software - why would you like to export to Blender? Or maybe youāre talking about Blenderās sequencer, not 3d space? That would be a completely different matter
Thanks for the test files, verified, the script does not work. I just donāt know enough about the math to make the camera work correctly. The objects seem to be in the correct location. But the camera is just fracked.
No problem. Thanks for coming back to this - maybe some solution will come up eventually. By the way - do you still have the older version of your script which worked for Blender 2.49 and AE CS3? All links are dead but I think it could be used as workaround for now. Thanks in advance