Ligthing the way, with Unlimited Clay

Hi guys, I have a good news, unlimited clay has implemented now navigation/PBVH build/sculpt raycast at 100%, with the same speed level of a regular mesh
this was a black spot I have since the very beginning of the rewrite and I have previously using the brute force method (iterating over the whole editverts and editfaces of the object) in order to grasp the inner working of the sculpt mode, but that was slowing down the speed at high vert counts even if I where not stroking, only moving the brush over the object O.o!, I was sure that eventually something must be done about that… so I did my homework this weekend and finally now the sculpt only iterates over the needed editfaces/verts. I´m not saying that unlimited clay as a whole currently has the same speed of sculpting over a regular mesh without modifiers, no, it still will be hold back by the editmesh tools limitations, but the important aspect of that is that the previous method was hiding the true performance issues due to the limitation of editmesh tools, now they are exposed, since the sculpt action now is no longuer a bottleneck.

Let me explain in bold words how sculpt mode works: Before actually start stroking and sculpting, Blender builds a PBVH tree out of the verts/faces of your base object, this is a spatial organization data structure in order to optimize the vert/faces search in order to avoid testing every element to see if is under the sculpt radius
once correctly build it, on every stroke is now easy to find the affected verts, it don´t have to be rebuild because every sculpt tool asume that the topology does not change and then save a lot of computation time because is a very slow step… but well, with unlimited clay the topology actually change, new verts are added (removed in the future) dynamically so the old PBVH is no longuer valid and it needs to be rebuild on every stroke, currently I´m fully rebuilding it and it has a huge impact in performance, making it slower than sculptris that don’t use an acceleration structure, it is a worst case, so I need to implement a PBVH Update function that only shoud update the existing PBVH tree with the new verts/faces or the deleted ones, and to complicate things further the subdivission step iterates over EVERY vert/face elements of the editmesh because is based on the subdivideflag() editmesh function and I have previously pointed the problem with the current Editmesh mode/structures, that they don´t offer acceleration structures to perform editions in realtime for high polycounts.
But, hey, this is not such a big deal… you know why? because I have narrowed down all the performance limitations to those two issues, the rest of the system is tunned and production ready, and I´m happy for that 😉 while those issues are indeed important and need to be tackle, rome wasn´t buit in a day, and I bet the first iterations of the sculpt mode where very limited, so Unlimited Clay is getting ready for the first round in the wild 😉 and hopefully will atract the attention of the blenderheads in the remaining issues 🙂 (If it wasn´t for Matt Ebb volumetrics could never be done, the same goes for Jahka and Stephen for SPH particles, and for UC I got some pretty good advices from Nicholas Bishop)
Sumarizing a little, to be done:

– A good implementation of PBVH update (good performance gain if could be implemented, a must before public release)

– A good triangle relaxing scheme (I’m on it, this will guaratee a cleaner topology)

– Improve limitations of the EditMesh.

I want to make a pause here because it has many future implications, this module is getting a complete overhaul from the Bmesh project and many things will change, and I´m eagerly awaiting it, if finally Bmesh implement acceleration structures to perform edits in realtime … well, OMG! this issue would be gone forverer and I just will have to make the compatibilization job 😉 , if not, and is just a drop-in replacement of the current system (of course with all the incredible new features and flexibility that the current sistem lacks), well, then this will fall OUTSIDE the Unlimited Clay project and will span a NEW PROJECT: “Realtime Edit mode” 🙂 I´m getting exited about this because as soon as I see the end of my roadmap on the horizon I´m start getting the hunger for new defys ;)! of course, only if is not tackled before, by some other dev and after solving my debt with the community regarding the particles surfacing project 😉 (regarding the particle surfacing I´m seing some bits of code in the Blender source that is pointing some work started in that direction… I just need confirmation if someone is working silently on that ;)?) and while “Realtime Edit mode” is independent from unlimited clay, will contribute directly to it and the rest of Blender because Edit Mode is the backbone of Blender and let´s face it … is getting behind.

Unlimited Clay is far from finish yet, I´m just start seing its horizon, nothing more :P, I need to implement lots of small things to polish it and make it ready for trunk sometime in the future. I need to solve my SVN branch issues, clean a lot the patch to release it and solve some include functions that are in many different spaces with no link between them, implement the undo among other things and there´s this saying: everything will take more time than you think 😉 … but I´m happy because now the unlimited clay path have ligth, and you now know that something is getting cooking in order to raise Edit Mode to keep the Sculpt Mode pace, is not fair to have sculpt models in the order of million verts and watch Blender fall on knees if you ever dare to enter Edit mode 😉

regards Farsthary

