Path From Mask

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
RichardPatterson
Posts: 6
Joined: January 31st, 2010, 4:16 pm

Would it be possible to write a script which converts a mask into a path in After Effects?

If not, would it be possible to write a script in After Effects which interacts with Photoshop in such a way that it could walk through a series of frames and copy paths from a series of Photoshop images and paste them into a the frame in a layer in After Effects?

Or is it possible to make After Effects read an AI path exported from photoshop as a file and use it as a path on a layer?
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

RichardPatterson wrote:Would it be possible to write a script which converts a mask into a path in After Effects?
This probably is possible but it wouldn't be easy. AE does already have the ability for you to manually convert a mask into a position path. You simply copy the mask keyframe, select the Position property and paste.
RichardPatterson wrote:If not, would it be possible to write a script in After Effects which interacts with Photoshop in such a way that it could walk through a series of frames and copy paths from a series of Photoshop images and paste them into a the frame in a layer in After Effects?
Scripts can't easily communicate between Adobe apps. If you already had the paths, imported as masks on a layered PSD comp in AE, these could be assembled into a series of mask keyframes on a single mask shape property. This would be easier to script than the first option but still not that easy as scripting with mask vertices is quite tricky in general.
RichardPatterson wrote:Or is it possible to make After Effects read an AI path exported from photoshop as a file and use it as a path on a layer?
Exported as a Photoshop path file? I'd think this would be very difficult if not impossible.

Sorry I don't have any easy answers for you. It might help if you explained what you were trying to do, but I don't think there will be an easy solution beyond manually converting a mask keyframe to a Position path as I described above. Some of these options sound theoretically possible but would require a skilled scripter to put in some hours to achieve them.

Paul
RichardPatterson
Posts: 6
Joined: January 31st, 2010, 4:16 pm

Thanks for responding. I should have elaborated more on what I was trying to do and why. Basically it all started when I tried to use the rotobrush tool and concluded it would only work for what I was trying to do (roto a guy running towards the camera which is zooming as he runs) if I could convert the mask it created into an editable path to refine it. I submitted a feature request to add this capability to the rotobrush tool, but...

There are two considerations here: The mask is a complex articulated roto mask and it is animated. Maybe I missed something but I am under the impression that the only position information for a mask is a single point relative to its anchor. Since the shape of the roto mask as animating as well as its position and size in the frame I didn't think copying and pasting position information would get me what I wanted.

Photoshop can obviously convert a mask to a path and I tried setting up an action to do that on a frame by frame basis and then was willing to copy and past the path for each frame into After Effects. The problem was it kept creating new masks rather than animating a single mask and I could not figure out a way to combine all the separate paths into one that I could edit as an animated path/mask.

When I spoke about exporting a path from Photoshop I was referring to the ability to save a path as an Illustrator path, but I could not figure out any way to import that into After Effects and even if I did I suspect I would have a new mask every frame rather than keyframes.

Another issue I ran into was that I could not figure out how to export position information for points making up a path. I assume this information could be accessed by a script as a stream or whatever, but it seems to me that it should be possible to export it as text and to import text information for an animated path. The Illustrator path seems to be nothing but text.

The problem with this is that it requires a solution which falls in the crack between a script and a plug-in. I'm have tempted to tackle this problem, but I'm not at all sure I still have the stamina for this kind of masochistic hobby. I managed to finish the job by just reconciling myself to manual frame by frame creating and editing of the mask (which is probably what it needed anyway).
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

When I was saying about AE's ability to convert a mask shape to a position path, that is simply for creating a motion path that follows the outline of a single non-animated mask shape. Now you've explained what you're trying to do it's clear that this isn't relevant to your needs

I would suggest you look at AE's Auto-trace feature. You should be able to use that to convert the Rotobrush generated alpha into an animated mask. The results aren't perfect but I think this is the closest you're going to get to a workable solution.

Paul
RichardPatterson
Posts: 6
Joined: January 31st, 2010, 4:16 pm

Yes, that does almost do what I was hoping to do. I've been so out of touch I was completely unaware of Auto Trace.

The only issue I see immediately when I play with it is that it seems to create a new mask when it is needed to rope off an area and then the mask just sits there unanimated after it is no longer needed. For instance when the guy runs sometimes there is a space between his legs and sometimes there is not. Auto Trace seems to create a new mask when the space opens up but it just lets it sit there even after the space between the legs closes. And so far as I can tell there is no way to animate a mask off and on except by isolating it in a separate layer and animating the opacity of the layer. This is OK and is sort of what I ended up doing manually.

Thanks for taking time to educate me.

Rotoscoping seems to me the sort of work that should be assigned to people paying their debt to society in a prison.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Each Mask property has it's own Mask Opacity property. Are you sure Auto-trace isn't keyframing this too? In my experience it does. Useful shortcuts are UU to reveal all animated properties and TT to reveal Mask Opacity properties.

Paul
RichardPatterson
Posts: 6
Joined: January 31st, 2010, 4:16 pm

Thanks again. I don't know how I overlooked the ability to animate each mask opacity. All I can say is "Beware of senility, my son! It makes you blind to things sitting right in front of your nose."
Post Reply