Constructive Solid Geometry

Dr Neil Dodgson, University of Cambridge Computer Laboratory




Constructive solid geometry (CSG) essentially consists of Boolean set operations on closed primitives in 3D space. The three CSG operations are union, intersection and difference.

CSG is covered in FvDFH sections 12.7 and 15.10.3.

The following example illustrates the three CSG operations in use on simple three dimensional primitives.

<Image: ray traced sphere> <Image: ray traced box> The two primitives: a sphere and a box.
<Image: CSG union> The union of the two primitives.
<Image: CSG intersection> The intersection of the two primitives.
<Image: CSG difference: box minus sphere> The difference of the two primitives: box minus sphere.

The following example, based on FvDFH Plate III.2, shows an object for which CSG is (probably) the only sensible modelling technique. The object rendered in the right-hand image is constructed from the primitives shown in the left-hand image. It is mostly made out of cylinders.
<Image: CSG example: the primitives> <Image: CSG example: the finished object>

<Image: CSG example: initials> At right, I tried the "Godel, Escher, Bach" treatment on my initials. Unfortunately the letters N, A, and D are not as amenable to this as the letters G, E, and B: notice that the shadow of the N has a slight curve at its top right, owing to the N's intersection with the curve on the D and the slope on the A. Various other arrangements of the three letters were tried, all of which gave more noticable artefacts than this. Each of the letters is a CSG object (the D, for example, is constructed from cylinders and boxes). The final effect is produced simply by intersecting the three letters.

Exercises
  1. Work out how to represent a Lego technic brick as a CSG object. You may assume that you have box and cylinder primitives.
    <Image: some CSG Lego technic bricks> <Image: a close-up of the Lego technic bricks>

  2. [1998/7/12] Work out how to represent the following object using CSG. You may assume the following primitives: sphere, cylinder, cone, torus, box.
    <Image: the object from the 1998 exam question> <Image: the object from the 1998 exam question>

  3. [1999/9/4] (c) List the three ways of combining objects using constructive solid geometry (CSG). Describe how an object built using CSG can be represented using a binary tree. Given the intersection points of a ray with each primitive in the tree, explain how these points are passed up the tree by each type of combination node to produce a list of intersection points for the whole CSG object.
  4. [2000/9/4] (c) Describe how an object built using constructive solid geometry (CSG) can be represented using a binary tree. Given the intersection points of a ray with each primitive in the tree, show how to calculate the first intersection point of the ray with the entire CSG object.


Source file: p4c.html
Page last updated on Thu Sep 14 16:58:08 BST 2000
by Neil Dodgson (nad@cl.cam.ac.uk)