Bad Apple  Bad AppleBad Apple
 Maps Drivel
----------

Completed maps

The Junkyard

Tutorials

 

 

 

 

 

Radiant

q3map2

simland

rorschach's journal

subversion

Bad Apple

The dangers of using CSG subtract part 2

Non-axial cuts

So far we've looked at what happens when you use CSG Subtract to create axial cuts in brushes. An axial cut is one that is parallel to two axes - essentially a cut that is aligned to the grid. Things get much worse when we start subtracting irregular brushes that have with one or more faces not aligned with the grid.

Above you can see I've subtracted a pentagon shaped brush from a rectangular floor brush. The results aren't pretty. Hopefully I don't need to elaborate on how messy the triangles created on the floor will be, and the mess that's going to be made on the walls touching that floor as well.

Here I've taken things one stage further and subtracted another pentagonal brush from the same floor. You can see that the problems with the cuts have been compounded, as new cuts have been added on top of the old. This is best demonstrated by the two brushes at the right of the floor, which still have the split created by the first pentagon. Also, look at the tiny brush that has been created at the left of the second pentagon. Performing multiple subtracts on the same object can create lots of tiny brushes like this very quickly. They rapidly become a pain to deal with and create lots of unnecessary triangles when compiled. Looking at the example above you can also imagine how it is quite possible to create brushes that are so small that they are practically impossible to even see in editor, which are sometimes referred to as microbrushes. Microbrushes can become degenerate and cause mysterious leaks, invisible collidable volumes in game, massive brushes visible in game but invisible in the editor, or unexpected effects in a compiled BSP.

The third dimension

So far I've kept things fairly simple by looking at things mainly in plan view and confined my examination of the undesirable effects that can happen to a single 2D view. Doubtless I have also upset many mathematically minded types by describing pentagonal prisms as pentagons, etc.! However, Q3 engine map construction is of course three dimensional, and we need to look at how much worse you can make things by subtracting goofy 3D shapes from brushes.


Here I've built an eight-sided cone, flipped it upside down, and used three-point clipping to chop the end off with two different non-axial planes, to create a shape that might look a little like a crater or something when used to cut into a floor.


This is what happens when I go ahead and subtract it from a floor brush. The pictures speak for themselves, really. It has become completely impossible to even tell where some of the brushes begin and end without trying to select them.

This particular abuse of the tool could easily be compounded by leaving the created brushes as structural. With geometry like that shown in the example above this would be very likely to cause PVS errors in game, such as disappearing triangles and HOM (Hall of Mirrors) effects similar to those caused by map leaks. Even if it did not, it would still increase the build time for the map, and increase the size of the vis data. Brush structures that have a lot of non-axial faces need to be contructed carefully and using detail brushes. With this crater example, the best thing to do is of course to delete the whole thing and build it properly.

The next stage of badness on from this would of course be to take a complex shape and subtract another one from it. I'm not going to do that though, because by now I'm sure you can imagine how horrific the results would be, and the very thought of it gives me the shivers.


Accidents

Another reason for not using CSG subtract willy-nilly is that it has considerable potential for causing accidental damage to neighbouring areas of your map, or creating extra brushes that will never be seen in game without you even realising it.


Conclusion to part one

The examples here are just a few of the nasty things that you can do with this tool. I am not saying that you should never use it - but it is certainly the case that you should treat this tool with suspicion and never let yourself think of it as an easy way out. The majority of things people tend to do with it can easily be achieved using safer techniques such as clipping.

Big thanks to sock for proofreading one of the early drafts of this article.



Copyright 2001-2011 Tom Waters - goriki@hotmail.com

Bad Apple is not intended for readers under 18 years of age, goats, emus, flukes, capybara, users of CSG subtract, or people who like the name Gary.