Brush Tools

This page gives an overview of each of the main editing modes in SabreCSG. This page was written with respect to SabreCSG 1.2, so if you are missing features please make sure you are up to date either through the Unity Asset Store window or by visiting the SabreCSG Download Centre.


Contents:

Free Mode

Free mode temporarily disables SabreCSG’s brush editing and hides brushes. It’s particularly useful for quickly seeing how the level looks without brushes. Note that if you select non-CSG objects from the hierarchy, SabreCSG will disable until you reselect a CSG object (CSGModel or brush), allowing you to quickly and intuitively jump between editing CSG and other objects.


Resize Mode

The default tool for interacting with brushes in SabreCSG is the Resize tool. This tool allows you to quickly select, move, rotate, and scale brushes.

In Resize mode, selected brushes have a white wireframe bounding box drawn around them. Even with complex, non-cuboid brushes, the bounding box will be cuboid; this distinction is important because, when using the Resize tool, you interact with the brush by interacting with its bounding box.

3B resize mode

1. Selecting a Brush

Prior to editing a brush, it is necessary to select it. With the Resize tool, this simply means clicking on the brush. The white bounding box in Resize mode isn’t used for selection, so it is necessary to click a face of the brush itself to select or deselect it. However, because the brushes are transparent, you can select a brush that is behind another brush by clicking again. By repeatedly clicking the same position, you can cycle through the possible selections, from closest to most distant. Sometimes it will be faster to reposition the camera before selecting a brush, but at other times cycling through brushes is more convenient, such as in levels with many subtractive brushes.

3Bii select cyclingCycling the selection by clicking repeatedly

You can also select multiple brushes at once by holding Shift while clicking. This is useful for duplicating and translating multiple brushes simultaneously, or for deleting groups of brushes. To remove a brush from the selected group, hold Ctrl and click.

When editing groups of brushes, the bounds will be for all the selected brushes. If Unity is set to Global orientation then the bounds will be aligned with the world axis, if Unity is set to Local then the bounds will be aligned to the rotation of the first selected brush.

Selecting multiple brushes in Resize mode

You can also select brushes through Unity’s Hierarchy window. The brushes under CSGModel in the Hierarchy are ordered as they are created; that is, the top brush was there first, and the bottom brush was there last. If you build out part of a level, and then decide you don’t like it, you can select the last brush, then hit Shift+Up to quickly select the changes, and then hit Delete to remove them. This is often faster and allows for greater control that using Undo repeatedly.

With more complicated levels, it is useful to create groups of brushes nested within the CSGModel. To do this, you can right click CSGModel in Unity’s Hierarchy window, and then Create Empty. After doing this, you should drag the group of brushes into the new GameObject, to treat it as their parent. Or, if you didn’t create the brushes before creating the empty GameObject, then when you create a new brush you should nest it. Either way, when you duplicate a brush with a parent, the new duplicate brush will also be a child to that parent. Creating groups like this lets you quickly select similar brushes, and keep your Hierarchy window organized. It can also let you disable or enable groups, so that SabreCSG ignores them during rebuild. For example, it is good practice to keep a level’s basic geometry in one group, and keep a level’s more detailed geometry in a different group; this will let you save time during partial rebuilds, and also allow you to divide your work when applying materials.

2. Resizing a Brush

Once you have selected a brush in Resize mode, white and yellow handles will appear at the center of edges and faces of the brush’s bounding box. When you click any of these handles, a green line will appear between it and the one across the center from it. For example, by clicking the yellow resize handle on the top of a bounding box, a green line will appear between it and the yellow resize handle on the bottom of the bounding box. Dragging the clicked handle will lengthen or shorten the brush along the green line or axis. Yellow handles allow you to resize the brush in one axis, while white handles allow you to resize the brush in two axes.

 

3B resizingScaling a brush in Resize Mode

When resizing, the dimensions of the brush will be displayed showing the width, height, and length. When starting a level, it is often useful to quickly create several large brushes to form a base; the displayed dimensions let you quickly create a brush of the right shape and volume.

3Biii scalingScaling a brush

