Modifier are still evaluated even when not required. #95198

Open
opened 2022-01-25 15:43:10 +01:00 by softyoda · 13 comments
Contributor

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 496.13

Blender Version
Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: f1cca30557
Worked: never

Short description of error
Modifiers are evaluated, even when blank, for example a lattice modifier without any lattice, would still make depth graph calculation or something like that, that make each action (select, move, rotate, etc.) verry slower.

Exact steps for others to reproduce the error
Create/ import a large object (60M poly mesh for example).
Add lattice modifier, let all option blank.
Disable viewport visibility of this modifier.
Try to move/rotate/scale the object in the viewport, the performance is really low.

In order to transform your mesh, you need to remove all modifiers, and add then back once transform is convenient.

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 496.13 **Blender Version** Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: `f1cca30557` Worked: never **Short description of error** Modifiers are evaluated, even when blank, for example a lattice modifier without any lattice, would still make depth graph calculation or something like that, that make each action (select, move, rotate, etc.) verry slower. **Exact steps for others to reproduce the error** Create/ import a large object (60M poly mesh for example). Add lattice modifier, let all option blank. Disable viewport visibility of this modifier. Try to move/rotate/scale the object in the viewport, the performance is really low. In order to transform your mesh, you need to remove all modifiers, and add then back once transform is convenient.
Author
Contributor

Added subscriber: @softyoda

Added subscriber: @softyoda
Member

Added subscribers: @Sergey, @dr.sybren, @lichtwerk

Added subscribers: @Sergey, @dr.sybren, @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

@Sergey, @dr.sybren: is there a reason why we add a DEG relation to own transform (even if the modifier does nothing really?)

See DEG_add_modifier_to_transform_relation in updateDepsgraph of the lattice modifier (but also many other modifiers : Curve etc).


diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index 29d1ecf6050..0b702a41375 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -101,8 +101,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
   if (lmd->object != NULL) {
     DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Lattice Modifier");
     DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
+    DEG_add_modifier_to_transform_relation(ctx->node, "Lattice Modifier");
   }
