Skin modifier - Slow process with deactivated deform modifiers #41611

Closed
opened 2014-08-28 11:57:14 +02:00 by Karja Krähwald · 8 comments

System Information
Windows 7 64, HD 5770

Blender Version
Broken: 9337574 (2.71 release) + 6891f1c

Short description of error
Skin modifier ignores deactivation of several deform modifiers.
These are (inter alia):

  • Armature (no vertexgroups needed)
  • Lattice
  • Hook (no assignment needed)
  • Curve
  • Cast
    If the Skin object interacts with targets of the mentioned modifiers, the object moves very slow (which isnt the problem), even if the target modifier is turned off (problem).
    It seems there are still ongoing calculations, so the object is hard to move without removal of the target.
    NOTE: This depends on the complexity of the skin mesh, but skin gets general a dramatic slowdown with such target modifiers. (noticable on simple geometry aswell).

Btw: Thank you very much for the speedup @ideasman42 in 92733179ae

Exact steps for others to reproduce the error
Skin_inactiveDeformModifiers.blend

  • Add a Armature.

  • Add a Icosphere. (Subdivisions 2 or higher)

    • Give it a Skin modifier.
    • Give it a Armature modifier.
  • Choose Armature as target for Icospheres modifier.

  • Deactivate the Armature modifier in the modifier list.

Problem: Armature modifier still slows down the Skin mesh.
You can test this by moving the object around before and after adding the armature modifier + target.

**System Information** Windows 7 64, HD 5770 **Blender Version** Broken: 9337574 (2.71 release) + 6891f1c **Short description of error** Skin modifier ignores deactivation of several deform modifiers. These are (inter alia): - Armature (no vertexgroups needed) - Lattice - Hook (no assignment needed) - Curve - Cast If the Skin object interacts with targets of the mentioned modifiers, the object moves very slow (which isnt the problem), even if the target modifier is turned off (problem). It seems there are still ongoing calculations, so the object is hard to move without removal of the target. NOTE: This depends on the complexity of the skin mesh, but skin gets general a dramatic slowdown with such target modifiers. (noticable on simple geometry aswell). -------- Btw: Thank you very much for the speedup @ideasman42 in 92733179ae **Exact steps for others to reproduce the error** [Skin_inactiveDeformModifiers.blend](https://archive.blender.org/developer/F107124/Skin_inactiveDeformModifiers.blend) - Add a Armature. - Add a Icosphere. (Subdivisions 2 or higher) - Give it a Skin modifier. - Give it a Armature modifier. - Choose Armature as target for Icospheres modifier. - Deactivate the Armature modifier in the modifier list. Problem: Armature modifier still slows down the Skin mesh. You can test this by moving the object around before and after adding the armature modifier + target.

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @karja

Added subscriber: @karja
Bastien Montagne self-assigned this 2014-08-28 14:32:17 +02:00

That’s rather odd to say the least :/

That’s rather odd to say the least :/

Added subscribers: @ideasman42, @Sergey

Added subscribers: @ideasman42, @Sergey

Ok, so issue is the following: with only skin modifier, or with armature one without target, the modifier stack is only evaluated once, since DAG detects no dependency, you then can move the object without re-evaluating its modifier stack.

When you add the target object to armature modifier, it tags that object as dependent from the target one, consequently when moving the object, its mod stack has to be re-evaluated constantly.

Now, issue is, disabling e.g. 'realtime' mode of the armature modifier will not affect DAG at all - object is still tagged a dependent of its target, so mod stack keeps getting re-evaluated.

This (bad, wip, demo-only!) patch fixes this by trying to only call a modifier's dag callback if it is actually enabled - and forcing DAG rebuild when changing modifier's modes states:

P131: #41611

diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index eecc04c..704b6a4 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -572,7 +572,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 		for (md = ob->modifiers.first; md; md = md->next) {
 			ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 			
-			if (mti->updateDepgraph) mti->updateDepgraph(md, dag, scene, ob, node);
+			if (mti->updateDepgraph) {
+				const int required_mode = (ob->mode == OB_MODE_EDIT) ? eModifierMode_Editmode: eModifierMode_Realtime;
+				if (modifier_isEnabled(scene, md, required_mode)) {
+					mti->updateDepgraph(md, dag, scene, ob, node);
+				}
+			}
 		}
 	}
 	if (ob->parent) {
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 4911c10..0c2719c 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -3695,7 +3695,7 @@ void RNA_def_modifier(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime);
 	RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-	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_OFF, 0);
 	
 	prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
