Update: the skin-modifier branch has been updated now to make use of the convex hull BMesh operator. From the user perspective everything should still look exactly the same, but code is simpler now.
Spent most of today working on updates to the convex hull operator. As mentioned yesterday I submitted it for patch review; Campbell got on that right quick with helpful feedback. Finally got that work finished a half hour ago: lots of bug fixes and new options to control the output. Branch and code review updated if you’re curious.
In related news, reviewed a patch from Jason Wilkins that adds a handy feature for sculpt: pressing numpad period while in sculpt mode will center the view on the last sculpted area. Blender 2.4x had such a feature, but got lost somewhere along the way. You can expect that feature in trunk soon.
And lastly, the sculpt masking patch is now uploaded to code review.
The initial form created around branch nodes in the skin modifier is a convex hull. I think there are some useful cases for convex hull outside of the skin modifier, so I’ve split this code off into a new BMesh operator and added a corresponding user-accessible operator. The gif above shows an example of how a convex hull can be used as a bridge tool between faces (Blender’s current bridge tool only works if the faces have an equal number of vertices.)
The skin modifier now has a nice icon thanks to Julio Iglesias (Zafio). He also did the icon for the remesh modifier.
Other than that, not much new stuff to report, still working here on topological issues with the skin modifier. Intersecting frames carry their own set of issues…
I have made some significant progress on fixing these holes by applying various tricks to the topology using BMesh. The image at right shows a quick test that would have failed quite badly before these changes due to the four frames that sit partially inside the branch vertex’s convex hull. The new result gives a proper manifold mesh in this case, which you can see better in the lower subsurf’d version.
There are plenty of cases that still fail, but I believe I’m on a good track to fix many of these in a fairly generic way.
Since this code is still very much in flux it’s not yet in my github branch; will post another update when that changes.
My immediate goal is to make it impossible to generate a non-manifold surface with the skin modifier. That will address 90% of the problem. Once that’s ready though, I’m wondering about the possibility of running further passes to clean up the topology. The “limbs” generated by the skin modifier already have really nice simple topology, just long lines of quads. While the branch node areas are inherently less “nice”, it might be possible to do a better job of relaxing the polygons in those areas, perhaps avoiding too much variance in the sizes of polygons, merging long skinny triangles, and turning ngons into quads. For now this is just ideas, not sure how it’ll pan out.
Another concern is symmetry. I expect that for most cases, users will want their skins to have symmetry across one of the axes; the current code attempts to generate symmetric quads (which is already flaky), and the problem gets even worse once these weird branch node topologies are allowed. Still pondering how best to address this issue, will post more when I figure something out.
I’ve pushed some of the new code to github. This update contains only the code for improving connected-ness, none of the fancier relaxation/symmetry ideas mentioned in the last two paragraphs above.
There are still cases that can fail (you may see printouts in the console like “no good face found” in these cases), so still more work to do here. It should now at least be significantly harder to create non-manifold meshes.
I spent all of today trying to find solutions to the holes that can appear around branch vertices in the skin modifier. These holes have been a constant pain since I first started work on the modifier; I’ve sunk a lot of time trying to find solutions but with limited success. Automated merging around branches has helped, but it doesn’t address the core problem.
The problem itself is easy to describe: the polygons around branch nodes are created by generating a convex hull around all connected limb bases (the base of a limb is a frame, which is just four vertices arranged in a square.) Holes appear when one or more frame vertices is inside the convex hull. Holes also arise when one or more frame edges is not part of the convex hull (which can happen even if the edge’s endpoints are not inside the hull.)
The goal is to produce a manifold mesh, and the output should have the same general connectivity as the input (i.e. each set of connected vertices in the input should generate a nice manifold connected output.)
There are a number of possible approaches: more aggressive vertex merging, 3D intersection tests to cut holes in the hull, calculating geodesic shortest paths between hull verts to fix interior edges, reassignment of polygon loops to fix detached vertices, connecting limb bases to nearest existing polygon, and so on.
About the only concrete change I finished today was to convert the skin generation to BMesh. In and of itself, that doesn’t change much except to slow down skin calculation slightly, but it makes it much easier to experiment with topological manipulation. With so many possible input cases to deal with though, I’m not at all sure whether a good solution will be forthcoming from all this experimentation. Will probably give it at least another day though before going back to more “practical” coding.
Some more updates for the skin modifier:
- The “Wire” option in object draw properties now works in Edit Mode. A light wireframe is blended over solid mode when enabled.
- Automatic weights have been improved a bit, long limbs should now bend less (avoiding “loopy” deformation.)
- Generating armature now takes object transformation into account.
I’ve finally got Blender building under Windows, downloads for sculpt masking and skin modifier available here: https://github.com/nicholasbishop/blender-bishop/downloads
For the record, building under Windows is a pain.
Summary of recent changes for the skin modifier:
- Simplified root-node marking. Rather than having to manually clear roots if there’s more than one in a tree, simply select the vertex you want to be root and click “Mark Roots”.
- Generating an armature from skin will now automatically add an armature modifier too, so you can start posing immediately.
- Constructive modifiers above skin modifier work better now; skin roots draw correctly (see for example mirror modifier.)
- Improved quad generation for branch nodes, avoids merging triangles when the resulting quad would be non-symmetric.
- Added RNA/UI for symmetric axis (X, Y, or Z).
- Fix vertex merging, was sometimes creating weird polygons attached to vertex zero.
- The usual set of code cleanups and minor bug fixes.
I’ll be submitting it for code review soon (no rush since it won’t be going into trunk until the start of the 2.64 release cycle), but before I do there’s time for more user testing. No doubt there are still bugs there just waiting for you to find them! Check also the masking documentation on the wiki in case there is anything missing there.