| Home Page | Recent Changes | Preferences

# CSG

Constructive Solid Geometry (CSG) is a technique for defining a detailed space by building it up gradually with simple shapes. This is what the Unreal Engine uses to define the basic Unreal World.

## Cookie dough

The Unreal world is of course is three-dimensional, but let's imagine something simpler. Suppose you have a big sheet of rolled-out dough on a kitchen worktop and some square cookie cutters. You can create an open space in the sheet by stamping out squares. This is subtracting from the world.

Now suppose the cookie cutters are magical: you can also set them to add dough back in. So if you have a big cutter and a little cutter, you could subtract the big cutter, then use the little one to add a bit back in, maybe along an edge or in a corner. This is adding to the world.

This technique is pretty much what happens when a mapper works in UnrealEd: removing chunks of 3D space and sometimes putting bits back in.

## Brushes

There is one crucial difference between the cookie dough and Unreal. With the dough, the subtractions or additions were made immediately, and once they are made the cookie cutter moves on.

In Unreal, each subtraction or addition to the space is represented by a brush. These are 3D wireframes that represent the shape that is being added or subtracted. You'll see the effects of CSG operations immediately, but brushes will always be there in the map. A brush can be moved, resized, rotated or deleted. To extend the cookie analogy, we're cutting the dough but keeping a copy of the cutter that made it in that place. At any point we can restore the dough and quickly run through all the cookie cutter operations again: this is the build process.

Constructive Solid Geometry (from now on referred to as CSG) refers to the technique of building up a three dimensional area of space (volume if you want to be more precise) from geometric shapes that either create space or fill space.

### A Quick Mind Game

Perhaps the easiest way to think of it is in terms of the addition and subtraction of shapes. Imagine that you have a large solid block of stuff. Imagine that you have a cursor in the shape of a small cube that you can move around in this block of stuff. Using the cursor you can add stuff, or delete (subtract) stuff at the press of a button. If you were to move your cursor into the center of your block and press the subtract button you'd have a hollow cubic space in the middle of your block of stuff.

Still with me?

Now, without moving the cursor, press the add button. Your small cubic space has just vanished. It's been filled with stuff by the addition you just did.

### The Reality

CSG works just like the mind game above. Using what is known as a brush (known as the red builder brush in Unreal Editing parlance) shapes are subtracted from and added to (or painted into, keeping with the brush analogy) the solid block of stuff that makes up the Unreal World. It really is just like adding and subtracting numbers with one vitally important difference.

When a shape is subtracted or added to the world it leaves a small wireframe of effect behind to mark its boundaries (this is also confusingly known as a brush). When shapes overlap only the last operation to be performed on the overlapping areas actually has an effect. The order in which operations are performed is important. In Unreal Editing speak this is known as the brush order.

#### A quick change of pace

When the world is built (called the build process) brushes are processed in the order they were placed within the world, to create a tree of visible surfaces, the BSP Tree. It is this tree of surfaces that you see while playing in an Unreal world.

## A Note About UT2003

One of the big differences between making maps for Unreal Tournament and Unreal Tournament 2003 is that far less CSG is used to create its levels. In a UT2003 map, space is hollowed out (and occasionally added) of the solid world using CSG and then populated using Static Meshes. See Building With Static Meshes for more information.

## Related Topics

- Constructive Solid Geometry - has some nice pictures that illustrate the CSG operations

Category Mapping

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In