Constructive solid geometry
Boolean operations combine primitives into complex solid models.
Last updated
Constructive solid geometry (CSG) is a technique in solid modeling that uses Boolean operators to combine simpler objects into complex surfaces or objects. It is often used in procedural modeling within 3D computer graphics and CAD, and can be performed on polygonal meshes as well. CSG contrasts with polygon mesh modeling, boundary representation, and box modeling.
Workings
The simplest objects used in CSG are geometric primitives such as cuboids, cylinders, prisms, pyramids, spheres, and cones. The set of allowable primitives is limited by each software package, with some packages supporting CSG on curved objects and others not.
Objects are constructed from primitives using Boolean operations on sets: union (OR), intersection (AND), and difference (NOT), along with geometric transformations. A primitive is typically described by a procedure accepting parameters; for example, a sphere may be defined by its center point and radius. These primitives combine into compound objects, and rendering is particularly simple with ray tracing, where the ray tracer intersects a ray with both primitives, applies the operator to the intersection intervals, and takes the closest point to the camera.
Applications
Constructive solid geometry is a modeling technique used when simple shapes or high mathematical precision are needed. Most engineering CAD programs rely on it, especially for representing tool cuts and ensuring parts fit together. Game development tools like the Quake engine, Unreal Engine, Hammer, and Torque also use it. Its appeal comes from allowing modelers to build complex forms from basic objects.
When the system is procedural or parametric, users can adjust the geometry by moving objects or changing the Boolean operation that combines them. A key benefit is that if every basic shape is water-tight, the final object is guaranteed to be solid, which matters for manufacturing and engineering calculations.
In contrast, boundary representation methods need extra topological data or consistency checks to ensure a valid solid. Another convenient property is that determining whether any point lies inside or outside a CSG shape is straightforward: classify the point against each primitive and evaluate the Boolean expression. This makes CSG useful for applications like ray tracing.
Conversion from meshes to CSG
Converting existing meshes to CSG trees, called inverse CSG, is useful for fabricating customized models. The resulting CSG tree must occupy the same volume as the input mesh while having a minimal number of nodes, with simple solutions preferred for easy editing. Solving this problem is challenging due to the large search space, combining continuous parameters like primitive dimensions and discrete parameters like Boolean operators.
Deductive methods build a set of half-spaces describing the interior geometry, which are used to describe primitives that combine into the final model. Another approach decouples primitive shape detection from CSG tree computation, exploiting modern program synthesis tools to find a tree with minimal complexity. Genetic algorithms are also used to iteratively optimize an initial shape toward the desired mesh.
Notable applications with CSG support
Software with CSG support includes HyperFun, PLaSM, PhotoRealistic RenderMan, POV-Ray, AutoCAD, Autodesk Inventor, Autodesk Fusion 360, BRL-CAD, CATIA, FreeCAD, NX CAD, SolveSpace, Onshape, OpenSCAD, PTC Creo Parametric, Realsoft 3D, Rhino, Solid Edge, SolidWorks, Tinkercad, Vectorworks, Dreams, Godot, GtkRadiant, LittleBigPlanet, Roblox, Unity (via plug-ins), UnrealEd, Valve Hammer Editor, 3Delight, Aqsis, Blender, CGAL, Clara.io, Geant4, Magica CSG, MCNP, OpenMC, SketchUp, and Womp.
More in 3D Computer Graphics
Sources
Compiled from Wikipedia and the sources listed below. Text from Wikipedia is available under CC BY-SA 4.0; this entry is adapted from it.
- Wikipedia: Constructive solid geometry (CC BY-SA 4.0).
Spotted an error? Know more?
Reader corrections go straight into our review queue. Suggest an edit · How this site is sourced
