7 Replies Latest reply on Feb 21, 2011 3:45 AM by escooler2

    Blocky Gradiants


      I consider myself a fairly advanced user of after effects but my knowledge has a few gaps when it comes to colours ect....One problem I allllllways have when working with AF is detailled in the picture below...my shading is always blocky (like radian steps - look at the lighter blue in the picture) and never smooth...Anyone know how you go about fixing this issue...it drives me insane...




      Screen shot 2011-02-18 at 12.15.02.png

        • 2. Re: Blocky Gradiants
          Kwangle Level 1

          It could be down to a limitation of the bit depth of the colour channels - ie how much data (in bits) that is used to store the colour channel data for each pixel.


          Commonly the bit depth is 8 bits per channel - for RGB this adds up to 8 bits for Red channel + 8 Bits for Green channel + 8 Bits for Blue channel which totals 24, this is called 24 bit colour which is very commonly used in images and video. 8 bits of binary data can store up to 256 values: 00000000 (0) to 11111111 (255) so each channel can have 256 levels of brightness. This means that 24 bit colour can have 256 Red x 256 Green x 256 Blue possible colours or about 16.7 million colours. This is usually enough for most high-quality purposes but occasionally it is not sufficient and banding is visible.


          In your case you have a small range of tone over a large area so the 256 levels of brightness for each channel is not enough to have a different colour value for every step in the gradient, so you see banding. I've seen this phenomenon on imagesetter output for the same reasons (though in CMYK colour). The easiest way to remove it is to have the colours stippled - ie patterns of pixels to simulate different tones between the 256 level limitation. You could also add noise to the colour to disguise the banding. Another way would be to work in a higher bit depth of colour, but you would have to find a way to make this work in AE and output video that supports bit depths beyond the ubiquitous 24 bit.


          Sorry to get so technical, but I hope this helps

          • 3. Re: Blocky Gradiants
            Mylenium Most Valuable Participant

            What Kwangle said (even if he has the math wrong) - normal behavior due to the fact that the spatial distribution of pixels along the axis of the gradient exceeds the available discrete colors, hence some of them will be used multiple times on neighboring pixels and causing visible banding. The common "fix" is to work in 16bpc. Since AE uses smart dithering, even when saving to an 8bit format you would see better distribution of colors. Other than that trying to influence the distribution by adding noise or otehr patterns is the only way. On the otehr hand, none of that will realyl save your bacon once you need to deliver this and work with compressed formats such as H.264. there will always be banding, even if only minor. It's inherent in the process.



            • 4. Re: Blocky Gradiants
              Rick Gerard Adobe Community Professional & MVP

              The image you put up is an 8 bit png. There are two ways to reduce or eliminate banding. One is to hide the banding with noise, the other is to put less distance between the values. If you render to an 8 bit codec from a 32 bit project you're still going to end up with banding because there's still not enough information in the color channels. Take a look at the red channel of the image you provided.


              The numbers tell the story. At the left end of this example you've got a 16 pixel wide band of pixels with a value of 92, at the right end there's a 16 pixel wide band of pixels with a value of 61. Since there's no such thing as a pixel with a value of 92.5 in an 8 bit image the minimum width of these bands is 16 pixels. If you had rendered to a 16 bit or even a 10 bit codec the minimum width of the bands would have been much smaller. There's 128 times more color values available in a 32bit codec, there's 4 times as much information in a 10 bit codec. Rendering the same project to ProRez or Black Magic 10 bit from a 16 bit Project file would have given you bands that were only 4 pixels wide. By the time you combined the R G and B channels the bands would be very hard to distinguish.


              Once you have your higher bit depth render you can compress the image down to 8 bits.  Depending on the codec, the movement, and the compression settings, you will either disguise the banding that must exist in an 8 bit image or make it worse. It's all in the numbers. That's why it's a good idea to add just a little noise to your gradients. In 3D apps it is common to add some noise to the specularity or add a little bump mapping to make things look more realistic. The same holds for AE.


              Try rendering to a different codec from a 16 or 32 bit project. Your banding should go away.

              • 5. Re: Blocky Gradiants
                Kwangle Level 1



                Sorry if I've posted misleading info - which bit of my maths was wrong?

                • 6. Re: Blocky Gradiants
                  Todd_Kopriva Level 8

                  I'm repeating some of what Rick and Mylenium said here, but hopefully adding a little detail and clarity, too:


                  The first thing to do is to set your color bit depth for the project to 16bpc or 32bpc.


                  In this video, I go into some detail about color depth and its relation to banding in  gradients.


                  One thing to keep in mind is that what you see on your computer screen for a preview will not in all cases match what is rendered for final output.


                  After Effects will dither colors (essentially add a tiny bit of noise) to reduce or elminate banding any time that the colors go through an 8bpc part of the color pipeline---including on rendering to an 8bpc output format. But After Effects doesn't do this same dithering for rendering to the screen for previews. If you want to force your preview to look the same as final output by forcing the dithering operation, you can apply an 8bpc effect but have it do nothing---which forces the colors through an 8bpc color path. The Arithmetic effect is a good choice for this.

                  • 7. Re: Blocky Gradiants
                    escooler2 Level 1

                    Thank you all for your answers they have been most helpful..


                    I should have orignally mentioned the banding/gradiant is the result of using 3d lighting....not an actual gradiant...


                    I added noise and indeed this did reduce the banding and still looked acceptable. However is there a way to ensure that when you apply mighting to your comps it does not push past the colour limits? Am not a big fan of these techical aspects of a project...more intrested in artisic considerations....


                    Thanks for all your commments.