View Full Version : Questions About Performance

08-15-2011, 05:07 PM
I had a few performance-related questions that I've been trying to answer myself with no luck.

1. If a texture is rendered but not necessarily seen by the player, does it negatively affect performance? I know having the entire outside of a level be textured with something other than NODRAW is a horrible idea, but something more like 7 units of an otherwise completely visible wall being obscured by a fizzler prop.

2. If unseen textures do negatively affect performance, would clipping the brush into smaller brushes to minimize the amount of unseen rendered textures (in the above example with the fizzler prop, clipping 8 units off the side of the brush, and then clipping that into a 7 unit brush textured with NODRAW and a 1 unit brush textured normally) be a good idea, or would leaving the textured wall as it is be better overall?

3. Similar to the above question, does the amount of brushes used to make a shape matter? If I currently have a circular door frame made out of 14 brushes, would there be any performance loss if I used 24 brushes to make a rounder frame? I'm only asking because I've heard that, when a map is compiled, all brushes sharing an edge are merged together, which makes me think (probably incorrectly) that it doesn't really matter how many brushes you use to make a shape.

4. I haven't tried this, and it's probably a stupid question, but would texturing every face that can't been seen (aside from those absolutely necessary to prevent leaks) with the SKIP texture be a bad thing?

5. For detailing walls with different sized tiles (such as in Portal 2), would making the entire wall func_detail and placing a single brush textured with NODRAW inside it be a good idea, or would it be better to leave the clipped wall as it is? I'm just curious if making the entire wall func_detail with a NODRAW wall inside would reduce visleafs and increase performance in any way.

Any help would be appreciated :D

08-15-2011, 07:16 PM
1. Everything that gets rendered affects performance. The general rule is if the player can't see it, nodraw it.

2. If I understand correctly, the player can see a section of the wall but you're wondering about the extremities that stick out beyond an adjoining wall that the player can't see. Personally I prefer fewer brushes whenever possible and think if this is a one time thing, I wouldn't worry about it.

3. The more faces the engine has to render the harder the engine has to work. You have to decide, does you door really need that many brushes? Can you replace it with a prop_static? For the best performance you should always aim for the lowest number of polys that give as close to the best look that you want.

4. Use nodraw textures. SKIP is used with things like HINT which only need one face with the HINT texture, the other faces get SKIP. If it's a like a block and you can't see the bottom, use nodraw for the bottom.

5. I think your mixed up a little here. Brushes with nodraw on it don't automatically make it a world brush. For optimizing and explanations check out this site (it's great, bookmark it!):

08-15-2011, 07:32 PM
Thanks for the answers (and the link) :)

I'd give you actual rep if I could.
+rep in spirit

08-15-2011, 09:15 PM
{hint} to give rep click the scales icon under the person name :)

08-15-2011, 09:26 PM
{hint} to give rep click the scales icon under the person name :)

Don't forget to put a {SKIP} on the other faces....wait...

08-15-2011, 09:38 PM
skip textures should only be used in the design stage of the map if used in the final compile it get give errors http://developer.valvesoftware.com/wiki/Skip

08-15-2011, 09:57 PM
{hint} to give rep click the scales icon under the person name :)
That's what I thought when I noticed it under my own name, but it's not showing up under anybody else's name. I did a quick search and found that I need to have posted either 10 or 50 times before I can give rep.

08-16-2011, 03:44 AM
Any help would be appreciated :D

First of all, read this page (http://developer.valvesoftware.com/wiki/Brush).

Second of all, stop worrying about this kind of thing. Unless you are doing something totally crazy brush complexity does not have any measurable effect on performance with modern computers. The only considerations you need to make are compile times and whether you have good visibility control (http://developer.valvesoftware.com/wiki/Visibility_optimization).

All faces in a map need to be loaded into memory, but the engine does a pretty good job of culling those that can't be seen per-frame. Your particular example isn't something to worry about however, as faces on the outside of a map are removed entirely during compile.
The compile tools will automatically chop brushes assigned to the same entity (the world is an entity too) so that hidden faces are removed. You only need to worry about doing that manually if you have two brush entities touching/intersecting.
Brushes only exist in Hammer; after a map is compiled only their exterior faces are left. So it does make a (minute) difference if you split a flat surface up, but not if you use six brushes to make a cube instead of one.
Probably. It would also be spending ages doing boring work that the compile tools have been built to automate. :)
Edit: reading your post again, it seems that you are talking about a flat surface. There is no point in making that func_detail. If the tiles are poking out or some are missing however, go for it. Yes! That is exactly what you should be doing. Any brushwork that doesn't meaningfully block the player's view should be detail. This won't make much difference in-game, but will greatly reduce compile times. In this case you do need to apply nodraw, as the world and func_detail are different entities so the two hidden faces won't be chopped.

08-16-2011, 08:22 AM
3) Brushsides sharing a texinfo (same texture, same orientation+scale, same lightmap etc) AND sharing an edge (touching each other) are either (cant remember which) merged or rendered simultaneously (stripped). Merging brushes to reduce these instances isn't worth the effort.

4) I know mappers who texture the entire map in nodraw, then only texture the brushes they KNOW the player can see. This method makes sure no brushface is drawn which shouldn't. However, it also increases the risk of forgetting a brushface or two causing a 'hall of mirrors'-effect to appear.

08-16-2011, 08:50 AM
3)4) I know mappers who texture the entire map in nodraw, then only texture the brushes they KNOW the player can see. This method makes sure no brushface is drawn which shouldn't. However, it also increases the risk of forgetting a brushface or two causing a 'hall of mirrors'-effect to appear.

I use developer texures on everything, and then at the end, I do a find/replace on those textures and replace them with nodraw.

Also, in regards to the OP's fourth question, if you use a skip texture on a brush with non-tool textures, the skip texture loses its tool texture properties. Normally, skip is invisible and intangible. But on a world brush, it shows up in game and is solid. You're better off using nodraw for any brush face the player won't see.

08-16-2011, 09:57 AM
Any face that does not touch a visleaf, i.e. is visible from inside the map, is not rendered. For example, if I make a wall, and cover half of it with another world brush, the part of the wall that's covered will be removed in the final map.

Similarly, any face that faces the void is removed, so you don't need to worry about that.

The engine does a really good job of optimizing brushes and faces, so you don't have to worry too much about conserving brushes and putting nodraw on everything. I generally texture everything I build and then apply nodraw when I know the face won't be seen, because I would rather not accidentally have any visible nodraw in the map. The cost of rendering a single face is minimal. Nodrawing larger faces will gain you more texture memory from lightmaps, in the case of roofs, etc. that the player can't get to.

3. You do have a maximum brush limit for the whole map, but you'll be unlikely to reach it in a P2 map. You should think more about how many faces will be on screen at one time. Any loss in performance you have from making rounder doors can be offset by cleverly placing walls and hint brushes to hide other areas of your map.

Use the command mat_wireframe 1 to see what is actually being rendered in your game. Compare that to what your brushes look like in Hammer. They'll often be quite different.

Poly count is often not what causes bad performance. Use the command +showbudget (http://developer.valvesoftware.com/wiki/Showbudget) to see what is actually taking up the most rendering time.

4. Skip should only be used on a brush by itself, or with the hint texture. It should never share a brush with other textures.

5. If the wall is flat, I would not bother making it func_detail. I don't think that different-sized tiles would cause more visleafs, but it might. In any case, your average P2 chamber probably compiles quickly enough anyway.