FORUMS: list search recent posts

Tracking Data from Nuke to After Effects - Quick Guide

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alberto Brancolini
Tracking Data from Nuke to After Effects - Quick Guide
on Dec 20, 2017 at 3:07:05 pm

A little while ago I stumbled into the necessity of transferring tracking data from Nuke to After Effects. Thanks to Dan Ebberts valuable advice, I came down to a working solution. I rewrite it into a post labelled well, so it is easier to find.

Nuke makes tracking data available through a plain ASCII .txt file, just a list of tuples. Each number has 4 decimal digits.


  • The text must be made legal Javascript. In order to achive it, you will add three double quotes at the beginning of the text, then three double quotes followed by semicolon at the end of the text. This is an example:

    1940.3331 736.1004
    2612.7837 1193.0671


  • This code looks like working:

    myFile = "absolute path to the file";
    data = $.evalFile(myFile);
    a = data.match(/[(backslash... I can't have it displayed)d.]+/g); //this RegEx reads every digit included into the string, it takes on each space and return as a separator, and creates an array
    w = timeToFrames(time)*2; //or 3, if Z data are included
    x = a[w];
    y = thisComp.height-a[w+1]; //because Y coordinates in Nuke are flipped
    z = a[w+2]; //only if Z data are included
    [x,y,z]; //of course, pull the Z if unnecessary

    First of all, I don't know why I'm not allowed to write the backslash (sorry about it), but it takes a backslash before the "d" in the regex.
    Secondly, the absolute path must be written in the platform agnostic URI format, which looks like this: /C/MyPC/ProjectFolder/TrackingDataFile.txt
    Thirdly, mind carefully to trim the composition to the length of the footage, because maybe you noticed that the code does not stop...
    Fourthly, mind that the comp starts from frame 0! Otherwise, you can fix the code by adding the offset to the variable w.


  • Once you had the null working and sticking to its target, you can bake the animation by converting the expression to keyframe. This saves a lot of headaches.

    I hope I didn't forget anything, and I hope y'all find this useful.

    Return to posts index

    << PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
    © 2019 All Rights Reserved