Sponsored By

Boolean Operations

Boolean operations are satisfying to look at as they could add, subtract or intersect different geometry with each other. However, performing such operations at run time comes at a heavy cost. Within this article, we propose a better approach.

Dave De Breuck, Blogger

June 20, 2022

2 Min Read

Boolean Operations

In a previous article, we describe what sphere tracing is and how it works under the hood.

Our primary motivation for using sphere tracing is that it can easily represent shapes defined via Boolean operations. These operations are often used in a technique called Constructive Solid Geometry (CSG), which consists of modeling complex shapes by assembling simple shapes such as spheres, cubes, planes, cones, etc. The outcome of these operations might be hard to achieve if we modeled our geometry by hand and being able to blend implicit shapes is a quality that parametric surfaces lack and thus one of the main motivations for using them.

One of the most fundamental actions is to combine two things, which is best expressed mathematically as the union operator. As illustrated, you may achieve this effect by simply returning the smallest distance between the two shapes you want to merge.

You may also use a set difference operator to subtract the volume of one form from the volume of another (also known as a subtraction). To do so, flip the sign of the distance estimator for the first shape. When looking at it, it's clear that the sphere's interior now has a positive signed distance to the surface, but any position outside the sphere now has a negative signed distance. Then, using the larger of the two distances, cut a hole in the second object with the same shape as the first.

Another example is calculating the surface generated by the intersection of two surfaces. We may determine this by finding the largest distance using the max operator. What these operations have in common is that they use Boolean operators, hence the name Boolean operations.

Note that these operations only have a valid distance representation outside the shape (positive values). Even though these operations work for visualization, evaluations used by these operations will only return a lower bound to the actual distance of the resulting surface. However, this is not an issue for our use case, which is rendering implicit geometry, as we will never “march” within the object.


Most modeling systems represent a shape using polygons, NURBS, and subdivision surfaces. These three representations are all altered by manipulating control vertices, which necessitates a high level of knowledge, patience, foresight, and meticulous preparation to ensure that models have adequate control vertices where detail is desired. In addition, operations such as object cutting, slicing, or tearing are challenging for surface-based models. They can be performed relatively easily with a volumetric representation.

Read more about:

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like