2 Replies Latest reply on May 20, 2016 2:14 PM by Rick Gerard

    Problem with line animation flickering/aliasing

    rsatkinson

      Hi I was just wondering if anybody had any suggestion on trying to get this animation smoother and a bit crisper.

       

      I do know the quality is going to be slightly worse in a gif format.

       

      https://s3.amazonaws.com/uploads.hipchat.com/115279/3089179/b6GFClDGSBHAucu/lines.gif

       

      Thanks

        • 1. Re: Problem with line animation flickering/aliasing
          Dave LaRonde Level 6

          Four options:

          1) Thicken the line a bit

          2) Alter the speed of the horizontal motion

          3) Increase the frame rate

          4) A combination of any of the above three

          • 2. Re: Problem with line animation flickering/aliasing
            Rick Gerard Adobe Community Professional & MVP

            Let me give you some basics. These are things that are not considered by almost everyone that starts working in video, especially those that come from a print or web design background. Photographers are also victims of a gap in their knowledge that is understandable because they have never had to deal with things like this before. Here are the facts.

             

            First Point:
            Video (and everything else that is based on digital displays) is always laid out on a pixel grid. No exceptions. You can never place a single pixel wide line on this pixel grid and have it show up as a single pixel line unless it lines up perfectly. Anything that is not precisely lined up on the pixel grid will be interpreted. This is called Anti-aliasing. This means that if your 1 pixel thick line is half way in between the grid the display will average the values of that line and you end up with a two pixel wide line in the display with each line taking half of the color value from the original line. In other words if you are not precisely lined up on the grid your 1 pixel wide black line becomes a 2 pixel wide gray line.

             

            Second Point:
            Video is made up of frames that playback at a particular rate. Your screen display also has a refresh rate. Standard display rates in countries that have 60 Hz electricity usually have standard refresh rates of 60 Hz or multiples of a whole number divider of that rate. In countries where the electricity is 50 Hz (Europe) the refresh rates are usually 50 Hz. The video frame rate for video in NTSC (most of the world) countries are standardized at 29.97 fps (there's a reason associated with the problem of broadcasting TV signals in color but I won't go into that right now). The Standard video frame rate in PAL countries is 25 fps. When you choose a frame rate for your video project that is not the standard frame rate for your area you risk having the frame rate for your video conflicting with the frame rate of your display. This can cause perfectly smooth motion to judder and there's nothing you can do about that except change the refresh rate of your display or raise it by owning a new display capable of high refresh rates or change the frame rate of your video.

             

            Third Point:

            The average human eye and brain have a property called retinal retention. This effects how we perceive motion. No matter what you do, most people will incorrectly perceive smooth motion across their field of view. Most of the time the brain tries to smooth things out and your eyes automatically try and follow that motion. This effect is well understood by great directors when they block shots and great directors of photography when they position cameras so your eye is directed to the part of the frame where they want you to look to understand the story.

             

            Fourth Point:
            There is a stroboscopic effect that applies to all motion. For example, if you watch an old western movie on TV you will occasionally see the wheels of the coach turn backwards. Smart Phone video of an airplane propeller may show you weird saber shaped blades spinning slowly or even backwards. This is the interaction between frame rate and motion. The only way to create video that shows motion correctly and in the right direction is to match the motion to the frame rate.

             

            Fifth Point:
            The work around for thin lines turning into thicker lines is to turn off the interpolation. You can do that in After Effects by selecting draft quality. With draft quality turned on you will always have a single pixel thick black line. This fixes one problem but aggravates another. The problem of the stroboscopic effect. To make your single pixel black line move smoothly you must match the motion of the line to the frame rate. You must move at 1 pixel per frame or 2 pixels per frame or 3 pixels per frame or 4. You can't move at 1.4 or 2.8 pixels per frame. It won't wok, it will never work.

             

            Sixth Point:
            Even if you perfectly match the movement to the pixel grid you can still run into the problem of retinal retention and frame rates. Every professional cinematographer worth his day rate knows that there are Critical Pan Speeds - speeds at which you cannot pan the camera across a scene and deliver a scene that does not judder and look terrible. Judder can be so bad that it gives people headaches and worse. The lower the frame rate the more careful you have to be with the camera. When 24 fps video cameras were introduced a whole bunch of folks came back with horrible footage. Shots that work at 29.97 don't work at all at 24. Frame rate, Retinal Retention, Stroboscopic effect and your brain combined with no fixed focal point for your eyes to focus on and track combine to foul up the shot and the motion.

             

            The solution:
            When you want to animate a thin line you are better off at 29.97 fps than anything slower. 30 is OK if you are never going to broadcast or DVD to watch on a TV. You can use an expression to control the movement so that your line moves exactly an even number of pixels per frame. If your design requires that you move faster you must hide the problem with motion blur. If you want to ease in and ease out of the move then you must hide the aliasing problem with motion blur. Long smooth moves must be exactly at an even number of pixels per frame. You have more speed options at higher frame rates. Even at higher frame rates you will run into the Sixth Point problem.

             

            The proof:
            Discounting any anti-aliasing problems giving you gray lines load up the render of your animated lines in AE and step through the animation one frame at a time. Baring any image cache and render issues I'll bet that your animation proceeds smoothly from one frame to the next. It's only when the video plays back at speed that your eyes and brain tell you that the motion is uneven.

             

            Some standards:
            Go to a theater and watch the end titles. It takes about 7 or 8 seconds (depending on the frame height) for the titles to roll from the bottom of the screen to the top. The seven second rule is pretty standard. With 29.97 fps video 1 pixel per frame, 2 pixels per frame and 4 pixels per frame work pretty well for most applications. When you find a speed that works for your video, it's frame size, and it's frame rate write it down. Use it again and again.

             

            Here's an expression that works for animation speed and allows motion blur to be applied to your image. You can make the motion respond to markers if you want to start and stop. I have a bunch of animation presets that I use all the time for this style of animation.

            Bottom to Top:

            t = time;

            fr = t/thisComp.frameDuration;

            x = value [0];

            s = 4; //Speed in pixels per frame must be a whole number

            y = value[1] - (fr * s);

            [x, y]

            Left to right:

            t = time;

            fr = t/thisComp.frameDuration;

            y = value [1];

            s = 4; //Speed in pixels per frame must be a whole number

            x = value[1] - (fr * s);

            [x, y]

             

            If you want to reverse directions you can add a minus sign in the final array or apply the expression to anchor point instead of position. These expressions take the initial starting position of the layer as the starting point. Both move at 4 pixels per frame. The easiest way to start and stop motion is to split the layer, add the expression, let the layer move, then split the layer again and remove the expression. If you are handy with expressions you can tie movement to layer markers and then just move the markers to start and stop or even reverse the direction of a single layer.

             

            If you don't want to mess with all of those unbreakable rules then jack up motion blur and use a higher frame rate with thicker lines and hide the flaws. There are no other solutions.