How exactly does a "light accumulation buffer" participate in a deferred renderer?

Started by
2 comments, last by AgentC 13 years, 4 months ago
Hi, I have implemented a deferred renderer, and I am wondering what exactly is a "light accumulation buffer" and how does it fit inside a deferred renderer?

Currently my deferred renderer is doing:
1. Rendering all information onto the g-buffers.
2. For every light, use the g-buffer information and write the final color to backbuffer (additively blending the pixels for each light pass)
3. Display the backbuffer.

Where and how should the "light accumulation buffer" comes into play in the deferred rendering algorithm??

regards.
Advertisement
Just take look at this formula:

Diffuse = kd * Albedo * dot(N,L1) + kd * Albedo * dot(N,L2) + kd * Albedo * dot(N,L3) + ...
Specular = ks * Albedo * pow(dot(N,H1), ns) + ks * Albedo * pow(dot(N,H2), ns) + ...

You might be able to notice that you could easily factor out some factors like kd, ks and Albedo. It's the same with the light accumulation buffer:

Diffuse = kd * Albedo * (dot(N,L1) + dot(N,L2) + dot(N,L3) + ...)
Specular = ks * Albedo * (pow(dot(N,H1), ns) + pow(dot(N,H2), ns) + ...)

LightAccumulation.Diffuse = dot(N,L1) + dot(N,L2) + dot(N,L3) + ...
LightAccumulation.Specular = pow(dot(N,H1), ns) + pow(dot(N,H2), ns) + ...

And therefore:

LightComposition.Diffuse = kd * Albedo * LightAccumulation.Diffuse
LightComposition.Specular = ks * Albedo * LightAccumulation.Specular


You mostly just need it for a Light Pre-Pass renderer. It might be a bit unnecessary for a standard deferred renderer. It also depends on how much you extend it, like maybe with Fresnel, SH lighting, hemispheric lighting, ...
Why not just create 2 render targets and do swaps (ping-pong) for accumulating?
Swap related discussion:
Rendertarget stack for postprocessing
How to perform Multi-Pass / Ping Pong filtering?
A standard deferred renderer might benefit from a light accumulation buffer if you notice that constantly reading the diffuse albedo from G-buffer during light calculations is being a bottleneck.

In that case you could accumulate lights without the albedo, then do a final pass where you modulate the light accumulation with the scene's diffuse albedo. If I remember right that's what STALKER: Clear Sky does.

However personally I've not found that to be beneficial. It also creates the same problems that light prepass has (not easy to achieve unlimited "overburn" of lighting, not easy to have correctly colored specular)

This topic is closed to new replies.

Advertisement