Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
July 2, 2022
arrowPress Releases
If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

Boolean Operations

by Dave De Breuck on 06/20/22 12:20:00 pm

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

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.


Related Jobs

PerBlue
PerBlue — Madison, Wisconsin, United States
[07.01.22]

Unity Gameplay Developer (remote)
PerBlue
PerBlue — Madison, Wisconsin, United States
[07.01.22]

Senior Back-End Engineer (remote)
Build a Rocket Boy Games
Build a Rocket Boy Games — Edinburgh, Scotland, United Kingdom
[07.01.22]

Senior Animation Programmer
Build a Rocket Boy Games
Build a Rocket Boy Games — Edinburgh, Scotland, United Kingdom
[07.01.22]

Senior Core Systems Programmer





Loading Comments

loader image