PDA

View Full Version : accumulation buffer banding



VCarnage
09-08-2006, 08:28 AM
Hi,

We are using a 16 bit per channel accumulation buffer for implementing high quality motion blur. Thus, we're trying to glAccum lots of frames(50+). We expect to be able to accumulate up to 256 frames with a 16 bit accum buffer. However, we seem to get visible banding once we accumulate over ~16 frames. Here's pseudocode:

for n frames
drawframe
glAccum(GL_ACCUM, 1.f/n);
end
glAccum(GL_RETURN,1.f);

We're just wondering other people's experience with this, and how many frames they can accum before banding is noticeable. What would be a maximum number of frames to accum with 16bit accumbuffer and still not get banding.

Thanks for any responses.
-VC

zeoverlord
09-08-2006, 02:51 PM
try

for n frames
drawframe
glAccum(GL_ACCUM, 1.0f);
end
glAccum(GL_RETURN,1.f/n);

The banding is because you first degrade the information before you add it to the 16 bit buffer and not within it.
adding all frames to the accum buffer before reducing the brightness might help reducing banding

09-08-2006, 07:08 PM
The spec doesn't dictate how those 16 bits of precision are utilized, so the driver may implement the accumulation buffer using a half_float (fp16) format. You might try doing the motion blur into an FBO - you'd have more control over the precision and be able to do more complex effects.

k_szczech
09-09-2006, 03:57 AM
The banding is because you first degrade the informationThis was my first thought, but I've checked the specs - accumulation buffer is in range <-1.0, 1.0>, so you have to scale frames when you add them.
However, it's true what <anonymous> wrote - we don't know if accumulation buffer is fixed-point or floating-point.

zeoverlord
09-09-2006, 07:36 AM
I just did a test with the above method in a separable blur filter(using a pair of GL_RGB16F_ARB FBOs).
I start to get visible banding at around 4+4 samples and some hints towards banding at 3+3 samples.
At 256+256 samples, it looks like you only had 16 colors, but the blur is nice.
I do need to swich to a shader sampler to get full 32f sampling.
The blur test i did with 10+10 sampling (http://coldfire.flashbang.se/img/cfblur.png)

VCarnage
09-11-2006, 08:32 AM
According to the red book, you should scale as you accum to make use of the full range of the accumulation buffer. I tried both methods and don't really visibly notice any difference.

Looks like zeoverlord is getting similar results with fp16 fbo's. Leads me to believe the accumulation buffer is fp16. I guess you can't really blend more than 10-20 frames without visible banding with only an fp16 buffer.