25 responses to “Ligthing the way, with Unlimited Clay”

  1. I did not understand most of what you told us here (nothing wrong with yout writing, just me not beeing to gright on these matters), but I´m looking so much forward to be using this.

    Have to express my gratitude ofr your work. My work is dependent on people like you.

    Like

  2. Hi Farsthary,

    couldn’t you just take over the BMesh development?
    We alle hate waiting for it SOOO much and nobidy understands why Blender Foundation does nothing to get this prject forward.

    Couldn’t you just DO IT ?!?

    Like

  3. Bravo on your hard work Farsthary! I am by no means a programmer, but just following your progress and reading your insightful posts has helped me understand so much more on the process.

    Thank you so much for your hard work which I have most certainly benefited from.

    Like

  4. Yea, I can imagine with B-mesh having that neighboring edges information, you could find a peice of geometry and then recursivly fan out to find all neighbors in a certain radius. Not sure how expensive this would be for large radiuses over dense geometry, but it would definitly be lightning fast for small radiuses over moderate tesselation. Then you wouldn’t even an acceleration structure that partitions 3D space.

    Like

  5. I’m excited for you Farsthary, it sounds like you’re having a really good time.

    Keep up the good work man, we are all looking forward to your addition to Blender.

    Like

  6. Thanks so much for your work on this looks like it will be very useful. Please share your work even before its done. Make for good backup… It would be sad to lose what you have done.

    Like

  7. Keep up the great work! We all are very excited and humbled by your incredible work. Can’t wait to play with it 🙂

    Like

  8. …aarrkk..excited.

    Like

  9. awesome work Raul! interesting read.

    I hope developers on open source hears this. PBVH update? Could maybe some external developer like Jakob Wenzel (developing his own renderer mitsuba) maybe have some fast ways of calculating this and updating.

    for what I got from this is that is somekind of ray tracer to find faces that are visible from the users perspective and a way to update it quickly when more geometry is added.

    just a shot in the dark. or maybe ptter from sculptris answers mail ;D

    anyway good luck and I surely hope someone while give you good advice!

    Like

  10. so I need to implement a PBVH Update function that only shoud update the existing PBVH tree with the new verts/faces or the deleted ones, and to complicate things further the subdivission step iterates over EVERY vert/face elements of the editmesh

    like I mentioned before
    http://code.google.com/p/opencamlib/ uses for this purpose adaptive quadtree. Unfortunately you cannot see videos, but they just perform a sort of mesh editing like in unlimited clay ( just for the purpose of material removal for programming of milling machines ).
    see http://code.google.com/p/opencamlib/source/browse/#svn/trunk/src/attic ocode.cpp and octree.cpp
    it does not suite, I think, directly to your needs, but ,seems, could be adapted.

    Like

    1. I think that also loose octrees might get some desired functionality of BVH tree ( http://anteru.net/2008/11/14/315/ (http://www.tulrich.com/geekstuff/partitioning.html ) ) or take a look at paper
      http://www.cg.cs.tu-bs.de/people/eisemann/paper/eisemann07ACO.pdf which deals with dynamic BVH

      Like

  11. There is talk around a 200 line patch which will improve responsiveness of linux significantly even Linus confirms this. I think its gonna be released in .38 branch anyways:-

    There is a easier way, involing editing 2 files and creating a new one, about 12 lines of code, and on Unbuntu 10.10 it makes a huge difference to responsivenes, it may show a nice improvement to unliimited clay?

    You should be able to find the link but i will post it when i can find it again. changes took me about 2 mins, and the change is certainly worth it, happy xmas

    Like

    1. Thanks! Oh, I didn’t knew about that … what is about?

      Like

  12. Wow, what a great news! one of the most awaited features for the unlimited sculpting is done! , and the most important one, so now you can concentrate in the small things and tweaks, and as you said… please DO NOT forget particles surfacing, I’m really looking forward to use all the potential of the new particle system, should be a priority after the unlimited sculpt before you enter in another project.

    Like

    1. Hi 🙂

      well, is not that actually UC is faster, it is still slow, what is fast is the navigation and the sculpting over EditMesh without subdividing, but I have now spotted the slow areas and I have reduced them to only two: the PBVH and the EditMode , so in the future I know where I should point my shots 🙂

      And I will not forget surface particles at all, I’m learning in UC necessary skills tofinish them 🙂

      Like

  13. @ Raul

    Thanks for your work! Keep it up!

    @ The Fatsnacker

    Thanks for that link. This is so cool 😉

    Like

  14. Consentrate on UC for now. Leave the particles and GI for later.
    Its best to work on one thing at a time, then to jump from one to another. This way, one of them gets finished faster.

    Like

  15. Great work on the unlimited clay although I haven’t tried it, it sounds exciting.

    Can you please tell me when this might be available for the mac. I really want to try this so bad but as far as I can see it is only available for windows. Can you please tell me if this can or will be ported to a mac build on graphicall.org etc. so us mac users can give it a try.

    Thanks. 🙂

    Like

    1. As sson as the patch get public I hope builders will compile some mac versions, I don’t use mac so I could not make one myself but is not an issue 😉

      Like

  16. Great news. This is what we like to hear. 🙂 I didn’t think it would be possible to get it near as fast as normal sculpt mode, but what do I know? I once thought I had a fast prime finder, it could find all primes less then 2^32 in about 2 hours. Then I did some research and found a way I could do it in <2min. ( apparently it is possible to do in ~5sec)
    BTW typing "update BVH" in a google search yields some pretty good algorithms for this.
    http://garanzha.com/default.aspx
    Bottom of page. I know your internet is vary restricted so I could E-mail the pdf to you if you want.
    This is more for ray-tracing but I think the same idea could work for UC.

    Like

  17. fantastic is all I need to say. Love the unlimited clay. great job man.

    Like

  18. I’m really looking forward for it – love sculptris but unfortunately it seems the development has stopped since pixologic took over – but on the other hand I’m a bit weary of the bmesh bit. I really hope bmesh will fall through.

    Like

  19. Sounds great Farsthary!
    Thanks, sounds like its really getting slick.
    Keep up the great work! Thanks for everything!

    Like

  20. Congratulations, Farsthary! You did the big job! I hope that before “B-mesh time” it will be done more for Edit Mode.
    If we’ll think subjectively: B-mesh can’t be “inserted” in Blender right now (even if suppose that it’s code is done) because it will automatically “reset” a lot of bug-fixing work and change “beta” to “alpha” (in meaning of usability).
    So, I suppose that it will be started in 2.6a (and I hope for this) 🙂

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Hey!

I’m Bedrock. Discover the ultimate Minetest resource – your go-to guide for expert tutorials, stunning mods, and exclusive stories. Elevate your game with insider knowledge and tips from seasoned Minetest enthusiasts.

Join the club

Stay updated with our latest tips and other news by joining our newsletter.