A while ago I saw another very exciting tutorial on VideoCopilot.net where they showed us how to create a great-looking train explosion. As part of this tutorial, they introduced the usage of Mocha for After Effects. In this article I will conclude this for those who are especially interested in this kind of stuff or those who don’t want to watch the whole video (although I encourage you to do so). As an addition to that VideoCopilot tutorial, they offered a new After Effects presets file there which easily allows dynamic tracking in connection with Mocha. However, if you’re using a translated version of After Effects, you might have issues using it – how to fix these will be explained in the last paragraph of this article.
What is Mocha for After Effects?
Since After Effects CS6, the valuable tool Mocha for After Effects has been included in the full version. Using it you can track planar shapes you draw into your shot. In most cases, this works much better than the point tracker included in After Effects, because of two reasons: First, it tracks a shape and therefore receives transformation data in addition to the position data; second, it does a way better job when tracking things that move out of the frame.
How To Track Your Shot in After Effects CS6
If you have After Effects CS6 and Mocha, go ahead! Here’s the tutorial on how it works.
- In your composition, select the clip you want to track.
- In the “Animation” menu, click on “Track in Mocha”.
- Mocha for After Effects will open. You can leave the project settings as default.
- Move to the point in your video where you want to draw your tracking shape. You can do that using the scroll wheel.
- Click on the “Create X-Spline Layer Tool” and draw your shape by left-clicking the specific corner points inside your frame. Right-click when you’re finished, then your points will be connected automatically. You get the best results when your tracking shape is actually a part of a real surface of something in your clip.
- Click on “Track Forward” and/or “Track Backward” (relatively from the point in time where you drew the shape) until everything you need is tracked.
- Go to some point in the video and click “Align Surface” (located on the left by default).
- Click on “Export Tracking Data”, choose “After Effects Corner Pin (Corner Pin only)” and “Copy to Clipboard”. You’re already done in Mocha!
- Go back to your After Effects composition.
- Create a new Solid.
- Select it in the composition window, and click on “Paste” inside the “Edit” menu. You will now see that the solid moves according to Mocha‘s tracking data.
- Turn the solid off and create a new Null Object.
- Now we get to the exciting part! The coders from VideoCopilot.net have created a free After Effects preset called “Corner Pin to Null”. You find more information on how to download it in the next paragraph of this article. Download it and apply it to your Null Object.
- For the layer, choose the solid containing the tracking data from Mocha.
And you’re done! Now you can move your Null Object around as you like, it will always move according to the precise tracking that Mocha did for you. For best results, it is recommended that you place the Null Object at approximately the point where you drew the tracking shape into Mocha. All you have to do now is parent the Null Object to any objects you want to apply the tracking data to. You will see that the results are much better than what the After Effects point tracker can achieve.
Additional note: Some users reported issues that drawing the shape in Mocha does not really work. This has not been yet solved. It seems that this error occurs when the video file that you want to track in Mocha was previously trimmed in After Effects. Obviously, Mocha can only handle full video clip files as input, so if you have this problem, export the trimmed videos before importing them into Mocha.
The VideoCopilot “Corner Pin to Null” preset
You can find this preset inside the free project download package for the VideoCopilot tutorial (click on “Project” here). If you use the English original version of After Effects, that’s it.
However, if you use a localized version (like I use the German one), the preset might throw some errors and not work properly – this has to do with some translated terms which are therefore not compatible. So don’t worry: all you need to do is change the names of the specific effects inside the preset expression and then save it as a new preset yourself.
It works like this: There is some code to modify (but you don’t need to do more than changing names, so it’s not too hard). Apply the original Corner Pin to Null to any item. For each of the “Transform” properties (“Position”, “Scale” and “Rotation”) you will find one expression (a piece of code) which is the same for all three. So all you need to do is change the code once and just copy and paste it for the others. The code looks like this:
Now you only need to translate some property or function names into its equivalent in your language. For me (in German) the modified code looks like this:
So here you see the changes made (there is nothing to be changed inside the function Track(p)), so you only need to replace these German translations with those in your language. After that, simply add the effects “Track Layer Pin” and “Corner Pin” to the same item where you modified the code. Remove the original effects added. Then you can save it as a new preset.
However, if you use the German version yourself, I have already changed these things, so you can download this version here. All functionality remains the same like in the original VideoCopilot preset, I am neither the original inventor nor the creator of this preset.
To all of those who use another localized version of After Effects: Unfortunately, you gotta do these things yourself since I don’t speak your language. If you have created a working translated version of the “Corner Pin to Null” preset for After Effects in your language, feel free to send it to me, so I can include it right here in this post, of course with your name as credit. I would be glad to extend the offer here. Thank you!