Deferred Lighting Pipeline


The graphic pipeline is implemented using a deferred lighting (or Light Pre Pass) renderer. A deferred renderer decouples the geometry processing and the illumination calculations. As an alternative of deferred shading, deferred Lighting reduces the size of the G-Buffer (good for the Xbox EDRAM) and, because the G-Buffer is accessed several times in the illumination pass, it also improves bandwidth performance since less information is fetched, unfortunately a second geometry pass has to be performed. Other alternatives like tiled renderers goes one step forward (Battlefield 3, Just Cause 2) but they have other disadvantaged as well.

G-Buffer

The first pass, the G-Buffer, process all the opaque geometry producing the following information:
  • Depth: stored in linear space using a FP32 format. It is stored in view space.
  • Normals: stored using best fit normals (Crytek method). They are stored in view space, however, to avoid precision problems with the presence of big (relative to screen space) polygons is better to store this information in world space, however, having the normals in view space reduce matrices multiplications in the light pre pass shaders.
  • Specular Power: stored in logarithmic space using 8 bits. This information gives more flexibility to the light pass.
It is possible to store albedo information in a G-Buffer of 1024x600 and still fit in the EDRAM without having to perform a predicated tilling. However, screen space directional occlusion and light propagation volumes could not be implemented yet (especially with a temporal coherence scheme) and therefore albedo information was not stored in the G-Buffer.
An ambient light mask, as implemented in Toy Story 3 or Crysis 2 was also evaluated but it was not implemented for time constrains.

Screenshot-0047.jpg

Light Pre Pass

The second pass, the light pass, calculates a partial BRDF over the surfaces using the light contribution and the G-Buffer information processed in the previous pass. The BRDF implemented is Blinn-Phong. Oren Nayar, Cook Torrance and Ward are other good options, but no one is quicker than Blinn Phong. It’s up to you the selection of the BRDF to implement in your game, but be aware of the parameters needed in the G-Buffer.
  • Ambient light: the ambient light could be a simple constant color or could be retrieved from a spherical harmonic representation of the environment. Additionally, a screen space ambient occlusion could be calculated and applied to the ambient light.
  • Directional Lights: they are rendered using a full screen plane. Cascaded or simple shadows could be added.
  • Point lights: they are rendered using clip volumes and use stencil optimizations. They also include an attenuation function and cubic shadow mapping.
  • Spot lights: they are rendered using clip volumes and use stencil optimizations. They also include an attenuation function in both depth and spread angle, support basic shadows and it is possible to apply a light mask.

There is no temporal coherence scheme implemented on shadows, however it is possible to distribute the generation of the light depth textures over several frames.

Screenshot-0048.jpg
Screenshot-0049.jpg

Material Pass

The third pass process the opaque and transparent objects producing a high dynamic representation of the scene. The objects rendered are:
  • Opaque geometry: they are rendered using the light information processed in the previous pass. There are several partial BRDFs available to calculate the local illumination of these surfaces, including also reflections, bump mapping, parallax mapping, etc.
  • Sky: they engine provides a Skybox (both in RGBM and sRGB format) and Skydome with a simple day and night cycle.
  • Particles: soft and hard particles.
  • Transparent objects. They are processed using a standard forward rendering technique, therefore an automatic light association is perform. The transparent objects support an ambient light, a directional light, two point lights and a spot lights, all without shadows.
  • 3D textures and text.

Screenshot-0050.jpg

Post Process Pass

Finally, the post process is executed.
  • Exposure and luminance adaptation: simulates the eye adaptation.
  • Tone mapping: compress the high dynamic luminance information of the previous pass to a low dynamic range suitable for use in a custom screen.
  • Bloom: produces fringes (or feathers) of light around very bright objects in an image, obscuring fine details.
  • Film Grain: simulates the random optical texture of processed photographic film due to the presence of small particles of a metallic silver, or dye clouds, developed from silver halide that have received enough photons.
  • Color grading: the process of altering and enhancing the color. This could be performing with parameters or lookup tables.
  • Heads Up Display: finally the 2D elements are rendered.

Screenshot-0051.jpg


Last edited Jan 22, 2013 at 7:49 PM by jischneider, version 15

Comments

No comments yet.