Constructive solid geometry (CSG; formerly called computational binary solid geometry) is a technique used in
solid modeling. Constructive solid geometry allows a modeler to create a complex surface or object by using
Boolean operators to combine simpler objects,
[,] potentially generating visually complex objects by combining a few primitive ones.
[.]
In
3D computer graphics
3D computer graphics, or “3D graphics,” sometimes called CGI, 3D-CGI or three-dimensional computer graphics are graphics that use a three-dimensional representation of geometric data (often Cartesian) that is stored in the computer for th ...
and
CAD
Computer-aided design (CAD) is the use of computers (or ) to aid in the creation, modification, analysis, or optimization of a design. This software is used to increase the productivity of the designer, improve the quality of design, improve c ...
, CSG is often used in
procedural modeling. CSG can also be performed on
polygonal meshes, and may or may not be procedural and/or parametric.
Contrast CSG with
polygon mesh modeling and
box modeling
Box modeling is a technique in 3D modeling where a primitive shape (such as a box, cylinder, sphere, etc.) is used to make the basic shape of the final model. This basic shape is then used to sculpt out the final model. The process uses a number ...
.
Workings
The simplest solid objects used for the representation are called ''
geometric primitives''. Typically they are the objects of simple shape:
cuboid
In geometry, a cuboid is a hexahedron, a six-faced solid. Its faces are quadrilaterals. Cuboid means "like a cube", in the sense that by adjusting the length of the edges or the angles between edges and faces a cuboid can be transformed into a c ...
s,
cylinder
A cylinder (from ) has traditionally been a three-dimensional solid, one of the most basic of curvilinear geometric shapes. In elementary geometry, it is considered a prism with a circle as its base.
A cylinder may also be defined as an ...
s,
prisms,
pyramids
A pyramid (from el, πυραμίς ') is a structure whose outer surfaces are triangular and converge to a single step at the top, making the shape roughly a pyramid in the geometric sense. The base of a pyramid can be trilateral, quadrilate ...
,
sphere
A sphere () is a geometrical object that is a three-dimensional analogue to a two-dimensional circle. A sphere is the set of points that are all at the same distance from a given point in three-dimensional space.. That given point is the c ...
s,
cones.
The set of allowable primitives is limited by each software package. Some software packages allow CSG on curved objects while other packages do not.
An object is ''constructed'' from primitives by means of allowable ''operations'', which are typically
Boolean operations on
sets:
union,
intersection
In mathematics, the intersection of two or more objects is another object consisting of everything that is contained in all of the objects simultaneously. For example, in Euclidean geometry, when two lines in a plane are not parallel, thei ...
and
difference, as well as
geometric transformations of those sets.
A primitive can typically be described by a
procedure which accepts some number of
parameter
A parameter (), generally, is any characteristic that can help in defining or classifying a particular system (meaning an event, project, object, situation, etc.). That is, a parameter is an element of a system that is useful, or critical, when ...
s; for example, a sphere may be described by the coordinates of its center point, along with a radius value. These primitives can be combined into compound objects using operations like these:
File:Boolean union.PNG, Union
Merger of two objects into one
File:Boolean difference.PNG, Difference
Subtraction of one object from another
File:Boolean intersect.PNG, Intersection
Portion common to both objects
Combining these elementary operations, it is possible to build up objects with high complexity starting from simple ones.
Ray tracing
Rendering of constructive solid geometry is particularly simple when
ray tracing. Ray tracers intersect a ray with both primitives that are being operated on, apply the operator to the intersection intervals along the 1D ray, and then take the point closest to the camera along the ray as being the result.
Applications
Constructive solid geometry has a number of practical uses. It is used in cases where simple geometric objects are desired, or where mathematical accuracy is important.
Nearly all engineering CAD packages use CSG (where it may be useful for representing tool cuts, and features where parts must fit together).
The
Quake engine and
Unreal engine
Unreal Engine (UE) is a 3D computer graphics game engine developed by Epic Games, first showcased in the 1998 first-person shooter game '' Unreal''. Initially developed for PC first-person shooters, it has since been used in a variety of g ...
both use this system, as does
Hammer (the native
Source engine level editor), and
Torque Game Engine
Torque Game Engine, or TGE, is an open-source cross-platform 3D computer game engine, developed by GarageGames and actively maintained under the current versions Torque 3D as well as Torque 2D. It was originally developed by Dynamix for the 2001 ...
/
Torque Game Engine Advanced. CSG is popular because a modeler can use a set of relatively simple objects to create very complicated geometry.
When CSG is procedural or parametric, the user can revise their complex geometry by changing the position of objects or by changing the Boolean operation used to combine those objects.
One of the advantages of CSG is that it can easily assure that objects are "solid" or water-tight if all of the primitive shapes are water-tight. This can be important for some manufacturing or engineering computation applications. By comparison, when creating geometry based upon
boundary representations, additional topological data is required, or consistency checks must be performed to assure that the given boundary description specifies a valid solid object.
A convenient property of CSG shapes is that it is easy to classify arbitrary points as being either inside or outside the shape created by CSG. The point is simply classified against all the underlying primitives and the resulting boolean expression is evaluated.
[.] This is a desirable quality for some applications such as
ray tracing.
Conversion from meshes to CSG
With CSG models being parameterized by construction, they are often favorable over usual
meshes
A mesh is a barrier made of connected strands of metal, fiber, or other flexible or ductile materials. A mesh is similar to a web or a net in that it has many attached or woven strands.
Types
* A plastic mesh may be extruded, oriented, exp ...
when it comes to applications where the goal is to fabricate customized models. For such applications it can be interesting to convert already existing meshes to CSG trees. This problem of automatically converting meshes to CSG trees is called inverse CSG.
A resulting CSG tree is required to occupy the same volume in 3D space as the input mesh while having a minimal number of nodes. Simple solutions are preferred to ensure that the resulting model is easy to edit.
Solving this problem is a challenge because of the large search space that has to be explored. It combines continuous parameters such as dimension and size of the primitive shapes, and discrete parameters such as the Boolean operators used to build the final CSG tree.
Deductive methods solve this problem by building a set of
half-spaces that describe the interior of the geometry. These half-spaces are used to describe primitives that can be combined to get the final model.
Another approach decouples the detection of primitive shapes and the computation of the CSG tree that defines the final model. This approach exploits the ability of modern
program synthesis tools to find a CSG tree with minimal complexity.
There are also approaches that use
genetic algorithms to iteratively optimize an initial shape towards the shape of the desired mesh.
Notable applications with CSG support
Generic modelling languages and software
*
HyperFun
*
PLaSM
PLaSM (Programming Language of Solid Modeling) is an open source scripting languageA. Paoluzzi: Geometric Programming for Computer Aided Design, Wiley, 2003 for solid modeling, a discipline that constitutes the foundation of computer-aided design ...
Ray tracing and particle transport
*
PhotoRealistic RenderMan
*
POV-Ray
Computer-aided design
*
AutoCAD
*
Autodesk Inventor
*
Autodesk Fusion 360
Fusion 360 is a commercial computer-aided design (CAD), computer-aided manufacturing (CAM), computer-aided engineering (CAE) and printed circuit board (PCB) design software application, developed by Autodesk. It is available for Windows and ...
*
BRL-CAD
*
CATIA
*
FreeCAD
*
NX CAD
*
SolveSpace
SolveSpace is a free and open-source 2D/ 3D constraint-based parametric computer-aided design (CAD) software that supports basic 2D and 3D constructive solid geometry modeling.
It is a constraint-based parametric modeler with simple mechanica ...
*
Onshape
*
OpenSCAD
*
PTC Creo Parametric (formerly known as
Pro/Engineer)
*
Realsoft 3D
Realsoft 3D is a modeling and raytracing application created by Realsoft Graphics Oy. Originally called Real 3D, it was developed for the Amiga computer and later also for Linux, Irix, Mac OS X, and Microsoft Windows.
It was initially written in ...
*
Rhino
*
SelfCAD
*
Solid Edge
*
SolidWorks
SolidWorks is a solid modeling computer-aided design (CAD) and computer-aided engineering (CAE) application published by Dassault Systèmes.
According to the publisher, over two million engineers and designers at more than 165,000 companies w ...
*
Tinkercad
Tinkercad is a free-of-charge, online 3D modeling program that runs in a web browser. Since it became available in 2011 it has become a popular platform for creating models for 3D printing as well as an entry-level introduction to constructive s ...
*
Vectorworks
Vectorworks, Inc. is a U.S.-based software development company that focuses on CAD and BIM software for the architecture, engineering, and construction (AEC), landscape, and entertainment industries. Vectorworks is owned by the Nemetschek Group ...
Gaming
*
Dreams
*
Godot
*
GtkRadiant
Based on Id Software's open stance towards game modifications, their ''Quake'' series became a popular subject for player mods beginning with '' Quake'' in 1996. Spurred by user-created hacked content on their previous games and the company's ...
*
Unity
Unity may refer to:
Buildings
* Unity Building, Oregon, Illinois, US; a historic building
* Unity Building (Chicago), Illinois, US; a skyscraper
* Unity Buildings, Liverpool, UK; two buildings in England
* Unity Chapel, Wyoming, Wisconsin, US; a ...
, via free or paid plug-ins from the
Unity Asset Store.
*
UnrealEd
*
Valve Hammer Editor
*
Roblox
Others
*
3Delight
3Delight, also known as 3DelightNSI, is 3D computer graphics software that runs on Microsoft Windows, MacOS and Linux. It is developed by Illumination Research. It is both a photorealistic and NPR path tracing offline renderer based on its ...
*
Aqsis (as of version 0.6.0)
*
Blender – primarily a surface mesh editor, but capable of simple CSG using meta objects and using the Boolean modifier on mesh objects.
*
Clara.io
Clara.io is web-based freemium 3D computer graphics software developed by Exocortex, a Canadian software company. The free or "Basic" component of their freemium offering, however, places severe restrictions, such as on saving models and importin ...
*
Geant4
*
MCNP
Monte Carlo N-Particle Transport (MCNP) is a general-purpose, continuous-energy, generalized-geometry, time-dependent, Monte Carlo radiation transport code designed to track many particle types over broad ranges of energies and is developed by ...
*
SketchUp
SketchUp is a suite of subscription products that include SketchUp Pro Desktop, a 3D modeling Computer-Aided Design (CAD) program for a broad range of drawing and design applications — including architectural, interior design, industrial and ...
References
{{reflist
Computer-aided design
3D computer graphics
Euclidean solid geometry