Skin modifier uploaded for review

The skin modifier work is done, at least for now. I’ve completed my own code review, now the patch is uploaded for and awaiting review from another Blender developer. I’ll bring this up at the Sunday meeting tomorrow to confirm this as a 2.64 target.

A couple quick notes about the final version:

  • I’ve noted some people are not happy with node scaling switched from S to CTRL+A, but for now I think it’s the right decision. It’s still up for discussion though, and it’s certainly possible that the code reviewer will have an alternate suggestion.
  • The patch does not include wireframe overlay in editmode (although I have already uploaded that patch separately, it has not been reviewed yet.)
  • Armature generation now makes nicer bone/vgroup names (e.g. Bone.001 rather than bone fe42bc95)
  • The skin modifier now does a remove doubles operation at the end. It has a very small distance threshold, so this only affects some degenerate cases that created very tiny faces.
  • The shading combobox has become a checkbox to match the remesh and screw modifiers.
  • There’s now an operator to squarify skin vertices (averages the X and Y scales.)
  • The documentation has received a few updates.
  • I do not intend to add any new features to the skin modifier until 2.64 is released (at earliest.)

The past few days have had quite a flurry of testing and bug reports, thanks to everyone for that :) Also, apologies if I missed any comments, between replies here, emails, G+, and the BA thread it’s possible some notes slipped by me.

The last two percent

We’re really getting down to the last little bits for the skin modifier. As noted yesterday, the modifier now has user documentation on the Blender wiki. I’ve pushed some code changes (and related documentation updates):

  • Skin vertex scaling is no longer part of the standard SKEY scaling operator; it’s now handled by a new skin-specific operator currently bound to DKEY. The choice of DKEY is completely arbitrary and could absolutely change before it gets committed to trunk. Was pointed out that this conflicts with grease pencil, switched it to Ctrl+A. Hopefully this one doesn’t overwrite anything…
  • A small improvement for armature generation: the extra root bone is now conditional upon the associated root vertex having more than one adjacent edge. See the documentation for an example.
At this point I’m still going through commits in the skin branch to check them for correctness and clarity (and of course fixing the occasional bug as I find them; now’s the time to report any problems you’ve found too.) Once this is done I’ll submit the patch for code review.
I’ve seen lots of skin modifier builds popping up on graphicall.org, my thanks to folks doing that.

 

Skin modifier documentation and code updates

Documentation!

Spent some time today writing up documentation for the skin modifier on the Blender wiki. Most of the tips and tricks for using the modifier should be covered now, and each section has a (hopefully useful) example image.

This page will be moved to the release notes once the skin modifier is in trunk, so it could definitely use some nice user examples. If you create something with the skin modifier you think would look nice on this page, send a link. (It doesn’t need to be just the skin modifier; some sculpted examples would be nice too, especially if you can show the original skinned output too.)

In addition to documentation work, I’ve pushed some improvements to the topology generation. It is a lot more stable now around branch nodes. Although folding still occurs, it’s getting reasonably hard to generate a non-manifold mesh.


Doodling with the skin modifier, clay strips brush, and Cycles.

I’m also starting to enjoy playing with the skin modifier; it’s just fun to doodle with :) I don’t really use Blender as an art tool, but occasionally it’s nice to just play with all the cool tools.

Two new skin modifier features

Pushed a couple updates to the skin-modifier branch: output-face attributes and non-square skin limbs. These have both been frequently requested.

Example of material and shading for skin output.

The skin modifier UI now has a material selector. It shows all the material slots of the active object, and the selection will be used for all faces output by the skin modifier.

Similarly, all faces will be either flat-shaded or smooth-shaded depending on the selection made in the combo box.

Example of non-square skin limbs.

The second change, non-square limbs, means that you can now scale the X and Y axes of vertices independently. It uses the usual scaling mechanism, so pressing (for example) SKEY, XKEY will work as expected. Note that rotation is still entirely automatic, so you can’t choose the exact angle of a non-square limb, but should be OK for many cases.

Code is in the usual place.

Update: as suggested here, I’ve removed the material selection in favor of simply using the object’s first material slot.

Southern Coding

Have been a bit silent here the past week; I just moved back to South Carolina with all the business that entails.

Work continues on the skin modifier though. If you try out the latest updates in the github branch, you should find that it’s a bit closer to the goal of always generating a manifold mesh. It also has a new smoothing option for smoothing the vertices around branch nodes. This needs further thought still; I’d prefer to just get the output looking nicer in the first place.

Some news regarding sculpt masking from the Sunday #blendercoders meeting, Brecht says he plans to review the patch next week (unless someone else can volunteer to do it.)

Also spent some time today playing with the code style checking script (“make test_style”, or “source/tools/check_style_c.py <paths>”.) Fixed up some of the sculpt/paint code in trunk, as well as updates to the masking and skin modifier code. Will try not to waste too much time on pedantic code formatting though :)

Convex hull operator

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

I’ve pushed the code to a new github branch, it’s also in the code review tool.

I am a leaf on the wind (of topology)

 An update on my previous post about holes in the skin modifier.

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.

Update:

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.

Holes in the skin modifier

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.