Many of the tools on this page let you write CSG scenes as an XML document. A CSG tree is either a brush, or an operator containing some number of brushes. The root of the CSG tree must always be a single node, so if you want to have multiple brushes, make the root node a union containing multiple brushes.

Brushes

Brushes define leaf shapes in the CSG tree. Brushes do not contain child elements.

<brush points="x0,y0 x1,y1 …"/>

The most basic brush, this defines a solid at the convex hull of the points defined in the points attribute.

<box center="x,y" width="w" height="h"/>

Shorthand for a 4-point brush making a rectangle. The rectangle is centered, rather than defined at a corner point.

<circle center="x,y" radius="r" count="n"/>

Shorthand defining a polygonal circle with a given number of vertices.

Operators

Operators are used like this:

<add>
  <brush points="…"/>
  <brush points="…"/>
</add>

Currently, operator tags don't have any attributes, only children.

<add> or <union>

Form the union of CSG trees, solid where any of the children is solid.

<sub> or <subtract>

Subtract the CSG trees. Solid where the first child is solid, but not where any of the following children is solid.

Given <sub>a b c d</sub>, this is logically equivalent to a - b - c - d.

<and> or <intersection>

Form the intersection of all child CSG trees, solid only where all children are solid.