-  DEG_add_modifier_to_transform_relation(ctx->node, "Lattice Modifier");
 }
 
 static void deformVerts(ModifierData *md,

Above seems to work correctly and gets rid of the lag in following file:
#95198.blend

@Sergey, @dr.sybren: is there a reason why we add a DEG relation to own transform (even if the modifier does nothing really?) See `DEG_add_modifier_to_transform_relation` in `updateDepsgraph` of the lattice modifier (but also many other modifiers : Curve etc). ``` diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 29d1ecf6050..0b702a41375 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -101,8 +101,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte if (lmd->object != NULL) { DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Lattice Modifier"); DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier"); + DEG_add_modifier_to_transform_relation(ctx->node, "Lattice Modifier"); } - DEG_add_modifier_to_transform_relation(ctx->node, "Lattice Modifier"); } static void deformVerts(ModifierData *md, ``` Above seems to work correctly and gets rid of the lag in following file: [#95198.blend](https://archive.blender.org/developer/F12823330/T95198.blend)
Member

Added subscriber: @Mets

Added subscriber: @Mets
Member

Our lighting artist has also been running into an issue for the past couple of days when working on a complex scene where duplicating lights and some other actions causes tremendous lag.

We found out just now that enabling Simplify fixes the issue, so I suspect that the bug behind this report might be the cause of our issue as well. Do you think that could be the case, based on what you've found out? Duplicating an object causing a scene-wide re-evaluation of all objects' modifiers? Or would that be a separate issue?

Our lighting artist has also been running into an issue for the past couple of days when working on a complex scene where duplicating lights and some other actions causes tremendous lag. We found out just now that enabling Simplify fixes the issue, so I suspect that the bug behind this report might be the cause of our issue as well. Do you think that could be the case, based on what you've found out? Duplicating an object causing a scene-wide re-evaluation of all objects' modifiers? Or would that be a separate issue?

@lichtwerk, not much more reasons other than how the original code was handling things before we took over. Guess was never really a priority to look into because why would one have lattice modifier which doesn't have lattice deformed assigned,, right? ;)

Think the suggestion you brought up in the patch is fine to have implemented for lattice and curve modifiers. Just add some comment explaining that without lmd->object the modifier is disabled, so for the performance reasons relation on the own transform is ignored.

@Mets, duplicating lights should not cause modifiers re-evaluation. If it does, it will be caused by some other root cause. Please make sure the slowdown is reported as a separate task.

@lichtwerk, not much more reasons other than how the original code was handling things before we took over. Guess was never really a priority to look into because why would one have lattice modifier which doesn't have lattice deformed assigned,, right? ;) Think the suggestion you brought up in the patch is fine to have implemented for lattice and curve modifiers. Just add some comment explaining that without `lmd->object` the modifier is disabled, so for the performance reasons relation on the own transform is ignored. @Mets, duplicating lights should not cause modifiers re-evaluation. If it does, it will be caused by some other root cause. Please make sure the slowdown is reported as a separate task.

Added subscriber: @mont29

Added subscriber: @mont29

@Mets This sounds very similar to #94609 (Modifiers are always reevaluated when using an image texture data-block), maybe good to check this report first? especially the file added in one of the latest comment, https://developer.blender.org/T94609#1291980

@Mets This sounds very similar to #94609 (Modifiers are always reevaluated when using an image texture data-block), maybe good to check this report first? especially the file added in one of the latest comment, https://developer.blender.org/T94609#1291980
Author
Contributor

Yes, my bug report wasn't about any light, but it also related to this #94609 as it recalculate modifier when not needed.

I opened this bug not only because the lattice modifier get recalculated when no lattice is selected, but also because it gets recalculated :

  • when you first add the modifier (and no object is selected),
  • when you disable the real-time display modifier in viewport,
  • when you add another object in the scene (even if the large object where the disabled lattice modifier with no lattice is in a disabled collection, it still slows the file the time the calculation is done (and the more your object is large, the longer it takes, with photogrammetry it takes too much time to work conveniently, even with a lot of patience,
  • when you remove the object that have the lattice modifier (it may still exist in undo memory) the viewport is still slow (for example entering edit mode is really fast, exiting edit mode still is a bit slow)
Yes, my bug report wasn't about any light, but it also related to this #94609 as it recalculate modifier when not needed. I opened this bug not only because the lattice modifier get recalculated when no lattice is selected, but also because it gets recalculated : - when you first add the modifier (and no object is selected), - when you disable the real-time display modifier in viewport, - when you add another object in the scene (even if the large object where the disabled lattice modifier with no lattice is in a disabled collection, it still slows the file the time the calculation is done (and the more your object is large, the longer it takes, with photogrammetry it takes too much time to work conveniently, even with a lot of patience, - when you remove the object that have the lattice modifier (it may still exist in undo memory) the viewport is still slow (for example entering edit mode is really fast, exiting edit mode still is a bit slow)
Member

Added subscriber: @kursadk

Added subscriber: @kursadk
Member

I think that this might be related as well, having a super dense multires object also seems to affect the scene performance whether it is the active object or not.

I think that this might be related as well, having a super dense multires object also seems to affect the scene performance whether it is the active object or not.
Philipp Oeser removed the
Interest
Core
label 2023-02-09 14:42:52 +01:00
Author
Contributor

Hi, I just want to mention that this issue persist in my everyday work as I often need boolean to extract interior from exterior of photogrammetry. The boolean in fast work well, I just have to remove generated faces that remain selected in edit mode if the boolean object had all faces connected before the boolean realization.
But doing this takes minutes and add-up to hours of waster time.

The current process is :

Duplicate my object to do the exterior next ~20sec
Add boolean modifier -> ~1min
Set it to fast -> ~1min
Set it to intersect -> ~1min
Select my object to boolean -> ~3min
Apply the modifier -> ~3min

Select my other object ~5sec
Add boolean modifier -> ~1min
Set it to fast -> ~1min
Keep it to "difference" -> 0sec
Select my object to boolean -> ~3min
Apply the modifier -> ~3min

Those example times can be different depending on the poly count, but it remains very long.

Hi, I just want to mention that this issue persist in my everyday work as I often need boolean to extract interior from exterior of photogrammetry. The boolean in fast work well, I just have to remove generated faces that remain selected in edit mode if the boolean object had all faces connected before the boolean realization. But doing this takes minutes and add-up to hours of waster time. The current process is : Duplicate my object to do the exterior next ~20sec Add boolean modifier -> ~1min Set it to fast -> ~1min Set it to intersect -> ~1min Select my object to boolean -> ~3min Apply the modifier -> ~3min Select my other object ~5sec Add boolean modifier -> ~1min Set it to fast -> ~1min Keep it to "difference" -> 0sec Select my object to boolean -> ~3min Apply the modifier -> ~3min Those example times can be different depending on the poly count, but it remains very long.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
6 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#95198
No description provided.