informa
3 min read
article

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.

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.

Conclusion

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.


Latest Jobs

Treyarch

Playa Vista, California
6.20.22
Audio Engineer

Digital Extremes

London, Ontario, Canada
6.20.22
Communications Director

High Moon Studios

Carlsbad, California
6.20.22
Senior Producer

Build a Rocket Boy Games

Edinburgh, Scotland
6.20.22
Lead UI Programmer
More Jobs   

CONNECT WITH US

Register for a
Subscribe to
Follow us

Game Developer Account

Game Developer Newsletter

@gamedevdotcom

Register for a

Game Developer Account

Gain full access to resources (events, white paper, webinars, reports, etc)
Single sign-on to all Informa products

Register
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more