Reducing map brush sides via brush shape manipulation

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
Hi, folks.

I recently found some useful information about brushes and the way Hammer treats them when it compiles. Have you ever received the MAX_MAP_BRUSHSIDES error because you have too many brushes?

Taken from the page on MAX_MAP_BRUSHSIDES on the Source wiki:
The term "brush sides" is a bit misleading, if you've paid attention to your brush sides in hammer before, you may have noticed the compiled result was higher.

This is because when compiling, it includes the bounding box of a brush, which can be up to an additional 6 brushsides per brush. If a face is lined up with the edge of the bounding box(meaning not angled in any way) it will not add an additional brushside.

Example: A 5 sided pyramid shaped brush with the bottom face lining up the bottom of the bounding box. While the brush itself is only 5 sides, it will count as 10. The 5 extra brushsides come from the bounding box.

As rule of thumb for figuring this out easier. 6 + angled faces = brushsides per brush

Imagine a brush is like a prop in that it has an invisible bounding box. I don't know if this is actually the case or if it's a learning aid. It's probably something to do with the way the engine works.

Basically, if a brush face isn't parallel with any grid line, i.e. it's diagonal, it can cause the brush to take on one extra 'brush side' in the form of a bounding box side. If a face is parallel, then that side of the bounding box will be merged in to the face.

Here are some examples. The blue shape is the brush, and the green shape is a representation of the brush's bounding box. Bear in mind the numbers below the image also reflect the 3D faces that this 2D image doesn't show, those being the brush faces on the back and front.

Bo8ZU2r.png


Where a brush side isn't taken up by a parallel face of any length, the bounding box side will count towards the total.
  1. 6x brush faces, 0x bounding box sides = 6 total brush sides.
  2. 5x brush faces, 2x bounding box sides (right and top) = 7 total brush sides.
  3. 6x brush faces, 4x bounding box sides (all four sides) = 10 total brush sides.
  4. 6x brush faces, 1x bounding box sides (top) = 7 total brush sides.
  5. 7x brush faces, 0x bounding box sides = 7 total brush sides.
The right face of number 4 is parallel with the grid, but it doesn't completely cover the bounding box side. Still, these two are merged. Only the top bounding box side is counted as there is no parallel section of face to merge with. The same goes with shape 5. The top and right face aren't the whole length of the brush but they are parallel so they get merged.

In the following image I didn't work out the total brush sides manually. I compiled an empty, cordoned map with a single point entity and the compile log showed 36 brush sides. I then compiled the map with each of these constructions in turn and subtracted 36 from the reported number of brush sides in each compile log. The numbers below the image should be the accurate number of brush sides for each construction.

aBlq2GI.png

  1. 146 total brush sides.
  2. 143 total brush sides.
  3. 112 total brush sides.
Making the segments of the third arch construction as square as possible merged their parallel faces with their bounding box sides, significantly reducing the number of total brush sides the construction generated.

This doesn't stop with complex brushwork. If you have been using the vertex editing tool to 'mitre' the corners of brushes so they meet up nicely, that will generate one extra brush side per non-parallel, diagonal face. It sounds minor, but it could rack up. Consider the pros and cons.

FVUzwMO.png

  1. 14 brush sides.
  2. 12 brush sides.
Apologies if I have missed anything out or stated something so obvious that it warrants abuse. If I've made some mistakes, or you have a better idea, or some great examples of ways to cut down brush sides, please post them in response.

Thanks,

Matty
 
Last edited:

puxorb

L69: Emoticon
aa
Dec 15, 2013
531
798
For the arches, valve always seems to use method 1. I guess it makes sense since you only have to texture 4 faces if you texture the outside of the arch.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Holy crap. When we get around to making a proper tutorials section on the mainsite, we need to devote at least one article to just listing out little-known tricks like this.