Forum Replies Created
-
Coen Rens
February 9, 2017 at 9:43 am in reply to: What kind of expressions slow down comps the most?Reporting back after testing:
(TLDR: it turns out that Shape Layers were a bigger factor in slowing it down than the expressions were)I used FRAPS to show the framerate at which After Effects was running, to compare different versions of the character-rig composition.
I tried several changes and made notes of the framerate difference.
– all expressions combined accounted for a framerate difference of about 20 fps
– but all Shape Layers accounted for a framerate difference of about 30 fps!My comp being a combination of those two had slowed the comp’s operating speed down to a very choppy 5-10 fps…
I made a new version of the composition where I try to avoid Shape Layers and instead work with Illustrator footage layers and Masks. This improved performance a lot! It currently runs at about 30 fps.
-
Coen Rens
February 2, 2017 at 1:05 pm in reply to: What kind of expressions slow down comps the most?Alright, thanks for your thoughts!
I’m performing some tests now, cutting away different things and observing how the speed improves.
-
Coen Rens
February 1, 2017 at 3:06 pm in reply to: What kind of expressions slow down comps the most?Those are a few great places to start looking, Dan, thanks for the advice!
Firstly, my character rig uses a lot of Paths that use valueAtTime() linked to a Slider control to have a user ‘scrub’ between its keyframe values; i.e. for turning a head from left to right. As this way of using valueAtTime is referring to a relatively static Slider value, I wouldn’t think that this would be the check-every-single-frame-as-time-goes-on variant that you speak of?
Secondly, my rig also uses some javascript Math and vector functions, especially Math.cos / sin / tan, and length() so the user can animate the character by moving limb controlling circles around (hand, elbow, etc), with the expression deriving the proper rotation angles for the limbs from these circles’ positions. I wonder if these would benefit from replacing the Math functions with written-out varieties of them, using 3.1415 instead of Math.PI for instance, although I would assume that function to be a simple as a stored number.
Lastly, the rig uses groups within shape layers for the customization of the character’s appearance (hair, clothes, etc). Some of these are set to 0% opacity when not ‘selected’ by the user, but I imagine After Effects will still perform the calculations they require as 0% opacity is not the same as a layer switched to invisibility…
Any thoughts on these possibly performance-lowering issues are welcome!
-
Coen Rens
January 31, 2017 at 2:38 pm in reply to: What kind of expressions slow down comps the most?For instance, are expressions that ‘check’ other layers known to be heavier than more ‘self-sustaining’ expressions?
I will eventually try and do a number of tests myself, but since I’m pressed for time at the moment, any small piece of knowledge someone could share is welcome.
-
It can be done with a linear function, which interpolates in a linear fashion between a minimum and maximum value.
See the attached code, which should be entered to your opacity property
.
Replace ‘object x layer name’ with the layer name of your object x, but leave both the ” quotation marks.linear( thisComp.layer("object x layer name").rotation, -7, -6, 0, 100 ) -
Coen Rens
January 30, 2017 at 12:29 pm in reply to: Expression control to control position between layer and parentThis would be complicated to do through expressions, see my explanation below. For a quicker fix, I know there is a script out there that gives you influence on parents, called Good Parents: https://aescripts.com/good-parents/
Explanation why doing it through expressions is complicated:
Simulating all effects that ‘parenting’ has is complicated since parenting achieves many different effects at once. Not just a link in rotation, position, scale but also relative position, rotation, etc, PLUS the rotation / scale / position of the child layer itself.To achieve the control you’re looking for, you would need to program an expression that does the exact same as parenting does, and then have a slider (or checkbox) to interpolate (or switch) between the simulated parent-influenced value and the non-influenced value.
-
Coen Rens
October 17, 2015 at 1:34 pm in reply to: Scripting question: Keyframe Interpolation control beyond only 2 optionsHi Paul,
I’m aware that this response comes years after your post, but hopefully it’s useful for whoever finds this thread when searching for the same problem.
I had the same problem and managed to solve it; the trick seems to be in the ‘setSpatialTangentsAtKey’ method
In your case it would be:
app.item(x).layer(j).position.setSpatialTangentsAtKey(i, [0,0,0], [0,0,0])
where ‘i’ is the index of the key you wish to change, and the two arrays carry input for the tangents which are all set to zero. You can find a further explanation of this method on page 142 and 143 of the After Effects CS6 Scripting Guide.For me, setting all the tangents to 0 made the keyframes’ spatial interpolation show up as ‘Linear’ in the Keyframe Interpolation window, and caused the keyframes to behave as such.
This solved my problem and should solve yours, I hope it helps someone else!