Mask modifier slow when one of its properties is animated/driven #68740

Open
opened 2019-08-16 17:34:53 +02:00 by Ovionis · 13 comments

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: b3c3c83560

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

2019-08-16 10-23-30.mp4
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.

maskman.blend

**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: `b3c3c83560` When one of mask properties is animated/driven, it drops performance excessively, the less it hides. [2019-08-16 10-23-30.mp4](https://archive.blender.org/developer/F7667507/2019-08-16_10-23-30.mp4) **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`. [maskman.blend](https://archive.blender.org/developer/F7667503/maskman.blend)
Author

Added subscriber: @Phigon

Added subscriber: @Phigon
Member

Added subscriber: @Mets

Added subscriber: @Mets

Added subscribers: @Sergey, @mano-wii

Added subscribers: @Sergey, @mano-wii
Sergey Sharybin was assigned by Germano Cavalcante 2019-10-03 19:55:31 +02:00

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

@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?

I can confirm. I don't know if this is a known issue or maybe there really is some unnecessary update. @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?
Member

(This affects playback performance at the studio! 👀)

(This affects playback performance at the studio! :eyes:)

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

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.

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.
Member

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.

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.
Member

Changed status from 'Archived' to: 'Confirmed'

Changed status from 'Archived' to: 'Confirmed'
Member

I wonder if this should be re-opened as a known issue.

I feel like the workaround is quite involved and probably beyond most users. The performance impact for those who can't work around it is massive. Just ran into this again today with a character going from 24 to 15 fps because of a driven mask modifier, and I had to put my python hat on to work around it with app handlers.

Maybe one day someone will have the time and energy to re-think the way these systems interact. For example, adding a check in drivers to check against their previous value and not fire updates if they didn't change, sounds interesting.

I wonder if this should be re-opened as a known issue. I feel like the workaround is quite involved and probably beyond most users. The performance impact for those who can't work around it is massive. Just ran into this again today with a character going from 24 to 15 fps because of a driven mask modifier, and I had to put my python hat on to work around it with app handlers. Maybe one day someone will have the time and energy to re-think the way these systems interact. For example, adding a check in drivers to check against their previous value and not fire updates if they didn't change, sounds interesting.
Sergey Sharybin removed their assignment 2020-09-07 17:29:36 +02:00

@Mets, the idea you are suggesting is not impossible to be implemented, but it requires some deep changes in how the system is currently functions. It might also cause worse performance in "real" cases, because it will be more difficult to keep all CPU threads busy bu requiring to wait while tree of animation/drives is evaluated.

P.S. The new status and priority represents the state here better than "Unknown Status" :)
P.P.S. Just to be clear: the idea is interesting to investigate, "just" needs to be done with a lot of care, and is hard to squeeze this into the current agenda.

@Mets, the idea you are suggesting is not impossible to be implemented, but it requires some deep changes in how the system is currently functions. It might also cause worse performance in "real" cases, because it will be more difficult to keep all CPU threads busy bu requiring to wait while tree of animation/drives is evaluated. P.S. The new status and priority represents the state here better than "Unknown Status" :) P.P.S. Just to be clear: the idea is interesting to investigate, "just" needs to be done with a lot of care, and is hard to squeeze this into the current agenda.

Added subscriber: @ElioH

Added subscriber: @ElioH

Hi there,

I was just wondering, is it normal then that this modifier (in my case the mask modifier has visibility in render + viewport being driven, but keyframes seem to be quite fine though) would slow the scene down more or less heavily even without playing the animation, just by moving the object in the viewport ?
Especially in EEVEE, it's quite impressive how slow it can get with a relatively low poly mesh, and without any other object in the scene.

Is that related ?

Hi there, I was just wondering, is it normal then that this modifier (in my case the mask modifier has visibility in render + viewport being driven, but keyframes seem to be quite fine though) would slow the scene down more or less heavily even without playing the animation, just by moving the object in the viewport ? Especially in EEVEE, it's quite impressive how slow it can get with a relatively low poly mesh, and without any other object in the scene. Is that related ?
Philipp Oeser removed the
Interest
Modeling
label 2023-02-09 15:29:40 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#68740
No description provided.