Skip to main content
Inspiring
December 9, 2021
Question

SourceRectAtTime expression causing major performance issues with motionblur

  • December 9, 2021
  • 3 replies
  • 1299 views

Hello,

 

I'm was looking into why my expression-heavy After Effects Comp grinds to a halt whenever I active motion blur. I use it to auto scale a textbox. Since I use multiple of them in one comp, I can't avoid calling sourceRectAtTime(0) for each text. I'm fairly certain it is this text, since I made an optimization to disable the call, when the text is unused and the render time goes down.

 

I've already tried the suggestions made by Dacia Saenz (https://adobe-video.uservoice.com/forums/911311-after-effects/suggestions/43383660-what-kind-of-expressions-let-project-slow).
I haven't tried to offload sourceRectAtTime() to an external extendscript, since I'm not sure yet how to best do this. 

 

I also tried:

// cacheCompareSamplesPerSecond 0

This didn't improve the performance.

 

I tried to "cache" the results in a point effect and call it with valueAtTime(0) but it still evaluates for every motionblur sample, thus slowing down my render.

 

Is there something else can can be done to definitively cache these values? They only have to be called once, since I don't need scaling of the textbox within the animation.

 

Thanks!

This topic has been closed for replies.

3 replies

Mathias Moehl
Braniac
December 9, 2021

If you just need a simple auto-scale textbox, maybe you do it without any expressions at all?
See the method I describe here in the section "Simple Text Boxes" of my free motion graphics eBook:

https://mamoworld.com/motion-graphics-ebook/content47.html

 

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Inspiring
December 9, 2021

Thanks, I'm aware of this. I didn't use this variant because mine can deal with special characters like ÄÖÜ or normal lowercase text, without changing the height of the boxes.

Inspiring
December 10, 2021

Are you doing it implicitly or are you setting explicit values for things like the cap height? I've been using a method where I use a Character Value animator to change all the characters to uppercase E's before time=0 and sample the sourceRect at a negative time. This allows me to see the cap of the top line and the baseline of the last line of text. I'd be curious if anyone has found other methods.

Inspiring
December 9, 2021

Have you tried putting 

posterizeTime(0);

at the top of your expression?

Inspiring
December 9, 2021

Yes it helps. I completely forgot about this function. 

What I forgot to mention in my inital post is, that I'm using Essential Graphics Variables, to make it more customizeable, and then after it is precomped it seems to ignore posterizeTime() in the Expressions and the render times stay the same. Inside the comp it makes it render super fast with even with motion blur.

Inspiring
December 9, 2021

Maybe the essential properties render pipeline re-instantiates the nested comp at each frame, making caching impossible? Or maybe it's just a bug.

Roland Kahlenberg
Braniac
December 9, 2021

The Transform Motion Blur feature calculates Motion Blur on every frame - this is required, by default. If it doesn't calculate on every frame then the Motion Blur effect wouldn't work. 

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
Inspiring
December 9, 2021

Yes, not only does it calculate 1 time per Frame (which would be fine) but reevaluate the expressions for every motionblur sample (16 in my case), so far my terrible understanding of the After Effects render pipeline goes. Reducing the motionblur samples improves the performance, with a big cost in quality, in my opinion.

 

I won't deny that this is a good thing for animations, but when you link "static" values, it becomes an issue. The sourceRectAtTime(0) already disables change over time. But the method itself is still invoked for every frame and sample and thus slowing down the render.

Roland Kahlenberg
Braniac
December 9, 2021

You mentioned Render Pipeline in your first paragraph. If you continue along this path, you will appreciate that Time Dependent effects override a 'static' Expression Method. Either way you go, there will be an issue – either the 'static' Expression Method gets overridden or the Motion Blur.

The decision seems dependent on AE having a preference for quality over time which seems to be what the vast majority of users want in such an application. 

You will also want to take note that should sourceRectAtTime(0) is followed with an Expression Method which requires calculations on every frame, then every frame will be calculated; again a case of a time dependent effect/Expression Method overriding one which is 'static'. HTH

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV