All modifiers are recalculated because of one that is disabled. #71490

Closed
opened 2019-11-11 11:31:06 +01:00 by Francois Rimasson · 23 comments

System Information
Operating system: Win 7
Graphics card: Geforce GTX 1660

Blender Version
Broken: version: 2.83 (sub 0), branch: master, commit date: 2020-01-15 17:08, hash: eca8bae671

Short description of error
When disabling a modifier in the viewport for performance reasons, there is still a considerable slowdown.

Exact steps for others to reproduce the error
Claude_tmp.blend

  • Open file
  • Move random vertex of tete.003 mesh

To have a good speed in mesh or in UV edit i have to "disable in viewports" the wig in the outliner

Here is another example file:
bool_slowdown.blend

  • Open file
  • With boolean modifier disabled run the animation.
  • Delete the boolean modifier and compare the speed.
**System Information** Operating system: Win 7 Graphics card: Geforce GTX 1660 **Blender Version** Broken: version: 2.83 (sub 0), branch: master, commit date: 2020-01-15 17:08, hash: `eca8bae671` **Short description of error** When disabling a modifier in the viewport for performance reasons, there is still a considerable slowdown. **Exact steps for others to reproduce the error** [Claude_tmp.blend](https://archive.blender.org/developer/F8059990/Claude_tmp.blend) - Open file - Move random vertex of tete.003 mesh To have a good speed in mesh or in UV edit i have to "disable in viewports" the wig in the outliner Here is another example file: [bool_slowdown.blend](https://archive.blender.org/developer/F8282397/bool_slowdown.blend) - Open file - With boolean modifier disabled run the animation. - Delete the boolean modifier and compare the speed.

Added subscriber: @FrancoisRimasson

Added subscriber: @FrancoisRimasson

#79056 was marked as duplicate of this issue

#79056 was marked as duplicate of this issue

#74015 was marked as duplicate of this issue

#74015 was marked as duplicate of this issue

#73509 was marked as duplicate of this issue

#73509 was marked as duplicate of this issue

#73177 was marked as duplicate of this issue

#73177 was marked as duplicate of this issue

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Can you provide a simple blend file demonstrating the problem?

Can you provide a simple blend file demonstrating the problem?

Sure.
Here it is Claude_tmp.blend

Sure. Here it is [Claude_tmp.blend](https://archive.blender.org/developer/F8059990/Claude_tmp.blend)

Added subscriber: @Sergey

Added subscriber: @Sergey

@Sergey, I wonder if in any of these cases there is any unnecessary dependency.
Strange that if I disable the wig modifier, mesh editing is still slow.

@Sergey, I wonder if in any of these cases there is any unnecessary dependency. Strange that if I disable the wig modifier, mesh editing is still slow.

The speed loss is dependant of the numbers of hair.
Even if the wig is hidden in the viewport (using the eye icon in the outliner) or H shortcut

The speed loss is dependant of the numbers of hair. Even if the wig is hidden in the viewport (using the eye icon in the outliner) or H shortcut
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Think it is because the scalp is shrinkwrapped to the mesh being edited [so HairScalp.002 is dependent on tete.003].
This would cause the expensive point cache reset introduced in d3c08b1aa6 (also commented on in #59077)

If I disable the Particle System modifier on HairScalp.002 (or remove the shrinkwrap), I am getting editing speed back @mano-wii, no?

Think it is because the scalp is shrinkwrapped to the mesh being edited [so `HairScalp.002` is dependent on `tete.003`]. This would cause the expensive point cache reset introduced in d3c08b1aa6 (also commented on in #59077) If I disable the Particle System modifier on `HairScalp.002` (or remove the shrinkwrap), I am getting editing speed back @mano-wii, no?
Member

I do wonder though why only removing the shrinkwrap gives the speed back (I think disabling should be enough?)

I do wonder though why **only removing** the shrinkwrap gives the speed back (I think **disabling** should be enough?)

In #71490#810346, @lichtwerk wrote:
...
If I disable the Particle System modifier on HairScalp.002 (or remove the shrinkwrap), I am getting editing speed back @mano-wii, no?

Yes but...
Disabling modifiers can confuse a user who thinks this can improve the performance of the worked project.
But as can be seen from the file, this is not the case.
You must remove the shrinkwrap modifier to have any difference in performance.
If this is expected, or a known limitation, this report can be archived.

> In #71490#810346, @lichtwerk wrote: > ... > If I disable the Particle System modifier on `HairScalp.002` (or remove the shrinkwrap), I am getting editing speed back @mano-wii, no? Yes but... Disabling modifiers can confuse a user who thinks this can improve the performance of the worked project. But as can be seen from the file, this is not the case. You must remove the shrinkwrap modifier to have any difference in performance. If this is expected, or a known limitation, this report can be archived.
Member

Seems like this is true for all modifiers that add relations [these are added no matter how "disabled" the modifier is]
@Sergey: this might be pretty short-sighted, but would it make sense to add those relations conditionally?

P1162: T71490_doodle



diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 0977a406aa0..b5581518a34 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -24,6 +24,8 @@
 #include "BLI_compiler_attrs.h"
 #include "BKE_customdata.h"
 
+#include "../depsgraph/DEG_depsgraph.h"
+
 struct BMEditMesh;
 struct CustomData_MeshMasks;
 struct DepsNodeHandle;
@@ -127,6 +129,7 @@ typedef struct ModifierUpdateDepsgraphContext {
   struct Scene *scene;
   struct Object *object;
   struct DepsNodeHandle *node;
+  eEvaluationMode evalmode;
 } ModifierUpdateDepsgraphContext;
 
 /* Contains the information for deformXXX and applyXXX functions below that
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index db7c1e5ceae..a0d65631b97 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1967,6 +1967,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
     ModifierUpdateDepsgraphContext ctx = {};
     ctx.scene = scene_;
     ctx.object = object;
+    ctx.evalmode = graph_->mode;
     LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
       const ModifierTypeInfo *mti = modifierType_getInfo((ModifierType)md->type);
       if (mti->updateDepsgraph) {
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 6e81b1343f5..55a765a0912 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -6094,7 +6094,7 @@ void RNA_def_modifier(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport");
   RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
   RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
-  RNA_def_property_update(prop, 0, "rna_Modifier_update");
+  RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
   RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1);
 
   prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index b8d0b19b7bf..73671a0b819 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -159,6 +159,11 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
     mask.lmask |= CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL;
   }
 
+  if ((ctx->evalmode == DAG_EVAL_VIEWPORT) && ((md->mode & eModifierMode_Realtime) == 0)) {
+    printf("skip adding relations, modifier is disabled in viewport\n");
+    return;
+  }
+
   if (smd->target != NULL) {
     DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
     DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");

This way, you could just disable the modifier for the viewport and get your performance back?

Seems like this is true for all modifiers that add relations [these are added no matter how "disabled" the modifier is] @Sergey: this might be pretty short-sighted, but would it make sense to add those relations **conditionally**? [P1162: T71490_doodle](https://archive.blender.org/developer/P1162.txt) ``` diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 0977a406aa0..b5581518a34 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -24,6 +24,8 @@ #include "BLI_compiler_attrs.h" #include "BKE_customdata.h" +#include "../depsgraph/DEG_depsgraph.h" + struct BMEditMesh; struct CustomData_MeshMasks; struct DepsNodeHandle; @@ -127,6 +129,7 @@ typedef struct ModifierUpdateDepsgraphContext { struct Scene *scene; struct Object *object; struct DepsNodeHandle *node; + eEvaluationMode evalmode; } ModifierUpdateDepsgraphContext; /* Contains the information for deformXXX and applyXXX functions below that diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index db7c1e5ceae..a0d65631b97 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1967,6 +1967,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) ModifierUpdateDepsgraphContext ctx = {}; ctx.scene = scene_; ctx.object = object; + ctx.evalmode = graph_->mode; LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { const ModifierTypeInfo *mti = modifierType_getInfo((ModifierType)md->type); if (mti->updateDepsgraph) { diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 6e81b1343f5..55a765a0912 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -6094,7 +6094,7 @@ void RNA_def_modifier(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); + RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1); prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index b8d0b19b7bf..73671a0b819 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -159,6 +159,11 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte mask.lmask |= CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL; } + if ((ctx->evalmode == DAG_EVAL_VIEWPORT) && ((md->mode & eModifierMode_Realtime) == 0)) { + printf("skip adding relations, modifier is disabled in viewport\n"); + return; + } + if (smd->target != NULL) { DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier"); DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier"); ``` This way, you could just disable the modifier for the viewport and get your performance back?

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

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'
Germano Cavalcante changed title from mesh editing and UV editing are slow when a mesh with a lot of particle hair is visible to All modifiers are recalculated because of one that is disabled. 2020-01-17 14:04:12 +01:00

Added subscriber: @ZachHixson

Added subscriber: @ZachHixson
Member

Added subscriber: @M.Pivetta

Added subscriber: @M.Pivetta
Member

Added subscriber: @GabrielMoro

Added subscriber: @GabrielMoro
Member

Trying to merge related tasks here, in this case, I will merge this task into #73199 (Editing an object that is referenced in a disabled modifier (of another object) forces the other modifiers on the same stack to update) (even though that one is newer), lets continue discussion there...

Trying to merge related tasks here, in this case, I will merge this task into #73199 (Editing an object that is referenced in a disabled modifier (of another object) forces the other modifiers on the same stack to update) (even though that one is newer), lets continue discussion there...
Member

Closed as duplicate of #73199

Closed as duplicate of #73199

Added subscriber: @ostapblender

Added subscriber: @ostapblender
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
Interest: X11
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
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#71490
No description provided.