Top left: original mesh. Top right: mesh with SPR. Bottom row shows the subsurfed versions.
Getting a bit closer with SPR, image at right shows my first successful test on “real” input. There’s still more optimization work needed to make this practical (even this small input sample takes about five seconds to finish calculating), but that’s for tomorrow (been up all night, now 7am here), so time for some sleep… but nice to have an actual result.
Tests on various inputs. It gets interesting towards the bottom; note that the very last shape at the bottom could be remeshed many different ways, but it has automatically chosen a set of quads that results in no extraordinary vertices, producing a nice looking grid.
As Blender’s sculpt maintainer, I’m always interested in improving the “clayish” nature of the tool. Ideally you shouldn’t have to think much about the underlying topology and resolution of your mesh. We’re obviously a long way away from that goal (although unlimited clay and dynamic topology sculpting have shown a couple interesting approaches.)
The remesh modifier is also a step in the right direction; it can take an ugly input (non-manifold, stretched polygons, low-res, etc.) and make the output reasonably OK for sculpting. Unfortunately, it isn’t shy about outputting extraordinary vertices (vertices with less or more than four adjacent edges/faces.) The result therefore doesn’t have that nice grid-like structure you’d get from creating a low-res base mesh and subdividing with Catmull-Clark.
There are many potential ways to address this shortcoming; there is a lot of research out there on different remeshing techniques. At some point we may indeed implement additional remeshing algorithms for the skin modifier other than dual contouring. For now though, I’m looking into a simpler post-processing step that could be used to clean up the remesh modifier’s output (or any mesh, really.)
Essentially, the idea with SPR is to find extraordinary vertices in the input mesh and replace the local neighborhood with a set of polygons that contain fewer extraordinary vertices (ideally no extraordinary vertices.) Once an irregular patch is found, all possible replacements are tested to find a better result, and the best one replaces the original irregular patch in the mesh. Repeat until no further improvements can be found.The specific technique I’m attempting to implement is called SPR (from the paper titled “A new method of quality improvement for quadrilateral mesh based on small polygon reconnection” by Jian-Fei Liu, Shu-Li Sun, and Yong-Qiang Chen). The algorithm only works on quad meshes, though of course you can convert a triangle mesh into a quadrilateral mesh as a pre-processing step. The remesh modifier’s output is all quads though, so it fits well there.
The real trick is that even for relatively small patches, the number of possible quad remeshes is huge. Without aggressive pruning, even ten or twelve vertices could take many minutes to finish (it’s a O(n!) search space). Clearly anything that slow would be impractical for use in Blender, so the real trick is figuring out how to stop a dead-end search path as early as possible.
So! That was a lengthy bit of explanation. The code is basically working now, although for now I’m testing it by replacing simple ngons (optionally with unconnected internal vertices) in 2D before attempting full mesh cleanups. It’s still not working fast enough to be practical, but I’m hopeful that with additional pruning tests I can get the time down quite a bit. The image at the top of the post shows examples of the output.
Big thanks to Campbell Barton for reviewing, and to the Blender Development Fund for sponsoring the work, and to everyone who has uploaded builds, tested the modifier, and provided feedback.
Any new bug reports can now go to the Blender bug tracker.
Just committed input averaging to trunk. This is a feature for sculpt, vertex paint, and weight paint that smooths the input stroke by averaging together recent mouse locations. The number of averaged locations can be controlled from the Options subpanel of the 3D View’s toolbar.
Quick update on the skin modifier: Campbell provided nice code review for the first patch yesterday; I’ve just uploaded an updated patch that adds most of his suggested improvements.
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.)
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.
Forgot to post about this before: in response to a BA thread about code.blender.org, I created a test planet aggregator for general Blender development news: nicholasbishop.net/planet-blender. It only has a few feeds for blogs I happened to be aware of, feel free to send me links to other feeds.
I’m not sure how useful this really is — there’s already a Blender planet (http://www.planetblender.org), although without the focus on development. Anyways, just putting this out there in case there’s interest.
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.
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.
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.