Constructive solid geometry, aka CSG, is a procedural modeling technique used in solid modeling [3]. One can create a complex surface or a complex object from much simpler primitives (e.g. cylinders, cones, spheres, etc.) or from other compound objects by using Boolean operators. Most widely used Boolean operators are union, intersection and difference in a CSG modeling environment. Currently, many application softwares like CAD tools, raytracers and 3D modeling packages support CSG. Physically based rendering toolkit (PBRT), created by Matt Pharr and Greg Humphreys, is a very powerful, plugin based, extensible renderer. However, one unimplemented part of it is the CSG support. Pharr and Humphreys provide a complete source code along with a competent guide [2] to grasp the theory that lies behind a complex renderer and the logic of physically based rendering. One of the most important properties of PBRT is its plugin based extensibility, which allows the users to contribute their own plugins for adding new features to different parts of the rendering toolkit, nearly on all areas one can imagine. All necessary source code and further information about PBRT can be found in [4]. The aim of our project was adding a CSG plugin into the PBRT system in order to increase the variety of object types.

Dices in the figure below were modeled with our CSG plugin using a text editor. The body of the dice was made by intersecting a cube with a sphere and the small holes were made by simply subtracting the spheres. The scene was rendered using an environmental light and an extra area light for generating larger soft shadows.


In the figure below chessmen were modeled with our CSG plugin using a text editor. Besides the sphere, clcone and clcylinder shapes, a nurbs torus was used for generating nearly all of the pieces. Similar lighting conditions were used as in the previous scene. Materials and textures used are the ones from PBRT’s sample scenes.


The same scene rendered using shiny materials. Black pieces were rendered using substrate material, and the white pieces were rendered using glass material. As can be seen, no seams are visible in glass objects, they look as if they are carved from glass.


You may download the plugin including its documentation, source codes and samples scenes from here.


[1] Hill, F. S. (2001). Computer Graphics Using OpenGL. 2nd ed. New Jersey: Prentice Hall. 802-817

[2] Pharr, M., and Humphreys, G. (2004). Physically Based Rendering: From Theory to Implementation. San Francisco: Morgan Kaufmann.

[3] Constructive Solid Geometry. Retrieved July 25, 2009, from http://en.wikipedia.org

[4] Pharr, M. and Humphrey, G. Physically Based Rendering: From Theory to Implementation. Retrieved July 25, 2009, from http://www.pbrt.org/