Boolean composition operations are a structured way to combine solid shapes. The principle comes from set theory, where essentially the points in each shape are combined using logic operators like And, Or, and Not. In the world of 3D shapes, we usually work with the Union, Difference or Subtraction, and Intersection operators. In the image below, two spheres (left) are overlapping. The next three images show Union (A or B), Difference (A or not B), and Intersection (A and B).
Boolean operators are widely used in B-Rep-based CAD solid modellers like Fusion 360 or Solidworks, but mesh booleans are known to be very difficult to implement robustly. High-quality mesh boolean operators tend to be very slow, and still have a lot of requirements on the input meshes. In addition, when they fail, you don't get any feedback about what has gone wrong or what to do about it.
In Meshmixer we have taken a different approach to Mesh Booleans. We don't claim that our method is a complete replacement for the mesh booleans you might find in something like OpenSCAD. However, our method has some advantages, as you will see below.
One pro and con of our method is that it does have various parameters you can manipulate, shown in the property panel to the right. These are useful to improve quality and also handle situations where the default settings result in failures. We explain each parameter below.
Note that to apply a Boolean you must select two (and only two) mesh objects in the 3D scene. If you wish to do a Boolean on shells contained in the same mesh, you must first Separate one. Also, order matters!! The first object you select is the object that will remain after the operation, while the second is the "tool" mesh that will be used and discarded. For Union and Intersection this is only a matter of which scene object continues to exist, but for Difference, the second object is "subtracted" from the first.
If the Boolean succeeds, you will see one object in Orange and one in Blue. If it fails, both will be rendered in red.
Note that while you are inside the Boolean tool, you may notice a crack visible between the two objects. This doesn't mean your Boolean failed! We just haven't finished computing it yet...
How it works
To really use Meshmixer's Booleans, you need to know a bit about how they work. Traditional mesh booleans try to "cut" each set of triangles with the other set of triangles. This can go wrong in lots of ways. So, in Meshmixer we don't cut anything. As shown in the image below, the first thing we do is automatically add more triangles around the intersecting region. Then, we delete strips of triangles from each object, to create a clean boundary loop on each side of the intersection. In this step we also throw away parts of the objects that shouldn't be in the result. Finally, we "grow" these open boundaries together, until they precisely match up, giving us our Boolean result (rightmost image).
In fact, this growing process is nearly identical to that in the Join tool. However, instead of the growing being unconstrained in 3D space, we actually are sliding the boundaries "on" the underlying input surfaces.
This might seem like a crazy way to do a Boolean. However, because we are taking this mesh-editing approach, we can handle some bizarre cases. For example, the images below show "Booleans" applied to objects that are clearly not even remotely solid!
So, now that you know a bit about what is going on inside this tool, we can explain the parameters. The Search Depth parameter is used in the initial remeshing pass, before we delete the intersecting triangle strips. We add some triangles because we want to have enough density to resolve any ambiguities after we delete the strips. We need to be able to match up closed loops on either side. In the example below, this doesn't initially happen - the near-coplanar region results in two loops on one side and one on the other.
This is the most common failure mode of our Boolean. When we have a failure, we go back to the remeshing and try again, at a higher density. The Search Depth controls the number of increase-and-retry iterations. In this example we have to set it to 6 to get a valid result. There is no harm in setting it high, as we stop at the first valid result.
However, each additional iteration is slower than the last! In some cases it might be quicker to go in and manually remesh a problem area yourself, either with the Remesh tool or sculpting brushes.
The Solution Mode setting allows you to specify what kind of Boolean result you want. By default, we use Precise mode, in which we try to solve for the precise intersection curve, as shown in the example above. Max Quality mode is similar, except that we increase all internal thresholds (eg more triangle density, more merging iterations, etc), to try to improve the result.
Fast Approximate mode is quite different, though. In this mode we do not constrain the merge loops to stay on the input surfaces. Instead it is basically identical to the Join tool, applied inside the Boolean framework. As a result, the intersection contour will not be as precise - this is only an Approximate Boolean. However, it is much faster to compute. The image below shows Precise mode on the left and Fast Approximate mode on the right.
Preserve Group Borders
One aspect of our Booleans you will quickly discover is that sharp edges are a weak point. This is due to the remeshing - in fact you will see the same artifacts in the Remesh tool. However, just like in Remesh, we can preserve group borders. So, if your sharp-edge object has face groups (which you can usually generate using Generate Face Groups), and Preserve Group Borders is checked, then the result will be significantly improved. In the example below, the leftmost two images do not have facegroups, while the right images do (click to see a larger image).
As we mentioned above, we need to Remesh the input objects around the intersection curves, to make sure enough triangles are available. If you are working with low-polycount objects, this can result in huge numbers of additional triangles, as shown in the example below. When Auto-Reduce Result is enabled, we try to apply our Reduce algorithms as a post-process. This often cleans up areas of very low-quality triangles (visible in middle image below), so we do this by default. However, if you find that your objects are being mangled, you might try turning this option off.
Use Intersection Curves
In our description above, we explained that we close the cracks we have introduced by growing the open boundaries towards eachother. This works most of the time. However in some cases where the input surfaces are nearly co-planar, the boundaries can merge before they reach the actual intersection curves. When the Use Intersection Curves option is checked, we explicitly compute the intersection curves, and grow the boundaries towards these curves. This can significantly improve the result, as shown below (lower row).
When you are looking at the live preview in the Boolean tool, we actually have not finished computing the full result. We only run a few steps of the loop-merging, to get a decent preview, then compute the full result when you click Accept. The Preview Iterations slider specifies the number of joining rounds computed for the live preview. The main reason to use this slider is to turn it up, to see a closer approximation to the final result. However it is also a useful way to see what is going on inside the tool. If you have a Boolean that is failing in some area, stepping through each round can sometimes help you figure out what is going wrong.
Target Edge Scale
The Target Edge Scale parameter is used in the internal remeshing steps. It is a multiplier applied to the edge length we infer from the initial mesh density. So, a lower value means that more triangles will be used, producing a more accurate result. A higher value means that lower-density meshes will be used in the solution, trading accuracy for increased speed.
In the image below we show, from left to right, edge scales 1.0, 2.0, 3.0, and 0.5
This option enables super-experimental features of our Mesh Boolean. Co-planar regions are problematic for mesh booleans in general. However even worse is nearly-coincident regions, where there are thousands of small intersections. An example is shown in the image below, where a remeshed version of the bunny head overlaps the original. A Difference between these two objects produces an incredibly noisy result (which also fails, in this case).
When Handle Co-Planarity is checked, we try to detect and discard these spurious intersections. This detection requires a sort of radius parameter, which is the Delta value. Increasing this value will increase what is considered noise. In the example below, we increase this value until the Difference eventually produces a desirable result.
This is a somewhat unconventional use of mesh Booleans. However it can be incredibly useful if you are trying to compute the difference between two versions of a 3D model that has been remeshed or otherwise resampled.
Note that currently this option is only available for Difference operations.
Tips and Tricks
Meshmixer's Booleans can be a challenge on meshes that have poor triangle quality. In particular self-intersections and non-manifold regions near the intersection curves can cause failures. However even simple cases can sometimes go wrong, if you are unlucky and there just aren't enough triangles to resolve an important feature. So, if some area doesn't look right, the best policy is add more triangles! Virtually every time we get a bug report about Booleans, we can resolve it by Remeshing. So, remesh!
If you are really stuck, we do have an (extremely) old tutorial video on cleaning up meshes to deal with Boolean failures. This is from meshmixer08, which has a completely different interface! But it might help. Click here to find it on YouTube.