Dynamic Topology Sculpting

Dynamic Topology Sculpting

Hi all,

Past couple months I’ve been working on implementing dynamic-topology sculpting for Blender. The implementation is based off the paper Freestyle: Sculpting meshes with self-adaptive topology by Lucian Stãnculescua, Raphaëlle Chainea, and Marie-Paule Canic. It’s getting stable enough to where people might find it fun to play with, so I thought I’d talk a bit about the tool and its current status.

Quick demonstration videos: https://www.youtube.com/watch?v=GFFtR8wBtZ8, https://www.youtube.com/watch?v=F0X51O4RgWs

High-level Overview

The dynamic topology tool allows sculpt mode to change the topology of the mesh as you sculpt. It operates on triangles, so you have to convert quads to triangles before using it. The mesh is updated as you sculpt (during the stroke, not just at the end of a stroke.) The tool places restrictions on the lengths of triangle edges to ensure that the topology stays “nice” for sculpting (no long skinny triangles.) The triangle density is constant across the mesh; there’s no way currently to make the tool give more triangles in a particular area.

The paper uses three basic operations to update the mesh: collapsing long edges, subdividing short edges, and merging close vertices. All three of these operations are implemented, but vertex-merge is currently disabled, as it’s too crashy to use right now. These operations require adjacency data that is not normally present in Blender’s mesh representation. The paper recommends storing the three triangles adjacent to each triangle, as well as a single adjacent face for each vertex. This is enough to quickly calculate the 1-ring for vertices as needed. To make adding and removing vertices/faces easy, they’re stored in linked lists rather than the usual mesh arrays.

Implementation Notes

Most of the code lives in blenlib/dyntopo.c and blenlib/pbvh.c.

The linked-list representation is a bit similar to EditMesh, but smaller, simpler, and easier to integrate with the PBVH. The PBVH is the spatial data structure used in sculpt mode for making fast searches for which vertices to update and partial redraw. Ordinarily the PBVH contains arrays of mesh-element indices; these arrays are built just once when you enter sculpt mode. For dynamic topology sculpt, list bases for the vertices and faces were added to the PBVH nodes. At the end of each stroke, any modified nodes are checked to see if the number of faces they contain has grown too large, and if so they are split. (Empty nodes should also be collapsed, but I haven’t gotten around to that yet.)

Testing

Code is available from Gitorious, in the “adaptive” branch:

https://gitorious.org/~nicholasbishop/blenderprojects/nicholasbishop-blender

git clone git://gitorious.org/~nicholasbishop/blenderprojects/nicholasbishop-blender.git
git checkout adaptive

Only CMake build system has been updated, but you could easily update scons too if you prefer that.

Usage is pretty simple: create a mesh, convert to all-triangles, enter sculpt mode, and click the “Dynamic Topology” button. Note that only the “simple” brushes work right now. Fancy things like smooth and grab will crash. Sculpting on a non-dynamic topology mesh will crash. Undo is disabled. Lots of other things I’ve forgotten about will also probably crash. Have fun! :)

The Future of Overrides
This Summer’s Sculpt Mode Refactor
Geometry Nodes Workshop: October 2024
New Brush Thumbnails

