The commands that are explained here are great for testing trouble spots on your map. Probably the second most important, and most overlooked, performance test you can make. It works like the r_speeds test in that once you execute the commands and you will get constant and immediate feedback in the numbers across the top of your screen. These commands will test how much overdraw is occurring in any given part of your map. Only video cards that have a stencil buffer can use these commands.
Keep in mind that overdraw will almost always be present so don't worry about getting rid of it altogether. What you are looking for is areas where it is unacceptably high. Places where that occurs will overwork the video card by making it draw multiple polygons over others. Because many polygons (and the pixels that make up those polygons) are being overdrawn, fillrate becomes the important limiting factor. The more overlapping polygons, the more fillrate is needed. So high overdraw areas can have a major impact on frames per second, especially with older video cards.
How to test:
- Type in /r_stencilbits 8 in the console.
- Do a /vid_restart to make the command effective.
- Type in /r_measureoverdraw 1.
- Hit your /r_speeds toggle key and look at the overdraw number as shown in the last screenshot below.
If it doesn't work, try increasing your depthbits to 24 by typing in
/r_depthbits 24. This procedure can be very taxing on your system, so you won't be able to move around much.
Stuff that causes overly-high overdraw includes: shaders (especially including overlapping transparent shaders), poorly -vis'd areas, layering of brushes on top of each other, and decals. Here is a demonstration screenshot from Tequila. Notice the amount of transparency the player is viewing. This explains why people have performance problems in the outdoor area by the fountain.
Look at the mtex number on the far right. The first screenshot shows how it looks with just r_speeds, the second shows r_speeds with the stencilbits and measureoverdraw commands.
Here you can see that the overdraw in this area is over 4 times. This means the screen is being overdrawn 4 times. That is very high and will cause a pretty solid performance hit in that area if you are using an older or a low fillrate video card. You should aim for an average overdraw of 3 times in your maps. In areas like this, you will have to make an executive decision whether the parts of the map causing the overdraw are worth the performance hit. Now you know how to measure it yourself and you don't have to rely on guesswork.