This is an old script that I made, but I wanted to wrote something about it before I forget everything. The script exports selected layers masks from Adobe After Effects to text file that you can copy paste straight to Black Magic Fusion composition. The script exports only the paths, it does not support feather, opacity, expansion or other fancy things.

I created this script because sometimes I have to rotoscope something and when that happens I only use free version of Mocha that comes bundled with After Effects. But since I have started to use Fusion more and more I had to figure a way to get my rotoscoped Mocha shapes to Fusion. Fusion’s own rotoscope tools are fine, but I’m so much faster with Mocha.

After Effects and Fusion have a different coordinate systems (Fusion has many different coordinate systems, this is for polygon masks).

Following pseudocode shows how mask vertices are remapped from another coordinate system to another:

// lerp(value, old min, old max, new min, new max)
x = lerp(vertices[n].x, 0, compositionWidth, -0.5, 0.5)
y = lerp(vertices[n].y, 0, compositionHeight, 0.5, -0.5)

Tangents are remapped similarly, but by trial and error I found out that I need to additionally add 0.5 to X-tangents and subtract 0.5 from Y-tangents to get right result.

AR_MasksToFusionPolygons.jsx

After Effects, Fusion, JavaScript