Brush Count vs Brush Size

From Reflex Wiki
Jump to: navigation, search
Brush Count vs Brush Size
by Devil
Brushes taking up more than 8000 units in any direction will cause lightmap compiles via r_lm_build to fail. So the question is how best to reduce the size of such brushes, while keeping an eye on the resulting higher brush count.

On cutting up large brushes

It is much better to replace a 8000u+ brush with two 4000u brushes. However you do not want to replace a 8000u+ brush with four 2000u brushes for example. For every brush you create you add to the file size of the map. The trick is to create the least amount necessary for your map. The less brushes you have the better your map will perform.

Implications of high brush counts

For every brush you create you require the graphics engine to draw 6 sides of a brush. More brushes means more drawcalls. There is a sweet spot between amount of drawcalls (brushes), size of brushes (for lightmap), and file size for optimal map performance. This is known as optimal brush use. If your map is fairly small like a 1v1 map where the brush sizes do not exceed more than 8000u per wall then you do not have as much to worry about except the amount of brushes.

Detailed brushwork as of now discouraged

If you get into very small detail work with a ton of brushes then you might start seeing performance issues simply due to the amount of brushes used (drawcalls). This is something for detail oriented mappers to consider leaving out for now and revisiting in the future when engine optimizations are made. This is why most maps currently look geometrically basic right now. You would hate to make an extremely detailed map only to find that your map performance gets worse the more detailed you make it. Definitely something to keep in mind for not going overboard with detailing right now.

Too large brushes lead to lightmap compile failures

Spending 10-20 minutes per r_lm_build and then having your lightmap can be frustrating! So do yourself a favour and start making a good habit of never going over 7800u.

An example

Originally my wall for this room was over 9000u. I have already resized it to below the 8000u limit so I cannot take screenshots of that. Just for the sake of argument let us say the huge red wall in the background is over 8000u and will cause a lightmap build failure, so we will want to downsize it, as an example.

Keeping brush counts down, to reduce download times from server

What you want to avoid is creating more brushes than necessary. Adding 5 brushes to do the job of 2 will cause a larger file size which means more time for a new player to download and connect to your map. If your map is large enough; this resizing method could cost you severely in the range of hundreds of unnecessary KB!

Optimizing the brush count

The optimal way to approach this problem is to cut it in half. In the above image represented by green for good brushes, there are only 2 green brushes. This is well within the capability of the lightmap engine to build a successful lightmap. It does not matter how large the 2 brushes are as long as there are only 2 and they are both well under 7800u each. You do not want 3, 4, or 5 brushes to do the job where only 2 are needed. This is called brush optimization. We want to downsize that large wall by using the least amount of brushes necessary which in this case is 2. I should add that in some engines you can optimize even more by making those 2 brushes identical in size. The lightmap will borrow and replicate unlit faces within the lightmap and save some cycles. I do not know if the graphics engine for Reflex works in this way but I have actually been doing that on my own maps just in case it does.