With more complex brushes, scaling can force the vertices out of alignment with the grid. Because of this, it is sometimes better to perform these edits in Vertex mode to begin with, but it is also possible to snap the vertices back into grid alignment in Vertex mode as described later.

3. Moving a Brush

There are several ways to move a brush in Resize mode, and the most useful will depend on the situation and the camera position. All of these modes will require you to first have a brush or brushes selected.

The most direct way to move a brush is to click and drag a face of the bounding box. This will move the brush according to the axes that the face is on. That is, the final position after moving the brush will be coplanar to the original position of the face. For example, clicking and dragging the top of a selected brush will let you move the brush along the X and Z axes.

3Bii moving 1Moving by dragging a face

 

When moving a brush by dragging its bounds, if you press Ctrl while dragging the selected brushes will be duplicated and you will be moving the duplicated brushes. This is a fast way of duplicating and moving existing brushes with a single mouse interaction.

Another way to move a brush is to click one of the resize handles, hold Ctrl, and then drag the mouse. Any time you click a resize handle, a green axis line appears between the selected handle and the one across the center from it. Moving the brush this way occurs along that green axis. For example, by clicking one of the yellow resize handles in the middle of the bounding box’s face and holding Ctrl, dragging the mouse will only move it along that green axis, effectively locking movement to one axis. Using one of the white resize handles centered on bounding box’s edges will allow you to move the brush along two axes in a way that is similar to clicking and dragging the bounding box’s faces.

3Bii moving 2Moving by clicking a handle, holding Ctrl, and dragging

4. Rotating a Brush

To rotate a selected brush, hold control and then click and drag one of the resize handles. The axis of rotation will depend on the handle you click. By default, rotation will snap in units of 15 degrees. You can change the degree of snapping or toggle angular snapping altogether in the SabreCSG toolbar at the bottom of the active scene view.

3B rotatingRotating a brush in Resize mode

Unless the rotation is in units of 90 degrees, the vertices of a rotated brush will no longer be aligned with the grid. This can make it difficult to align the brush with other brushes and create seamless levels. In vertex mode, there is an option to realign selected vertices to the grid. Sometimes it is useful to rotate a brush, use it as a rough guide for other brushes, and then delete the guide once you are done.

3Bv rotatingRotating a brush

5. Unity style widgets

In addition to moving and rotating brushes through the resize bounds, you can also use Unity style widgets to translate and rotate them. To activate these widgets select the Translate or Rotate button near the top of the scene view while in Resize mode. Both widgets behave very similarly to their counterparts in Unity, except that they are tied to the SabreCSG snapping values which can be configured (or disabled) on the bottom toolbar.

Unity widgetUnity style widgets in action


Vertex Mode

While Resize mode is about moving brushes within a scene, Vertex mode is about moving the parts of a brush. There is some overlap between Vertex mode and Resize mode, but Vertex mode offers more options, like creating sloped surfaces and other complex geometry.

Most interesting level geometry has more angles to it than are possible with Resize mode alone, which is why most of the work on a level past the earliest blocking phase will rely at least to some extent on Vertex mode.

3C vertex mode

1. Selecting and Deselecting (vertex, edge, marquee)

Selecting a brush in Vertex mode is similar to how selection works in Resize mode. You can select a brush behind another brush by clicking repeatedly and cycling through the brushes at that position. However, because Vertex mode let you select edges and vertices, if you try to cycle through multiple brushes, you may instead accidentally select part of a brush. Because of this, sometimes it is easier to move the camera and select a brush than to try cycling through a series of brushes to select the one you want. Sometimes it may also be faster to use Resize mode for selection, and then Vertex mode for editing. To deselect part of a brush without deselecting the brush, you can click one of the brush’s faces.

Once you have a brush selected, handles will appear at each vertex. Clicking a handle will select its vertex, and holding Shift while clicking will let you include more vertices in the selection. To remove a vertex from a selected group, you can hold Ctrl and click the handle.

Vertex mode also allows for marquee selection; click and drag, and the vertices within the marquee when you release will become a group selection. It is also possible to select vertices by clicking on the selected brush’s edges; this will select both vertices that produce the edge.

