Since the last update there have been two significant improvements made to the deferred render manager. The first of these improvements is proper support for alpha blended (semi-transparent) objects. To accomplish this the render manager splits all registered render priorities into two types: deferred and forward. Any object with a deferred render priority will be drawing using deferred shading, while objects with a forward render priority will be drawn using forward shading. What the deferred render manager considers a forward or a deferred render priority is user configurable.

The second improvement to the deferred render manager is proper support for heavy portals. A heavy portal is any portal that requires the scene behind that portal to be rendered to an off-screen buffer. Two methods were considered for adding support for heavy portals. The first method was to reuse the GBuffer for each heavy portal and output the results to a unique off-screen buffer. The second method was to create a unique GBuffer for each heavy portal. The drawback of the first approach is that, due to hardware constraints, the off-screen buffers must match the resolution of the screen. In most circumstance this is a waste of memory since portals rarely fill the entire screen. However, this potential waste of memory is dwarfed by the memory overhead of having a unique GBuffer for each portal. As a result, I decided to use the first approach.

rm_unshadowed

rm_deferred

The above pictures show a scene with proper rendering of alpha blended objects. Namely the blue crystal and the fire particles are properly being blended with the rest of the scene. Note that they do not appear in the GBuffer since they are rendered after deferred shading is done. This scene also contains a heavy portal behind the blue crystal. Through this portal you can see a blue pillar and some alpha blended flames.

The latest update to the deferred shading implementation is support for point lights, spotlights, and directional lights. Along with these standard light sources we have a fourth light source, unique to deferred shading, used for ambient lighting.

Traditionally ambient lighting is added to the result of the lighting equation when the geometry is initially rendered. However, with deferred shading we separate the geometry from the lighting and only output pixels that are directly affected by a light source. As a result, we have to be sure to account for ambient lighting on geometry that is not directly affected by a standard light source (this is particularly important if we want proper support for light mapping). To accomplish this we have a special lighting pass, implemented using the same methods as the other light sources, that outputs the ambient lighting term at each pixel.

rm_unshadowed

rm_deferred

In the above scene we have a point light, spotlight, and directional light emitting red, green, and blue light respectively. The next stage in development is to add support for semi-transparent objects. From a high-level, this will be done by rendering the semi-transparent objects using traditional forward rendering after all deferred shading is completed.

Over the last two weeks I have been focusing on improving the lighting implementation for the deferred shading render manager. That includes adding support for normal mapping, parallax mapping, and full Blinn-Phong shading. Below is a side-by-side comparison of the unshadowed and the deferred render managers.

rm_unshadowed

rm_deferred

I have also included a close up view that better highlights the use of parallax and normal mapping. The parallax effect is particularly noticeable along the edges of the bricks where they appear to ‘pop’ out of the wall. The application of normal mapping can be seen in the subtle changes to lighting across the surface. For instance, the spaces between bricks appear noticeably darker then the flat surface of the bricks.

Close up view of parallax mapping.

One point of interest in the screenshots from the deferred render manager is the row of four images along the bottom of the screenshot. These images are visual representations of the GBuffer used by the deferred shading method. From left to right we have the diffuse color, view-space normals, specular color, and post-projection depth information. This is all of the information needed to compute lighting information for an arbitrary number of light sources.

As of this writing, the deferred render manager only supports point light sources. However, full support for spot lights and directional lights is fast approaching. Once that happens I will begin work on adding support for ambient lighting (implemented as a special type of light source), semi-transparent objects, and portals.