Page MenuHome

Mask modifier slow when one of its properties is animated/driven
Closed, InvalidPublic


System Information
Operating system: Windows-7-6.1.7601-SP1 64 Bits
Graphics card: GeForce GTX 770/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.64

Blender Version
Broken: version: 2.81 (sub 1), branch: master, commit date: 2019-08-14 01:55, hash: rBb3c3c835609e

When one of mask properties is animated/driven, it drops performance excessively, the less it hides.

Exact steps for others to reproduce the error

  1. Open attached file;
  2. Play animation to see the fps;
  3. Add a keyframe (I key) to the Display modifier in viewport.

Event Timeline

Germano Cavalcante (mano-wii) lowered the priority of this task from 90 to 50.Oct 3 2019, 7:42 PM
Germano Cavalcante (mano-wii) updated the task description. (Show Details)

I can confirm.
I don't know if this is a known issue or maybe there really is some unnecessary update.

@Sergey Sharybin (sergey), this involves depsgraph and with a quick profiler I realized that applyModifier is responsible for 53.86% of the total frame time.
Is this expected?

(This affects playback performance at the studio! 👀)

Sergey Sharybin (sergey) changed the task status from Unknown Status to Unknown Status.Oct 7 2019, 4:02 PM

By adding animation to the modifier stack you effectively make it so the modifier stack depends on time (since animation depends on time, and modifier stack depends on animation).

There is no tracking of state happening, so when input (such as time) changes the update is propagating through the entire hierarchy, without any checks done from the previous evaluation.

So it is expected that modifier stack is re-evaluating in this case.

Solving this is not impossible, but it would require changing animation system and the way how updates are propagating. And it's really tricky to make reliable without performance regression for the case when real animation is involved.

What you can try doing is to have a pre-update handler and disable visibility of modifier if it's in a state which you don't want it to (as in, don't just assign the value, compare the value first to avoid the block being tagged for update).

This affects playback performance at the studio!

If you have static object where you want to control something on per-shot basis then just create a rig for that object and use driver from that rig. And don't animate the rig.

If it's an object which is belongs to an animated character, then it does need to be re-evaluated and there is no way around it.

All in all, such issues are touching fundamental designs which can not be tackled in a nearest future and hence are handled outside of the bug tracker.

I think an interesting idea would be to allow Custom Properties to be set to non-animatable.

Then if a driver only depends on non-animatable properties, it won't be pushing update calls to the modifier stack every frame.

But for now, I can work around this in a number of ways(including as you described, by storing the previous state of the settings and checking against them in pre_depsgraph_update), so for me personally it's not very important, just thought I'd throw this idea out there.