Page MenuHome

Debanding Node
Open, NormalPublic


This patch adds a new Node to the compositing system which will help to get rid of banding effects which are a problem when working with 8-bit images and videos.

Just for the record:
An unwanted posterization effect is what we call banding.
That means, we have a gradient that is so slight, that the value difference between neighboring pixels in a color space of higher bit depth (In the Blender pipeline we will internally deal with set-related color space) is so small that due to quantisation which is applied during the conversion to an other color space with low bitdepth (for example BT-709 YUV Space) the value of those pixels will be the same in the final image.
As consequence of that many 8 bit per channel images and videos suffer banding what is hardly noticeable if you view your material but will make big problems if you do intensive color manipulation with the compositor. You will see that color steps appear on flat image areas.

So what the node tries to do is:
- Find banding steps: A banding step is a very low value delta in a group of at least three pixels. If there are only two pixels with a value difference, they could be part of a correctly rendered slight gradient. We always have at least two pixels of theoretically the same value which form a platform and another pixel with a slightly different value that forms the step to the next banding platform.
So we try to find all vertical or horizontal groups of at least three pixels that have low value delta.

- Blur the banding: Because blender works with float precision, we may simply blur all areas that suffer banding. We must take care that we only use pixels as samples for blurring that are inside the banding area. So if we have a blurring radius of 10, but the area of banding is only 5 pixels, we have to set the blur radius to 5 dynamically.

- The node does this operation for the RGB channels by default, but with the single channel switch active it will only calculate the first input plane and pass this to G and B planes. The purpose of this is if you want to filter seperate channels by using the seperate RGB, YUV or HSV nodes. This will allow to control the debanding process for every channel separately which is important because blender works in RGB space while most video and many image formats come in YUV. That means the banding is in fact in those channels and will not be corrected properly if you filter it like an RGB image. The feature also enables you to deal with chroma sampling patterns more accurately by splitting the image into YUV channels and work with scaling nodes for the color planes prior to the deband node.

I tried to comment the code well so that you can easily understand what I did, sorry for my basic english.

The benefits for blender are:
- Either for CGI or real video shots, material of low bit depth may like-to-be converted to a higher depth. That open many compositing, color correction and grading possibilities that were not there for such material before.

- If you are working with an 8-bit video for example, with the debanding node applied blender's post-process dithering for rendering will now also work because banded gradients are quasi converted to blender's float space.



Event Timeline

Added new version, deband_patch_2.txt
Uploaded an outdated version by accident before, sorry for that.

Debanding is an intensive operation. Please use complex node type and direct access to the input buffer to get more speed.

Would this code be transportable to the Sequencer too? Now that the color tools have been ported from the compositor there can be color grading work performed there as well. Perhaps as a modifier?