After reading this section, you’ll know how to use the CSG module to make Constructive Solid Geometry (CSG ).
The CSG extension provides solid modeling nodes for describing 3D shapes as combinations of other shapes using Boolean operations such as merge, intersection, and subtraction.
CSG stands for Constructive Solid Geometry. It is a powerful method for describing a 3D shape as a combination of simpler 3D shapes using the Boolean operations merge (union), intersection, and subtraction. For instance, the expression "(A-B)+C" means remove B from A, then merge the result with C. This is called a CSG expression, describing a CSG tree.
Actual computation of the geometry resulting from a CSG expression can be a slow process, at least not fast enough for real-time updates in interactive applications. However a visual simulation of a CSG shape can be achieved in many cases at interactive speed by using a special rendering method taking advantage of accelerated OpenGL rendering and the stencil buffer.
On Microsoft Windows, you can “hint” to the Pixel Format chooser that stencil buffer support is very important by setting the environment variable OIV_REQUIRE_STENCIL. |
CSG rendering requires two or (potentially many) more rendering passes, which will reduce performance. The number of passes is related to the complexity of the CSG expression and to the convexity of the geometry. Consequently, a good graphics accelerator is highly recommended.
You must also be aware that the more complex the CSG expression is, the slower the performance. The same holds true for the convexity of an object – greater convexity implies slower performance. Furthermore, if the CSG expression exceeds a certain length, a save/restore of the depth is needed and this operation is time consuming. The environment variable OIV_CSG_BUFFER_REGION on Windows allows you to speed up this task.