42 comments
  1. Hi, I’m really interested to see the code in repository, however the link to the project seems to be invalid. Does that mean this project is no longer being maintained?

  2. Hello everyone involved,

    thank you for the beautiful program “Dynamic Topology Sculpting”
    we all have thus far. But I was just dreaming away.

    It would be nice if you had a tool to merge several objects together,
    and another tool to make holes in the digital clay, all the way through,
    like melting ice. Or foam, which you can blow holes through.

    It would make your workflow much more organic this way.

    if it is already possible, but I haven’t found the right buttons,
    let me know.

    Greetings.

  3. im probably being stupid how do i get this into blender?

  4. Really nice, this is evolving fast! thank you Nicolas.

  5. Whats going on here in blender, you see many new features such as this one and yet they are never released?.
    I would love to see improvements to sculpting such as masking and layers which was both in Google summer code, but then abandon ship what gives ?.

  6. Hello! First of all, I would like to say thanks to Jonathan for this awoseme, much needed tutorial, I have been looking for something like this for years. That and the fact that blender is way easier to navigate than I expected, have helped me, in days, realize a project I was holding back for a long time. Secondly, I do have a little situation I could use some help with: when I produced the spheres for the eyeballs, it sort of did it in a way that the program sees all meshes as one (the body and the eyeballs). This posses a little problem for selecting parts that overlap each other. I have come as far as this video goes and I have been able to navigate around it, but I fear this may pose a problem in the future, maybe because I shouldn’t have done it this way in the first place. Can I separate and make it into another object, or something? All the advice is appreciated in advance. Thanks again and I wish much success to J. W. and all of us aspiring artist.

  7. Will there be a new release of dynamic topology sculpt now that bmesh is out?

  8. Really nice, this is evolving fast! thank you Nicolas.

  9. Looks good!
    Nicholas, you’ve lately been working on some truly amazing projects: Ptex, Remesh and the Skin modifier. All of these have amazing potential, but seem to be half finished. I hope you can find a way to finish these up.

    Blender development seems to cause a large number of fantastic work uncommitted and abandoned. I hope that doesn’t happen to things like the Skin modifier.

  10. My name is Eri Tsurufuji. I am a Computer Science major at Tsuda College. We are doing a project about Global Collaboration.

    I am sorry to bother you, but I was wondering if you could answer a few of my questions about Blender. This would be a huge help to me and my class.

    1. what are you doing for Blender?

    2. Why did you join this project?

    3. how do you collaborate with other developers?

    I look forward to receiving your reply.

    Yours sincerely

    Eri Tsurufuji

  11. Hi everyone,

    Latest pull from the branch and I still can’t compile the adaptive branch using cmake. Always stuck at

    [ 24%] Building C object source/blender/blenlib/CMakeFiles/bf_blenlib.dir/intern/BLI_mempool.c.o
    /blender/branches/adaptive/blender/source/blender/blenlib/intern/BLI_mempool.c:79:3: error: redefinition of typedef ‘BLI_mempool’
    /blender/branches/adaptive/blender/source/blender/blenlib/BLI_mempool.h:45:28: note: previous declaration of ‘BLI_mempool’ was here
    make[2]: *** [source/blender/blenlib/CMakeFiles/bf_blenlib.dir/intern/BLI_mempool.c.o] Error 1
    make[1]: *** [source/blender/blenlib/CMakeFiles/bf_blenlib.dir/all] Error 2

    What setting should I change to properly compile this branch?

    Thanks.

  12. Nicholas, keep this project going. It should be one of the most increadible features for a 3d sculptor. I agree multires isn’t usable at this moment when we’re talking about serious details sculpture.

    Dynamic topology is the only way to keep sculpt tool alive in blender!

  13. Ok! This is awesome. Its what Blender Sculpting should be. I hate the multires modifier!!

    Just a note:
    I’ve been having crash problems with several of the sculpt brushes in dynamic topology mode. I know smooth and grab make it crash for sure. Just letting you know!

    Love this thing!

  14. sorry for the negativity. I’ve had so much hope and anticipation to see this implemented in Blender. Farsthary trully got my hopes up with those videos.

    I am very excited about this and doesnt matter who implements it in the end. I believe that the best result would be the colaboration between nico and farsthary.

    Freemind> interesting you should mention that. I founr out that the other day that drpetter (sculptris developer) is working on an autoretopology implementation:
    http://www.zbrushcentral.com/showthread.php?96408-Playing-with-polygons-topology

  15. Not to be negative. But I’ve seen a lot of amazing tools developed/tested (ptex, skin modifier, remesh, etc.) and never make it into trunk. Most of us can’t use branches other then for a quick play and test. Will this tool make it into trunk or is it another fun experiment that will never see the light of day?

    All complaining aside this looks like an excellent tool and would definitely be a useful.

  16. Has anyone built this for Mac yet?

  17. SWEET!!!

  18. I downloaded the posted build, where is the dynamic topology button? I’ve looked everywhere for it.

    • testing the build:
      1º Enter Sculpt mode ([T] key if the left panel is not already there).
      2º Go options and click [toggle dynamic topology] button

  19. This has a lot of potential! The automatic whole punching looks truly awesome.

  20. “Imagine using the skin modifier, combined with shrinkwrap for doing retopology on body”

    Gives an interesting algorithm idea for auto retopology:
    ♦ Auto Generate an edge skeleton in the mesh, recognizing edge rings and bends.
    ♦ Skin
    ♦ Shrinkwrap.
    ♦ Using user drawn guide lines, edit the topology.
    ♦ Subdivide more detailed parts.
    ♦ Shrinkwrap.

    I wonder how that would turn out…

  21. I have been playing with the windows build all morining and have to say I’m thrilled with it! From out of the blue, a great sculpting tool that is pretty useable already. When the kinks are ironed out, it will be a mighty asset to recommend Blender. I have updated my zbrush but for all its fanfare, this excites me more.

    Glenn

  22. You rock Nico! Thank you for making this possible in Blender and not waiting for Farsthary’s implementation- it has been more than half a year and he has not released any code . Honestly it looks like he is
    1.Putting most of his time where he gets paid- the unlimited clay implementation in 3d COAT
    2.waiting for B-mesh to hit stable

    I dont see a reason for anyone to be unhappy with this beautiful work here. Two implementations of unlimited clay are better than one. Even more so- this is a combination of the work of three people,rather than one- its better documented and open than Farsthary’s attempt.

    That said, I cant wait to see the farsthary unlimited clay modifier in Bmesh, if its ever out. The last thing missing now for me is having the skin modifier and this in one build- up at graphical.

    Imagine using the skin modifier, combined with shrinkwrap for doing retopology on body

    • honestly, farsthary is doing an amazing job, see above his comment in this post Oct 18, 2011.
      Talk about the motive why farsthary pause the UC, “Putting most of his time where he gets paid”, please… no need. is not of our business.
      Lets support the developers, the efforts they make, giving positive comments, testing their work, sharing, giving “open” suggestions not ultimate them, giving material support by donating.
      It’s not that simple like rub a hand in a lamp.
      Positive support to Nicholas.(lets focus our attention in Nicholas)
      Positive support to farsthary.(he has a blog where can talk about UC)
      Positive support to all developers.

  23. “Nicholas, Is this part of blender salad??”

    I’m 100% sure it’s not.
    Blender salad is made out of GSOC projects.
    This is not a GSOC project.

  24. nice thing. i hope it doesn’t get lost when blender is updated to bmesh.

    @msys: i’m 99% shure that not.

  25. Nicholas, Is this part of blender salad??

  26. @Glenn I’ve uploaded a windows build at graphicall earlier today:
    http://www.graphicall.org/688

  27. Is anyone planning a build so we can play with it? :) cough* Windows* cough!

  28. Hi Nicholas! Great, excellent news, I just saw this post after sending you a message to blender dev mailing list, I think you are very close to get what UC was initially intended for, so I will be more than honored if I can point you out few advices to help you save some time since I have face the same issues you are facing now :)

    Cheers
    Raul

  29. I just discovered that the snake hook brush is working properly with dyntopo, did another quick video: http://www.youtube.com/watch?v=F0X51O4RgWs

  30. Last message from Raul (Farsthary) to the developer list: “the patch is more like spagetty code and for internal development, I use all of those hacks in order to get a working system first, and only
    then start reworking/redisigning into a readable form.”

    We are still very eager to get things work, but first step would be a developer proposing it to be more or less ready for review and integration.

  31. This code is independent of unlimited clay. I don’t know if Farsthary plans on continuing that project for Blender or not. (Note that this project is not any more or less “official” than unlimited clay.)

    This project is also quite independent of BMesh. As noted in the post, it uses its own internal representation that is not dependent on EditMesh (and EditMesh will be replaced by BMesh.)

  32. It seams like Farshary abandoned Blender developement.

  33. Me three on all those questions.

    Let’s not forget about Farsthary, but instead help him! We can’t rise together if we don’t work together.

    https://svn.blender.org/svnroot/bf-blender/branches/branch-farsthary/

  34. I know UC was on hold due to Bmesh/performance issues, but then this shows up and it looks really good! Great work indeed, almost too good to believe ;) Does dynamic Topology Sculpting suffer from the same performance issues? Does Bmesh integration affect this at all? Assuming both UC and Dynamic Topology Sculpting are complete, will they have to be unified into a single tool/option? So many questions!

  35. I believe Unlimited clay seems to be “independent”, apart from Blender “official” dev projects. And the last update Farsthary say: “UC is currently on hold for several reasons, most important is that is awaiting for the official integration of B-Mesh project…”
    http://farsthary.wordpress.com/2011/07/16/why-is-unlimitedclay-on-hold/

    Great work Nicholas.

  36. NIIICE! :)
    This, with skin modifier and remesh, will be awesome pipeline :D

  37. same question as above.
    what’s the relation between the two projects.
    Will you be working together?
    Does this also rely on bmesh?

  38. Wait wait… Why is this so great-looking and Unlimited Clay so abandoned? What’s the relation between the two? The ability to punch holes through the mesh like in the video is so far ahead of both UC and Sculptris.

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