Sculpting on armatured mesh

Hi everybody, last few weeks I’ve been working under problem with sculpting on deformed mesh and here is first patch going to SVN. This patch mostly changing internal implementation of  brush strokes applying, so only few cases of modifiers are covered now

Unfortunately, not every modifier could be handled correct in sculpt mode and trying to support them could work acceptable for one case but will lead to incorrect and unpredictable result in other cases. All feedback I’ve got was about restricting some cases of modifiers but make things predictable for all other cases. So with new approach of supporting modifiers in sculpt mode you will always see exact mesh shape you’re sculpting on. Technically it means that brush will always know exact position at original mesh and will also know translation which should be applied on displacement made against deformed mesh to be applied on original mesh. The only way to reach this is to disable some “unsupported” modifiers in sculpt mode. Currently, only Armature modifier is supported, but hopefully all deformation modifiers would be supported. Why only armature you’ll ask. It’s simple – this modifier already has got that transformation information to re-calculate displacement to be applied on original mesh, and for most artists I’ve been talking with it’s the most important modifier to be supported (i.e. level small artifacts of rigged characters). Also, due to multires implementation you’ll be also unable to sculpt on deformed multires (I’ll write a bit more about this issue in implementation part of this post and I hope it’ll be also supported in the future).

What about constructive modifiers? I can’t see any suitable way of handling them, so most likely they’ll be permanently disabled in sculpt mode. There is no way to know which part of original mesh should be deformed with stroke. Note, that all modifiers, which can’t be predictable handled in sculpt mode have warning message. I don’t think it’ll be a big problem with unsupported modifiers if there’ll be a hotkey to switch between modes. In this case you’ll be sculpting in predictable way and be able to see final result relatively fast.

So, summarized changes:

  • Sculpting on actual shape
  • Deal with armature modifier (which could be applied on shape key)
  • Quite nice warning message about unsupported modifiers

Implementation

Let’s talk a bit about implementation. Things are quite easy: calculate displacement made against deformed mesh and translate it to original mesh space.  This happens in function named sculpt_flush_deformation() which is called at each brush step. It’s logic very simple – displacement is calculated between current PBVH’s coordinates and coordinates of deformed mesh from previous step. Then this displacement gets multiplied by transformation matrix (crazyspace) and applied on original mesh. At the last, if you’re sculpting on locked key, all the rest relative key block would be updated.

Crazyspace construction isn’t very difficult at this moment – it’s based on modifier’s deformMatricies callback. It’s new callback, but it’s made practically the same things as existing deformMatriciesEM with the only difference – it works with object-mode data. I’m planning to add crazyspace correction like it’s done for edit mode to deal with any deformation modifiers.

And last thing i wanted to describe here is multires deformation. Multires stores coords in grids, and crazyspace stores per-vertex matrices. Sounds like vertexes order in grid and crazyspace could be mapped, but not sure how vertexes are mapped in PBVHVertexIter, so I decided to keep this issue for further work.

P.S. Thanks to Daniel Salazar (ZanQdo) for rigged dragon :)

-Sergey-

This Summer’s Sculpt Mode Refactor
Geometry Nodes Workshop: October 2024
New Brush Thumbnails
Blender 4.3 Beta is here!

