The Carve Tool and You

There’s something I’ve always wanted to discuss in regards to mapping with Valve Hammer Editor, and that is the use of the carve tool. As far as I’m aware, the carve tool was never intended to be used with anything other than a rectangular brush, because when given a more complicated primitive to work with (such as a cylinder) the results become quite messy.

This has resulted in many veteran mappers adopting a viewpoint that is essentially “NEVER USE THE CARVE TOOL”, which is then passed on to new and aspiring source mappers who read those kinds of comments in tutorials and forum posts. Despite this, the carve tool remains a useful technique for quickly creating rectangular holes in a brush and shouldn’t be discarded from your mapping arsenal.

A question I’ve heard from new mappers over the years is, “if the carve tool shouldn’t be used for anything other than rectangular brushes, how do you properly create circular holes in a brush?”

The reason why the carve tool doesn’t work well with cylindrical brushes and so forth is primarily due to the simplicity of the algorithm behind it. When carving, Hammer executes multiple clips on the target brush parallel to each edge of the carve brush.

 

As you can see, this produces some nasty results, which can cause problems for the compiler as well as just being plain messy. What we’re going to do is follow a more complicated algorithm which, in my opinion, the carve tool should have used in the first place.

Since we’re going to be doing clips ourselves, we are of course, going to use the clipping tool. If you’ve never used the clipping tool before, now is your chance to learn.

The Clipping ToolThe clipping tool is located in the toolbox between the overlay tool and the vertex tool. The way it works is simple. With the clipping tool activated, you can drag a line across a selected brush (or multiple brushes) in any of the three 2D viewports. It is along this line the selected brush will be divided. The clipping tool has three modes; the first two keep one of the divisions while removing the other and the third mode keeps both divisions. You can tell which division will be removed by looking at the outlines of the brush in the current viewport.The part outlined in red will be removed while the part outlined in white will stay. If you only see white outlines then you are using mode three, which keeps both divisions.  To cycle through clipping modes, you can click the clipping tool icon again or hit Shift+X. Make sure you’re using mode 3 before continuing.

Clipping Tool Modes

The method we’re going to use is a five-step clipping process. Steps 1 and 2 involve dividing the target brush in such a way that our working area becomes as small as possible. Although we’re not actually using the carve tool, we’ll keep our carve brush (the cylinder) around for reference. To begin, select the target brush and activate the clipping tool (make sure you’re using mode 3 so we keep both divisions). In the 2D viewport that shows the end faces of the carve brush, drag a vertical line with the clipping tool straight through the vertex on the far left, like so:

Clipping

Hit enter to execute the clip. Do the same for the vertex on the far right. Now your target brush is split into three divisions; the middle brush should be the same width as the carve brush. Proceeding to step two, select the middle brush – make sure the two side brushes are not selected – and execute horizontal clip through the top vertex. Do the same for the bottom vertex. You may notice that the result is very similar to what the carve tool would have done if we’d used a rectangular carve brush; the difference is that the centre brush would have been removed, which is why we clipped it manually.

Step 3 is to split the centre brush into sections. With the centre brush selected, execute vertical clips through each or the remaining vertices. You may need to decrease the size of the grid to complete the clips accurately; you can change the grid size by pressing the square bracket keys on the keyboard or using the buttons on the toolbar. Once you’ve clipped the centre brush into vertical slices it’s time for step 4. Clip each slice along the edge of reference brush. Make sure you only have one slice selected at any one time or you may end up clipping where you’re not supposed to.

Step 5 is to remove the inner brushes. This is pretty self explanatory. Last but not least is to tie all the inside brushes to a func_detail entity for the sake of optimization; while this isn’t strictly required, I strongly recommend it.

This entry was posted in Tutorials and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>