Mask Displacement Script
for Adobe After Effects
Table of Contents:
You will likely find bugs, leave a comment or email [gmail:(snapplepapplemorphs)] with the error and I'll try and troubleshoot it so I can narrow down the error.
Bug list:
Gravity in directions not divisible by 90 degrees have an incorrect starting value and end value.Fixed in 0.1.1Additional Centers for expression ties did not represent actual centers.Fixed in 0.1.2No way to mirror displacement map effect except editing an expression.Fixed in 0.1.3No mask specific way to weight entire movement.Fixed in 0.1.3- Presets do not work in other versions of AE (kind of a big deal). Maybe Fixed in 0.2.0
- If the layer has an unexpected position the created masks move the opposite direction.
Requirements
The Mask Displacement Script has only 1 requirement:
- Adobe After Effects version 15.0 or greater (~2017).
Consult https://en.wikipedia.org/wiki/Adobe_After_Effects.
Installation
Installing the Mask Displacement Script is simply moving one file into the proper location for After Effects to find. You are not installing anything in the traditional sense.
The 'Mask Displacement.jsx' file needs to be placed into the After Effects script folder:
Windows: | C:\Program Files\Adobe\Adobe After Effects CC version\Support Files\Scripts\ |
Mac: | Applications/Adobe After Effects version/Scripts/ |
Make sure you restart After Effects if you had it open so it can pick up the script. From then on the script will be available in the Scripts menu within After Effects (File->Scripts->Mask Displacement).
If you are updating to a new version, you can just overwrite the files.
How To
Quick Start:
The script will attempt to help you pop-ups and provide directions, but I still highly recommend reading this How To guide so you know what the script is expecting.
- The script is requiring a Rotobezier mask on the selected layer. A Rotobezier mask is different than a bezier curve mask, which is what After Effects defaults to. You can convert between the two types, but the path traced by them will be different.
- To create a Rotobezier mask, select the Pen tool, then in the upper menu check the box that says "Rotobezier". Rotobeziers are different, you don't create any tangents (the handles on the anchor points). Rather, it determines the curve based on the other points you've made. While not as precise as bezier curves, the auto sizing of curves is what the script relies on. I find it easiest to click around and then go back and add more where needed.
- To convert between the two types, right click on an anchor point of the mask and select the option to convert.
- Run the script: File->Scripts->Mask Displacement. It will open a little pallet window you can drag around. There's really only 1 option at the moment: How many Centers do you want?
- 1 Center: This will create a circular center mask in the displacement map, use this if you cut out something that is more spherical.
- No Center: The displacement map still works without a center, so if you've got something that is irregular or doesn't have explicitly 1 center, use this option.
- Have the layer with the Rotobezier mask present and then click the script's button: Apply Mask Displacement.
- The script takes about 2 to 3 seconds to run. It will create a couple more layers, compositions, and many options.
- Important! The script will remind you to change an option on the "Set Matte" effect. Scripts in After Effects do not have access to the option it's requesting you to change, sorry.
- In your original layer, locate the effects.
- Find the Set Matte effect.
- Next to the first option "Take Matte From Layer" there is a second drop down: change it from "Source" to "Masks".
- Set the weights of the mask's points. Locate the Weights layer (if you see a bunch of layers that say Null, you need to switch to Layer view instead of Source: click the header "source" right above all the layers.) The script created a control for every anchor point on your mask.
- The first value is the horizontal control and the second is the vertical control for every point.
- By default every is [100,100] so that means it will move 100% in both directions. A value of [0,0] would basically stop the point from moving at all. If you only want a point to move up and down: [0,100].
- You can even go negative or over 100.
- Add a force to create movement: Locate the Control Layer and find the Force effect. In the timeline, you'll want to create a momentary force, which means you'll start at 0, go to a value like 10, then back down to 0. Think of it like poking a spring: if you just slowly push it and apply a force, it won't really wiggle around. To get something to be springy you apply a force and then don't, like a poke or flick.
- Fine tune with the other options. See the next Options section for more details.
Tutorials
Reshaping:
- The script will lock the original masks on the original layer. It will create Duplicate masks on the Mask Guide Layer. This is where you want to edit the masks now.
- It's easier to see your changes if you set the Reshape effect (located on the Control Layer [purple]) to 100. You can keyframe it later.
- On the Mask Guide Layer, you can lock the original mask if it keeps getting in the way. Change the colors of the mask to help tell the difference.
- If the reshape effect twists, you can add Correspondence points to the actual reshape effect located on the original layer. You need to click on the Correspondence Points property before you can alt+click to create the points. After Effects also does a bad job with these points if you add them after you have multiple keyframes, so add them all at the beginning to prevent weird spinning.
im using AE 2018 and get an error stating the preset file was saved in a newer AE version. Is there a work around for this?
ReplyDeleteOh... I did not know that was going to be a thing.
DeleteI tried to upload a 2018 version to google drive, it was not having any of that for some reason.
Try this one: https://mega.nz/file/ahtT3aLT#B_6t41obgy0n1xoWFhTWYRZ5NJEmws6KMYnjr6hMtIM
I recreated the preset using a 2018 version of after effects, but I don't know my 2018 version will work with yours. Just replace this preset with the one you've got now and hopefully it will run.
The preset file works but now another error: Unable to execute script at line 1085. preset_location undefined. Im unable to shake this error even though I click on the script, locate the preset file, and still get the error. Your help is most appreciated!
DeleteI'm sorry for all the trouble, turns out that animation preset wasn't going to work since it was dependent on the version and I can't make new ones for every version out there.
DeleteSo I changed the script to not use an animation preset file, which I'm not super happy with but at least it runs now (hopefully). Please try the new version: https://drive.google.com/file/d/1hOzw2yQRMjDPapzvsqmhhL29A_VWhJ6P/view?usp=sharing It's only the script file now, so please just overwrite the one you've got and restart AE if it was open. If something doesn't work, let me know.
I get the same error upon locating the preset file, and I'm in AE CC 2020
ReplyDeletehmm... I'm guessing then that the animation presets are AE version specific... which is not going to work since I don't have every version and I certainly don't want to have to make a new one every update.
DeleteThanks for letting me know, I'll have to come up with something to get around this. The preset creates the controls and their min/max values, by default they'll be 0 to 100, which is difficult when I want default values like 700.
I changed the script so the animation preset file is no longer needed, when you get a chance please test out the new version: https://drive.google.com/file/d/1hOzw2yQRMjDPapzvsqmhhL29A_VWhJ6P/view?usp=sharing
DeleteHopefully I didn't miss anything and it works for you now. If it doesn't, please let me know what's going wrong and I'll try to help out
Ooops, you replied that day and I haven't been on my NSFW account since :((
ReplyDeleteGood news is it appears to work! I'm messing with it for a few minutes now and I'm able to reshape and key things. I don't have time to give it a full blown test, but at least that fix is working! Thanks for being so quick to fix it, sorry my response was so delayed.
Tried this out again just now it won't show any preview of any kind for this one project. Just a black screen that the program lags when trying to move the time cursor and stops responding whenever either loading a different project or making a new one. Before that happened it simply wouldn't show the reshape at all no matter what I did.
ReplyDeleteDid you remove the videos?
ReplyDelete