3C vertex marqueeMarquee selection in Vertex mode

If your scene camera is set to isometric mode and is axis aligned—effectively creating a 2D view of the environment—then one vertex may be directly behind another. For example, if the camera is looking down on a cuboid, then it will appear to be a square. To select both the near and far vertices, you must marquee. Clicking a vertex in this view will only select the nearest one, which in this example would be on the top of the brush.

2. Vertex Movement

After one or more vertices are selected, a movement handle will appear, allowing you to move the selection. To build angled or sloped structures, it is typically best to modify a brush’s vertices in groups of two. For example, to make a ramp from a cuboid, you can select one of the bottom edges and move it away from the base. Trying to create ramps or other complex volumes by moving one vertex at a time adds more room for human error, and can make the brush concave.

3C vertex editingVertex Editing

3C vertex mode rampCreating a ramp with Vertex mode

To move an entire brush in vertex mode, you can marquee all of its vertices, and then use the movement handle. Often, if you are already in Vertex mode, it is can be faster to move a brush this way than by switching to Resize mode and moving the brush there. The movement handle in Vertex mode is also an easy way to move a brush along one axis at a time.

3C vertex movementMoving a brush in Vertex mode

3. Concave Warnings

Sometimes in vertex mode you may encounter a concave warning. This happens in two situations, when an edge creates a concavity in the brush (by making a C shape for example) or when one or more of the vertices that comprise a face no longer shares the same plane as the other vertices of that face (even if the face appears to be convex). When SabreCSG detects that a brush is concave, the brush will turn red and warning text will appear below the tool selection bar. SabreCSG does not currently support concave brushes, so trying to rebuild a level that has concave warnings may cause errors.

If the geometry you are building needs to be concave, such as an arch, you should build it from multiple brushes. A quick way to turn a concave brush into two convex brushes is to split it using the Clip tool.

Additionally if you need to move a specific vertex off the plane of the polygon, you should use vertex connection to split the face, as shown in this animation:

quickExample

4. Snapping Vertices to Grid

Vertex mode also allows you to snap selected vertices to the global grid or the grid local to the brush. Both these tools are useful in certain situations and can be carried out by selecting vertices then clicking the Global Snap or Local Snap button respectively.

In typical vertex editing, you won’t need to use this button often, since vertices already snap to the grid. However, with more complicated brush work, or when adjusting the vertices of rotated brushes, this tool can help. For example, to build an approximate spiral staircase, you can use prisms as guides, where the vertices of the prism are snapped to a low grid setting, like 0.125.

If the grid setting is too high, snapping can move vertices to the same position. These vertices will be merged when you rebuild, so it’s important to make sure the positional snapping value is appropriate.

5. Creating Edges by Connecting Vertices

As shown in the concavity animation, you can create new edges between two vertices on the same polygon by selecting the two vertices and clicking the connect button. The vertices cannot be neighbours (that is there must be a vertex between them on the loop) as they already share an edge. This feature is particularly useful if you need to adjust specific vertices or split faces without the clip tool. Note that you can also create new edges by connecting the mid-points of two edges in the edge tool.

6. Welding vertices

Occasionally it’s useful to weld vertices together into single merged vertices. SabreCSG has a number of merge tools to achieve this, in the vertex tool there is a button for Weld Selection to Mid-Point which takes the selected vertices, calculates their averaged center then combines all the selected vertices into a single vertex at the averaged centre. One particular example of using this would be to convert a cube into a square-based-pyramid by selecting the top four vertices and clicking Weld Selection to Mid-Point.

weldtomidWelding vertices to their mid-point

In addition you can also do a tolerance weld, which takes a distance then welds any of the selected vertices which are within the specified distance to each other.

weldtoleranceWelding vertices with a tolerance

Finally you can merged vertices by moving them to overlap existing vertices and when you click rebuild the vertices will automatically be merged and extraneous polygons, edges and vertices will be stripped out.


Edge Mode

Edge mode is very similar to vertex mode, allowing you to select individual edges and move them. In addition you can create new edges by selecting two edges and clicking the split button. This will split the edges at their mid-points and create a new edge connecting the two new points.

splittingedgeSplitting two edges to create a new edge


Face Mode

The Face tool lets you apply and adjust materials on built geometry. Because you interact with the built geometry in this mode, brushes are hidden.

3D face mode1. Selecting and Deselecting

Instead of selecting brushes, in Face mode you primarily select each face independently from its brush. To select multiple faces, hold Shift and click. To remove a face from the selection, hold Ctrl and click.

The green face is selected

In addition to being able to select faces by clicking, you can also select all the faces of a brush or brushes by selecting the brushes from the hierarchy. SabreCSG will automatically select the faces from the brush.

There is also a selection tab on the Face UI which has a number of helpers:

All – Selects all built faces
None – Resets selection so no faces are selected
Invert – Inverts the selection
Excluded – Select all faces that are marked as exclude
Same Material – Selects all faces that share a material with any of the already selected faces

Adjacent:

Walls – Select all faces that share a vertical edge with any of the selected faces.
Floors – Select all faces that share a horizontal edge with any of the selected faces and have a normal that points up
Ceilings – Select all faces that share a horizontal edge with any of the selected faces and have a normal that points down
All – Select all faces that share any edge with any of the selected faces

Clicking one of the adjacency helpers repeatedly will expand the selection, see this animation:

adjacencyrepeatedExpanding the selection by repeated adjacency clicks

2. Applying Materials

Once you have at least one face selected, you can apply a material by dragging one from the Assets window to the “Mat” field below the SabreCSG tool selection bar. Alternatively, you can click the circle button next to the “Mat” field and pick a material from the window that appears. As mentioned above, these approaches require multiple precise mouse clicks, so if you are going to apply a material on many faces, it is fastest to apply materials to groups of selected faces.

Often, it is useful to have placeholder materials that distinguish walls from floors and ceilings. SabreCSG comes with a folder called Example Materials, which you can find in the Project window inside Assets/SabreCSG. When working on a large, unlit level, it can be easy to mistake one kind of surface for another; having placeholder materials helps prototype spaces and gives an indication of scale.

Materials and UVs also persist in other brush editing modes. If you apply a material to a brush’s built geometry, duplicate the brush, and then rebuild, then both brushes will have the same materials and UVs. The default brush has the same material on the sides, top, and bottom, so if you apply a different material to the sides with this first brush, and then use it to create the rest of your level geometry, it can save time with placeholder materials. This persistence is also useful with complicated detail geometry, such as the trim of an arch. By aligning the materials once, you can then duplicate the brushes without needing to align the materials again.

If lightmaps were enabled during the build process, then applying materials to the faces of built geometry can sometimes cause errors. Because of this, it is best to treat texturing and lighting as separate passes when building a level.

3. Translating UVs

Once you have selected a face, a white dot will appear. This reflects the mouse position when you click and drag the face. Like moving brushes, the UVs of a face snap to the grid. To increase or decrease the grid size, go to the SabreCSG settings. You can also use the keyboard shortcuts “,” and “.” to decrease and increase the grid size.

Translating UVs

4. Rotating UVs

To rotate a selected face’s UVs, hold Ctrl and then click and drag. This will snap based on the angular snapping, which you can change in the SabreCSG settings. If you want more precision when you rotate, there is also an option below the SabreCSG tool selection bar, left of the Rotate button. Here, you can specify the amount of rotation in degrees, positive or negative, and then perform it by clicking Rotate. This more precise method is useful for recurring angles. For example, the trim of a staircase should have a rise to run ratio of 1 to 2, which is 26.565 degrees. Trying to snap to this angle would be impossible, and trying to rotate with snapping disabled would be inaccurate, so it is best to use precise rotation.

Rotation in SabreCSG occurs around the center of the face, so if you need to perform a precise rotation and translation, it is best to rotate first.

Rotating face UVs

5. Scale UVs

Beneath the SabreCSG tool selection bar, there are also options for flipping, and scaling UVs. The Flip buttons will mirror the material across the X or Y axis, or both. To scale, there is a field next to the Scale button where you can enter a precise value, or you can quickly scale by using the “x 2” or “/ 2” buttons.

