Sculpt masking merged to trunk

At long last, sculpt masking is in trunk!

Big thanks to everyone who helped out with uploading test builds and providing feedback on features and bugs. Thanks in particular to Brecht for doing code review, and to the Blender Development Fund for sponsoring the work.

Documentation is on the wiki. We’re getting pretty close now to feature-parity with SharpConstruct ;)

Edit: With masking safely in trunk, I’ve removed the masking branch from github and merged the updates to the skin-modifier branch. If you have previously saved files using the skin-modifier branch, the skin data (i.e. vertex size and root markings) will be lost. This is due to the skin data and paint mask data sharing a CustomData layer identifier until now.

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

A day for patches

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.

 

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.

Wire overlay for editmode

Example of wire overlay with skin and subsurf modifiers.

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.

Builds: