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 , 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