Lighting optimization

From Valve Developer Community
Revision as of 09:33, 16 September 2008 by TomEdwards (talk | contribs)
Jump to navigation Jump to search

Static light

Lightmaps at work.

Static light is pre-compiled into lightmaps, which are to all intents and purposes textures. This makes it very cheap, and indeed makes individual light entities free.

There are two areas where optimisation can be performed:

  1. Deciding on a lightmap scale for a surface. It doesn't have a huge impact on performance, but can significantly affect file size, compile times, and visual quality.
  2. Naming lights. VRAD assumes that all named lights will be switched on or off at some point, and compiles an extra version of all lightmaps the light touches to provide for this. Not only does this bloat map size, VRAD compiles direct lighting only to reduce the number of lightmaps that need to be touched (i.e. no bounced light). Don't name static lights unless you really have to!

Dynamic light

Dynamic lights are expensive and must be carefully managed. Their number is important, but also what they are pointing at: the more complex the surfaces and numerous the models at which a dynamic light points, the more expensive it becomes. This makes them particularly unsuited to multiplayer maps where it is unclear where the action will be.

It's best, from a performance standpoint, to simply avoid dynamic light unless you notice a large parcel of your budget going unused. Players will be used to static light and won't expect anything better unless you set a precedent yourself.


<< Return to Optimization (level design)