Page MenuHome

Skin modifier - Slow process with deactivated deform modifiers
Closed, ArchivedPublic

Description

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 @Campbell Barton (campbellbarton) in rB92733179aee8d7997c843149dfb640a508ade647

Exact steps for others to reproduce the error

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

Event Timeline

Karja Krähwald (karja) raised the priority of this task from to 90.
Karja Krähwald (karja) updated the task description. (Show Details)
Karja Krähwald (karja) edited a custom field.

That’s rather odd to say the least :/

Bastien Montagne (mont29) lowered the priority of this task from 90 to Normal.Aug 28 2014, 2:32 PM

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:

1diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
2index eecc04c..704b6a4 100644
3--- a/source/blender/blenkernel/intern/depsgraph.c
4+++ b/source/blender/blenkernel/intern/depsgraph.c
5@@ -572,7 +572,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
6 for (md = ob->modifiers.first; md; md = md->next) {
7 ModifierTypeInfo *mti = modifierType_getInfo(md->type);
8
9- if (mti->updateDepgraph) mti->updateDepgraph(md, dag, scene, ob, node);
10+ if (mti->updateDepgraph) {
11+ const int required_mode = (ob->mode == OB_MODE_EDIT) ? eModifierMode_Editmode: eModifierMode_Realtime;
12+ if (modifier_isEnabled(scene, md, required_mode)) {
13+ mti->updateDepgraph(md, dag, scene, ob, node);
14+ }
15+ }
16 }
17 }
18 if (ob->parent) {
19diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
20index 4911c10..0c2719c 100644
21--- a/source/blender/makesrna/intern/rna_modifier.c
22+++ b/source/blender/makesrna/intern/rna_modifier.c
23@@ -3695,7 +3695,7 @@ void RNA_def_modifier(BlenderRNA *brna)
24 RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime);
25 RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport");
26 RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
27- RNA_def_property_update(prop, 0, "rna_Modifier_update");
28+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
29 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 0);
30
31 prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
32@@ -3707,7 +3707,7 @@ void RNA_def_modifier(BlenderRNA *brna)
33 prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
34 RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode);
35 RNA_def_property_ui_text(prop, "Edit Mode", "Display modifier in Edit mode");
36- RNA_def_property_update(prop, 0, "rna_Modifier_update");
37+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
38 RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
39
40 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.

Bastien Montagne (mont29) changed the task status from Unknown Status to Unknown Status.Aug 28 2014, 4:05 PM

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. :)