0
\$\begingroup\$

In the Source engine, when the map does not have a sky box, I see that typical artifact from the back buffer not being cleared. Why does the Source engine do that? Is it a performance reason, or something like that?

\$\endgroup\$
1
  • \$\begingroup\$ Extra steps are extra steps. If you can make assumptions to reduce those extra steps, then you will see improvements in performance. In this situation, it sounds like adjustments were made under the assumption that all outdoor environments would always have a skybox, and not need a screen clear. Indoor environments are simply. . . in doors :) \$\endgroup\$
    – Evan
    Sep 9, 2013 at 20:12

1 Answer 1

4
\$\begingroup\$

The source engine doesn't clear the back buffer simply due to the way levels are setup (i.e. it's not needed).

Source engine levels are built from brushes (i.e. volumes are either added as solid/liquid or subtracted from other brushes) and the player (or more specific, the camera) is always in an enclosed space, even if the level is supposed to be outdoors. Areas where you see the skybox are actually the surfaces of brushes marked as "sky". I've had a random look at YouTube and the first hit I've found explains level building pretty well. Watch it from about 1:45 to 2:15 to see the "sky" being set, then at the end of the video you'll see it in action.

So why not clear the back buffer? Performance. Clearing the backbuffer would solve glitches you can see when the camera gets "outside" due to a bug, but in standard gameplay you wouldn't notice this anyway. So if it doesn't make any difference, you can just skip it alltogether. Clearing the back buffer has a complexity of O(n) depending on the number of pixels on screen, doing nothing at all would simply be O(0) (well, that isn't defined, but I think it pretty much shows the idea).

\$\endgroup\$
1
  • \$\begingroup\$ Good answer. And as an add-on to this; while the base engine seems to have this issue in-game, I'm pretty sure they change this when you're working in Hammer Editor, or Source Filmmaker; as you're expected to do a lot of noclip-flying-about in those. \$\endgroup\$
    – Katana314
    Sep 9, 2013 at 23:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .