Game Engine Architecture

(Ben Green) #1
481

ferent numbers of lights, diff erent types of lights, diff erent numbers of skin-
ning weights, etc.
Deferred rendering is an alternative way to shade a scene that addresses
many of these problems. In deferred rendering, the majority of the lighting
calculations are done in screen space, not view space. We effi ciently render
the scene without worrying about lighting. During this phase, we store all
the information we’re going to need to light the pixels in a “deep” frame buf-
fer known as the G-buff er. Once the scene has been fully rendered, we use
the information in the G-buff er to perform our lighting and shading calcula-
tions. This is usually much more effi cient than view-space lighting, avoids the
proliferation of shader variants, and permits some very pleasing eff ects to be
rendered relatively easily.
The G-buff er may be physically implemented as a collection of buff ers,
but conceptually it is a single frame buff er containing a rich set of informa-
tion about the lighting and surface properties of the objects in the scene at
every pixel on the screen. A typical G-buff er might contain the following per-
pixel att ributes: depth, surface normal in clip space, diff use color, specular
power, even precomputed radiance transfer (PRT) coeffi cients. The following
sequence of screen shots from Guerrilla Games’ Killzone 2 shows some of the
typical components of the G-buff er.
An in-depth discussion of deferred rendering is beyond our scope, but
the folks at Guerrilla Games have prepared an excellent presentation on the
topic, which is available at htt p://www.guerrilla-games.com/publications/
dr_kz2_rsx_dev07.pdf.


10.4 Visual Effects and Overlays


The rendering pipeline we’ve discussed to this point is responsible primarily
for rendering three-dimensional solid objects. A number of specialized render-
ing systems are typically layered on top of this pipeline, responsible for ren-
dering visual elements like particle eff ects, decals (small geometry overlays
that represent bullet holes, cracks, scratches, and other surface details), hair
and fur, rain or falling snow, water , and other specialized visual eff ects. Full-
screen post eff ects may be applied, including vignett e (slight blur around the
edges of the screen), motion blur, depth of fi eld blurring, artifi cial/enhanced
colorization, and the list goes on. Finally, the game’s menu system and heads-
up display (HUD) are typically realized by rendering text and other two- or
three-dimensional graphics in screen space overlaid on top of the three-
dimensional scene.


10.4. Visual Effects and Overlays

Free download pdf