Boolean Improvements

Hi @Howard_Trickey,

I would be extremely happy if Blender would get a Boolean function comparable with Remesh By Boolean in ZBrush. The info about that can be found in the second half of the video.

Basically, Remesh By Union performs a Boolean Union on all self-intersecting parts of a mesh, so no parts of the mesh are left hidden beneath the surface. This is very useful to achieve manifold meshes that are suitable for product development.

The alternative is to perform a remesh operation like OpenVDB, but that often clogs and smooths out small details, gaps, holes, creases, etcetera. And to keep all details after a remesh you need to radically increase the polygon count. Multiple disadvantages compared to a Boolean operation that removes self-intersections.

Do you think this would be possible in Blender? That’d be a fabulous feature.

Many thanks in advance.

2 Likes

My intention has been to make self-intersection work well (much of the code for intersection and boolean is common, and that’s the part I’m working on right now). I hadn’t thought to much about Boolean in the context of self-intersection, but it shouldn’t be too hard to have a mode like you describe (union where parts that end up “inside itself” get removed).

8 Likes

That’s great, good luck, and I’ll keep an eye on your progress. :+1:

1 Like

Just thought I’d post an update. I had hoped to have the new Boolean done by now (beginning of Blender Conference) but failed. However, I am getting close. I have the intersect routine (with coplanar intersections!) working in all but one case (which I know how to fix), and am in the final stages of debugging the boolean operation that comes after doing intersections. After that, when I know the algorithms are rock solid, I need to use much better data structures to make it all go fast. I intentionally use the easiest-to-program data structures first, in order to get the functionality right.

To the last post on this thread: the boolean operations as coded are most natural to write when there are two closed (or almost closed) parts, so that you can just test whether faces are inside the other part. I need to think a little harder how to handle boolean-like operations in the case of self-intersection. But hopefully can find a solution.

31 Likes

That’s great news. Always fun to read about the progress made. Thanks for your hard work!

2 Likes

Thanks you for your work, I hope it will be fixed soon.
Bad problem with only two cube in Union operation with overlapping face.

I you want to work on improving Boolean modifier - here my suggestion on RCS posted long long time ago. To add Iintersect Knife as part of modifier.

Also you can just check RCS search for " boolean " - there are lot of good still undone suggestions.

1 Like

Another update: my code is working on all of my regression tests, including cases where there are coplanar faces. But there is one case I haven’t coded yet (when concave ngons are intersected in a way that creates more than one segment), and I have just started on working on my slow-obvious data structures and algorithms to make the new code as fast as (or nearly as fast as) the current BMesh boolean.

AlfonsoAnnarumma: the code I have now is already working properly in the case of a union of two cubes overlapping as you show.

IIIFGIII: initially I am just targeting getting a drop-in replacement for the current boolean code, but intend to work on maintaining it afterwards, at which point many of the suggestions on RCS look good to consider. However I agree with you that it is kind of silly that the knife cut option is not available for th modifier, so I might sneak that into the initial release.

23 Likes

can’t wait to see your new code in action on what it will do in the future

2 Likes

I’m wondering if the boolean improvements regarding coplanar faces will lead to being able to add a Boolean Modifier to Curve objects as well? In 3ds Max there’s a really solid workflow called ShapeBoolean. It makes the creation of intricate positive-negative shape patterns a breeze.

Right now I’m not aware of any ability to do that in Blender apart from the Boolean 2D Union add-on (destructive), as well as using a combination of Solidify and Boolean with polygon shapes.

What are your thoughts? Thanks.

There is no direct connection between the work needed to intersect curves. I can perhaps look at it in the future.

1 Like

While my code isn’t solid enough yet to push to master, it is doing a decent job in many cases, so I have created a “newboolean” branch on blender git so that people who know how to build blender can try it out and follow progress.

21 Likes

Good news, thanks Howard!

Could someone build that on Windows and upload it to graphicall?

1 Like

Thank you for that. Trying to build Blender for the first time here but getting an error in this case:

blender\source\blender\bmesh\tools\bmesh_boolean.c(524,9): error C2220: the following warning is treated as an error [c:\newboolean\blender-newboolean-dd3ea78\build_windows_x64_vc16_Release\source\blender\bmesh\bf_bmesh.vcxproj]

1 Like

I can’t tell from that error message image what the warning actually is. Is there more verbose output that has the line number and warning?
I do have the ability to compile for Windows but it’s been a while since I tried that and it may take some work to get the environment working again.

2 Likes

@Howard_Trickey I’ll happily take a look, is this master or some branch?
never mind, found it

#pragma mark Miscellaneous utility functions

#pragma mark is a gcc’ism which msvc ignores, warns about it, and because warns as errors is on for bmesh it errors out.

2 Likes

Thanks, LazyDodo. I wondered about that when I put those pragmas in. They are useful for XCode to mark off sections in the dropdown to get to functions, but I can live without them. I’ll remove them.

4 Likes

I pushed an update to the newboolean branch that removed the pesky #pragmas, so hopefully it will compile on Windows now.

3 Likes

I tried to build it but I’m not sure I’m doing it correctly. Anyways I got an error about a file missing from my external libraries but the file is actually present. I’m not sure what the problem is. LazyDodo, did you have a plan of building this branch? Cheers!

Blockquote
C:/newboolean/blender-6724aa5/blender/intern/cycles/kernel/shaders/node_add_closure.osl:1: error: error: could not find include file: C:
ewboolean\blender-6724aa5\lib\win64_vc15\osl/shaders/stdosl.h

FAILED C:/newboolean/blender-6724aa5/blender/intern/cycles/kernel/shaders/node_add_closure.osl
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(231,5): error MSB6006: “cmd.exe” exited with code 1. [c:\newboolean\blender-6724aa5\build_windows_x64_vc16_Release\intern\cycles\kernel\shaders\cycles_osl_shaders.vcxproj]
buildinfoobj.vcxproj -> c:\newboolean\blender-6724aa5\build_windows_x64_vc16_Release\source\creator\buildinfoobj.dir\Release\buildinfoobj.lib

it’s an osl bug i reported 2 years ago they seemingly still have not fixed, it’s unescaping the \n in c:\newboolean

1 Like