13 comments
  1. I understand the problem, the best example would be to try to sculpt on a cube with subdiv modifier on it.

    Making a default hotkey to switch to sculpt mode is a great idea anyway! Reminds me, one for going into pose mode for armatures would be awesome, too. Well and one for objects to go to texture paint.

    So, back to what matters now. The subdivi modifier is always predictable right? The user cannot change the mesh in that modifier. So changes made during sculpting, would be applied to the original mesh. Hence, when you leave sculpt mode, the original mesh gets updated and when you enter back into sculpt mode, it will still look the same. So it would be useful to be able to use the temporary subdivided mesh for sculpting and then propagate the the changes made to it back onto the original mesh right? I don’t have much of a clue of how blender looks under the hood but wouldn’t it be much like multires’s “apply base”?

  2. Thanks for all your effort! I just hope that especially the subdivision surface modifier will be able to be sculpted upon again. I am still stuck with rev 34541 because the patch now disallows me to do it at all. It is just really useful to smooth out geometry using a temporary subdivision surface modifier and sculpting on it instead of sculpting on the original mesh. Especially when the original mesh is really low res.

    • Hi Felix,

      Problem that if base mesh is subdivided several times, most of brush strokes will do nothing — there would be just no real vertices under brush cursor and this could be very confusing. That’s what I’m trying to get rid of and make things work as it’s expected.
      If we want to enable subdivision modifier, we should split modifiers stack calculation for sculpting structures (as PBVH) and for displaying. It could be quite difficult because modifiers could use the same fields from Object. And things would became x2 slower. Making tweaks to existing modifiers stack would make it totally complicated. it’s thing developers don’t want to do.
      The only thing which could be easily implemented — hotkey to switch between modes. That’s what we with Brecht wanted to do to deal with unsupported modifiers. Do you think it’ll be useful?

  3. @Sergey
    Thank you for taking the time to reply to my comment. This feature is usually called topological symmetry sculpting in other apps, ZBrush/Mudbox/etc… In Edit-mode inside blender there is a “similar” feature called “topology mirror”, I’m sure you’re already familiar with it. Though this feature in blender does not do a good job of properly propagating changes symmetrically on a “posed mesh”, when compared to how well Mudbox and ZBrush handle this(which is how it should function all the time). For me, it makes the topology mirror useless in about 50% of the cases I would use it on a posed, but symmetrically modeled mesh.

    AFAIK, sometimes topological symmetry Its usually either generated based on the application choosing a point(or edgeloop) that lies perfectly on the x-axis, then generating an internal set of pointes, or a map of the points using their current transformed position in relation to that originally-chosen vert on the x-axis(or the chosen base edgeloop).

    Or, in the case of blender, it might be easier to get the VERTEX ORDER and/or the vertex id’s based off of their original values in the Base Pose(for an armature, or a shapekey too perhaps), and do some local/tangent-space tricks to make the new armature-deformed pose, or the current shapekey transfer the sculpted vert-transform changes to the proper verts symmetrically(in an armature-pose)

    An app like ZBrush, allows the user to use the base T-Pose of a character as the means for generating a vertex map that allows for symmetrical sculpting topologically once the character has been posed(on a separate frame).

    I’m just throwing out ideas, as I’d really enjoy being able to keep this part of our team’s workflow inside blender one day, and not rely on other apps to achieve this one key aspect of symmetrical sculpting on actors/characters in our anims & games.

    Thank you again for your great efforts so far to bring the blender-world closer to an even more awesome sculpting toolset! Cant wait to see your future commits. :-)

    • Hi Blenderificus,

      Thanks for feedback and ideas. It’s cool that you liked this patch :)

      And yes, there are several ways in solving problem with symmetrical sculpting. Existing method just mirrors local vertex coordinate around local axes. Not sure if it’s very useful, but there are some other problems with it. Main problem — is to find needed point on un-deformed mesh. I have to make this search process as fast as possible due to it should happen at each brush step and mesh could have thousands of vertexes. I’m solving this issue atm, Main problem with this — free from main work time. But i hope there’ll be more patches soon.

      P.S. Symmetric sculpting isn’t the only missed feature here and i’m trying to do my best :)

      • I think there should be a hash table cached about which vertex has which mirror image. Creating this table when applying the mirror modifier wouldn’t be hard. Thus you could please 90% of Blender users, and defer the hard problem of creating such hash for imported models.

  4. I’ve run a recent build through some tests, #34617. And have found that yes, indeed, the crazyspace problem is fixed, with regard to the armature modifier. For that I am, as I stated earlier, most appreciative!!! That is a major milestone.

    I have however found that now, with x-mirroring enabled in the sculpt mode, when the armature of a mesh is not symmetrically posed, the sculpted-changes on one side of the mesh are NOT propagated onto the other side of the mesh. Just thought I’d make a note here, and possibly submit a bug to the tracker soon too.

    • Yeah, there are crazy behavior of symmetric sculpting. Not sure if bug report would be useful, I’ve added this to my TODO list.

      P.S. Good find and thanks for testing :)

  5. Thank-you! This is going to save thousands of hours of corrective shape-keys ( worldwide ).

  6. This sounds really awesome! Was wondering about something like this recently, because I was thinking about doing a still / sculpt in blender, using as reference a Marvel character: Omega Red.
    Will give it a go soon :-)

    Cheers!

  7. I sent a bug report about this sometime ago. Glad that we can see some improvement here. Thank you for your hardwork :)

  8. I cant wait to test this out. I’ve been hoping for the ability to sculpt(especially symmetrically) on a mesh with an armature deforming it for years in blender.

    One thought I had, as it seems it might not work with the mirror modifier(constructive modifier), hopefully one day support for sculpting on a mirrored mesh that has an armature modifier will also be allowed too(if its not already with this patch); I much prefer to keep my actor-meshes only modeled on one side of the X-axis, so changes are easily made.

    THANK YOU ZanQdo for your hard work to bring this MUCH needed feature to Blender! :-)

  9. The crazyspace transform probably made you insane. Kudos for effort.

In order to prevent spam, comments are closed 7 days after the post is published.
Feel free to continue the conversation on the forums.