Page MenuHome

Skin Modifier - topology changes randomly when entering and exiting edit mode
Closed, ResolvedPublic

Description

System Information
Win7 x64

Blender Version
Broken: c51ca1b

Short description of error
Generated mesh topology changes randomly when changing modes

Exact steps for others to reproduce the error
Open file, hit Tab a bunch of times

Event Timeline

Matt Heimlich (m9105826) raised the priority of this task from to Needs Triage by Developer.
Matt Heimlich (m9105826) updated the task description. (Show Details)
Matt Heimlich (m9105826) set Type to Bug.
Julian Eisel (Severin) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.Dec 14 2014, 2:44 PM

This seems to be a gooseberry only bug. We currently don't have a project dedicated to that, but I don't like having gooseberry branch bugs set to BF Blender. Will check with others if it's worth adding a "BF Blender: Gooseberry" project.

Julian Eisel (Severin) closed this task as Invalid.Dec 14 2014, 4:48 PM
Julian Eisel (Severin) claimed this task.

Okay, so in todays meeting we decided to not allow gooseberry branch bugs. I'd recommend to get in contact with the gooseberry developers in those cases.

But as always: thanks for the report @Matt Heimlich (m9105826) :)

@Matt Heimlich (m9105826) asked for reopening on IRC, since the bug seems to appear on master too.
I still cann't confirm here, but he said some people on #blender did.

Julian Eisel (Severin) reopened this task as Open.Jan 20 2015, 6:35 PM
Julian Eisel (Severin) removed Julian Eisel (Severin) as the assignee of this task.

Hey,
can confirm this - Skin is working continously and not consistent on branched edges.

Want to add that this topology changes occur for nearly every action that can change position or geometry of the skin object (except G/R/S in object mode).
Objects that are related somehow to the skin object (= modifier target, constraints, linked mesh) also cause this problem.

Further examples:

  • Give Skin mesh a Copy Location Constraint (no target needed), turn it on and off.
  • Edit-Objectmode switch on another linked mesh.
  • Moving a mirror-object (mirror modifier target) around.

Use point 3 for the file and you should spot the flickering better while moving the target.

Some steps to easily reproduce using @Matt Heimlich (m9105826) file:

  • get rid of the mirror and subsurf modifiers,
  • ensure you are in edit mode,
  • select all vertices
  • move the mesh around

To quote some comments in MOD_skin.c:

Concave surfaces around branch nodes. The paper does not discuss
how to handle non-convex regions; this code adds a number of
cleanup operations to handle many (though not all) of these
cases.

As the glitch actually appears in one of those concave regions, it might be that this case is not handled properly. @Nicholas Bishop (nicholasbishop) care to have a quick glance here?

Hmm, I've found another comment that could lead us in the right direction:

A frame could be merged diagonally across
another, would generate a weird (bad) T
junction

And that's exactly what appears to be going on:

Assigning to Nicholas to increase pressure a bit ;) Also @Campbell Barton (campbellbarton) might have some input.

I can`t reproduce on standard 2.71 build from blender.org install (I know I know ...i wait for the OpenGL :D refactor ) :)

For the following .gif, I removed the mirror and moved the model in Object mode then applied the Object's Location using Ctrl+a.

I then used Undo and Redo repeatedly to see if this was possibly due to the GPU doing internal triangulation differently based on how Object Mode vs. Edit Mode are passing info to OpenGL .

That is a known nuisance but apparently not the issue here because it's only a slight shading issue that presents itself when that is happening.


For this Skin Modifier problem, the geometry is actually being visually moved to different places in 3D space and the results are often very different just by Undoing and Redoing. After doing that about 20 times, I ended up seeing about 5-6 different configurations of the geometry.

That's very unusual since Undoing and Redoing repeatedly should give identical results for every iteration.

Something weird is happening here. It can be seen in the following animation.

This bug was caused by rB92733179aee8d.

I can see that hull_merge_triangles uses the normal, so presumably some intermediate recalc normal operations are necessary for that. Also, is it ok to use BMO_push and bmesh_edit_begin without BMO_pop and bmesh_edit_end?

Maybe the fix looks something like this, it works but I'm not sure it's correct.

diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index bd16fd0..3b26b4a 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -1763,6 +1763,7 @@ static BMesh *build_skin(SkinNode *skin_nodes,

        /* Merge triangles here in the hope of providing better target
         * faces for skin_fix_hull_topology() to connect to */
+       BM_mesh_normals_update(so.bm);
        hull_merge_triangles(&so, smd);

        /* Using convex hulls may not generate a nice manifold mesh. Two
@@ -1781,8 +1782,12 @@ static BMesh *build_skin(SkinNode *skin_nodes,

        skin_output_end_nodes(&so, skin_nodes, totvert);
        skin_output_connections(&so, skin_nodes, medge, totedge);
+       BM_mesh_normals_update(so.bm);
        hull_merge_triangles(&so, smd);

+       bmesh_edit_end(so.bm, 0);
+       BMO_pop(so.bm);
+
        return so.bm;
 }