@@ -3707,7 +3707,7 @@ void RNA_def_modifier(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode);
 	RNA_def_property_ui_text(prop, "Edit Mode", "Display modifier in Edit mode");
-	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_EDITMODE_HLT, 0);
 	
 	prop = RNA_def_property(srna, "show_on_cage", PROP_BOOLEAN, PROP_NONE);

Now I know very few of that DAG area, so not even sure we really want to go in that direction, or just consider that as know limitation currently? Sergey, Campbell, thoughts?

Ok, so issue is the following: with only skin modifier, or with armature one without target, the modifier stack is only evaluated once, since DAG detects no dependency, you then can move the object without re-evaluating its modifier stack. When you add the target object to armature modifier, it tags that object as dependent from the target one, consequently when moving the object, its mod stack has to be re-evaluated constantly. Now, issue is, disabling e.g. 'realtime' mode of the armature modifier will not affect DAG at all - object is still tagged a dependent of its target, so mod stack keeps getting re-evaluated. This (bad, wip, demo-only!) patch fixes this by trying to only call a modifier's dag callback if it is actually enabled - and forcing DAG rebuild when changing modifier's modes states: [P131: #41611](https://archive.blender.org/developer/P131.txt) ```diff diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index eecc04c..704b6a4 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -572,7 +572,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O for (md = ob->modifiers.first; md; md = md->next) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); - if (mti->updateDepgraph) mti->updateDepgraph(md, dag, scene, ob, node); + if (mti->updateDepgraph) { + const int required_mode = (ob->mode == OB_MODE_EDIT) ? eModifierMode_Editmode: eModifierMode_Realtime; + if (modifier_isEnabled(scene, md, required_mode)) { + mti->updateDepgraph(md, dag, scene, ob, node); + } + } } } if (ob->parent) { diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 4911c10..0c2719c 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -3695,7 +3695,7 @@ void RNA_def_modifier(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime); RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - 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_OFF, 0); prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE); @@ -3707,7 +3707,7 @@ void RNA_def_modifier(BlenderRNA *brna) prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode); RNA_def_property_ui_text(prop, "Edit Mode", "Display modifier in Edit mode"); - 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_EDITMODE_HLT, 0); prop = RNA_def_property(srna, "show_on_cage", PROP_BOOLEAN, PROP_NONE); ``` Now I know very few of that DAG area, so not even sure we really want to go in that direction, or just consider that as know limitation currently? Sergey, Campbell, thoughts?

I don't think it's gonna to work reliably. Renderer and viewport are sharing the same DAG, so you can't decouple cases like that so easily.

If it's a root of the issue then i'd consider this a known limitation and solve as a part of the DAG rewrite project.

I don't think it's gonna to work reliably. Renderer and viewport are sharing the same DAG, so you can't decouple cases like that so easily. If it's a root of the issue then i'd consider this a known limitation and solve as a part of the DAG rewrite project.

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Well, after talking on IRC with Sergey and Campbell, agree this is not really fixable in current code, so considered as a know limitation/TODO for future DAG. And skin modifier has to be reworked too, it’s way too slow still in some cases, like this one.

Thanks for the report anyway. :)

Well, after talking on IRC with Sergey and Campbell, agree this is not really fixable in current code, so considered as a know limitation/TODO for future DAG. And skin modifier has to be reworked too, it’s way too slow still in some cases, like this one. Thanks for the report anyway. :)
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
3 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#41611
No description provided.