Generally, it is best practice for a material to be roughly the same scale throughout a level. Seeing a a material on a distant wall that is much larger than the same material nearby can harm the sense of depth in a scene and can disorient players. Because of this, it is usually best to uniformly scale the material itself in the Assets, instead of scaling face UVs independently. However, when working with angled geometry, you may need to stretch or shrink a face’s UVs slightly. The best way to do this is to enter a number near 1 in the field next to the Scale button. Numbers greater than 1 will make the material appear smaller, and numbers less than 1 will make the material appear larger. You can repeatedly apply the scale adjustment to a face. For small adjustments, use values near 1, like 1.05 and 0.95.

6. Auto UV

There is also a button called Auto UV. This recalculates the UVs of selected faces based on the world position of their vertices and is a great way of resetting UVs if they get distorted or you want to redo them.

Auto UV

7. Auto Fit

There is also an option to scale the UVs to fit the selected face. This is particularly useful if you need a texture to exactly span a face (such as a vent or something decorative like a painting.)

Auto Fit

8. Extrude Brush

Sometimes it’s also useful to be able to rapidly create a brush from an existing face. By selecting a face or faces and clicking the Extrude Brush button, SabreCSG will generate new brushes that are extruded 1 unit from the face.

Extrude Brush from Face


Clip Mode

With the Clip tool, you can remove chunks of a brush by clipping it against a plane, or alternatively split a brush into two along the defined plane. You do this by drawing a clip plane, where everything on one side of the plane is deleted or split from the original brush.

3E clip mode brush selected

1. Selecting a Brush

Selecting a brush with the Clip tool is the same as in Resize mode.

2. Drawing the Clip Plane

When you have a brush selected, a red handle will appear near your mouse cursor, but unlike your cursor the handle will be snapped to the grid. This red handle is the start point of the clip plane. By clicking and dragging, a green handle and a blue handle will appear. The green dot is the end point for the clip plane.

3E clippingDrawing a clip plane, flipping it, and then clipping the brush

In a 3D perspective, the part of the brush that is visible through the clip plane’s green side will be saved after clipping. The part of the brush that is visible through the clip plane’s red side will be deleted. From an isometric, axis aligned camera perspective, the clip plane will look like a red line next to a green line. As with a 3D view, the part of the brush that is on the green side of the line will remain, while the part on the red side will be destroyed.

3E clip mode clip planeThe clip plane and handles

You can adjust the clip plane by clicking the red, blue, or green handles, and moving them. By default, the blue handle will appear alongside the red handle, but once you have drawn the clip plane, you can move it or the red dot to make more complicated cuts with the plane.

3. Clipping, Splitting, and Flipping

Once you have drawn the clip plane, you can click the Clip, Split, or Flip Plane buttons beneath the SabreCSG tool selection bar. The Clip button performs the clip you have drawn, deleting one side of the brush. If clipping would remove the wrong side of the brush, you can click Flip to reverse which side the clip will remove.Additionally you can press R to flip the plane or press Return to apply the clip. You can also click Split, which will create a new brush from the clipped part, effectively splitting the brush in two. This allows you to manually modify or delete parts that were previously a whole brush, which can be especially useful for creating concave geometry.

3E clip mode splittingSplitting a brush from a 2D perspective

Some clips will decrease the number of faces and vertices that a brush has, while other clips will increase it. For example, clipping can let you quickly bevel a corner, create a hexagonal prism from a cuboid, or create a triangular prism for a ramp.

3E splittingSplitting a brush in two

Since clipping a brush usually requires adjusting the camera position and drawing the clip plane, it is often best to create some geometry that you can then quickly select and duplicate throughout the level. For example, if your level will have ramps, it is best to create one archetype ramp, place it off to the side in the world or in its own group in the hierarchy, and duplicate it throughout the level.

3E clip mode 2D clip planeDrawing the clip plane from a 2D perspective

It is also sometimes best to draw the clip plane from an isometric, axis aligned camera, where it is easier to see the grid and judge exactly where where the clip will occur. Switching between camera modes and perspectives can take time, however, so it may help to have a second Scene view open as a dedicated 2D view of your level.


Next page: Build Settings