8 Replies Latest reply on Feb 3, 2016 11:51 AM by fredoviolawoodstock

    focal length glitches in After Effects

    fredoviolawoodstock Level 1

      Hi there, folks


      I've set up a relatively simple composition, which has several blue screen actors (6 to be exact) and a background, all in 3D.  I have a null controlling the position of the camera and as I move it around I have been very careful to set a keyframe of the new focal length.  I also have been careful to set these keyframes to hold when possible.  Previewing the scene looks great.  However, when it's rendered some of the frames where a new focal length keyframe occurs is very odd and glitchy.  It's like for that one frame everything gets really oddly warped, defocus-wise, but the very next frame it's fine.  Obviously this is problematic.  After viewing all these frames (and it's not ALL, just about 3/4 of them) I opened the project and made sure it was ok.  Each looked good.  I re-rendered and found them again!  Then I went to make certain that I hadn't left some keyframes on something other than hold and this time discovered that even when stopped the single frame of blur distortion is showing up.  So I can't even render out the frame and insert it into the cut in Premier to fix the problem.


      What in tarnation could I be doing wrong?  Or is this perhaps a bug?  If so, what can be done to fix it?


      Many thanks for your support folks.  Hope everyone's new year is off to a great start.


      - Fredo

        • 1. Re: focal length glitches in After Effects
          Rick Gerard Adobe Community Professional & MVP

          It's hard tell what is going on with your project without seeing the timeline with all of the modified properties of the layers giving you problems revealed (press the u key twice). Generally you would either keyframe the zoom (focal length) of a camera or you would keyframe the position of the camera. Ask a cinematographer to zoom while the dolly is moving is asking for a fight for several reasons. Zoom (focal length) controls framing, camera position controls perspective. Throwing a hold keyframe into focal length will cause a jump when you change the focal length which would not be a good thing. Your footage is also 2D and if you have keyed out the background there is no perspective to deal with that has anything to do with the new background. Moving a camera around a virtual set and changing the focal length at the same time is throwing a bunch of completely unnecessary complications into your shot that make it extremely difficult to control the camera and make a smooth shot. Big changes in camera position that do not match camera moves in the original footage will also give you some very odd looking perspective changes in your shot because the perspective changes when the camera moves should match what would happen in real life when you move a camera around.


          If you have purged all cache and checked the composition by carefully stepping through it a frame at a time especially near your keyframes, and you purged everything before rendering then you are missing something in your preview. With everything purged AE will not render any movement that is not actually in the comp.


          My recommendation would be to match the AE Camera focal length to the focal length of the camera used to shoot the green screen. If the camera operator zoomed in on the green screen shots and the camera was on a tripod then you might want to consider only animating the zoom and the point of interest or rotation of the camera if it is a 2 node camera. If the original footage does not have camera movement and you are just framing up each actor then would move the camera around the set and have the layers always set to auto orient towards the camera. If you have not inserted 3D elements into the virtual set you are building then I probably would just animate the position of the actors and forget 3D completely.


          Without seeing your project and a complete description of exactly what you are trying to do along with a detailed description of the footage it's impossible to say exactly what you should be doing.

          • 2. Re: focal length glitches in After Effects
            fredoviolawoodstock Level 1

            Thank you so much, Rick.  And please forgive me, I miswrote the property that is having trouble.  It's focal DISTANCE, which I am led to believe is the distance from the camera that is in focus.  Here are a couple of screen captures that show you the two frames next to each other, both with the exact same camera position and focal distance keyframes, but with VERY different visuals!  I had very recently purged everything.  Actually, this problem might have started occurring after said purge...


            Screen Shot 2016-02-02 at 9.09.32 AM.png

            Screen Shot 2016-02-02 at 9.09.41 AM.png

            • 3. Re: focal length glitches in After Effects
              fredoviolawoodstock Level 1

              I have just cleared all the caches again and am attempting to render.  I still have trouble with these isolated frames.  I thought I would have to fix this one frame at a time, and moved the keyframes back a frame in order to be able to render the single frame with proper focal distance, but it doesn't make any effect!  This is so strange! 

              • 4. Re: focal length glitches in After Effects
                fredoviolawoodstock Level 1

                Actually, I've just figured out the nature of this glitch - it's suddenly getting a different aperture setting, although I haven't checked to see if the aperture keyframe info actually changes.  But if you look at the two shots, the two side dudes are the main plane of focal distance. I don't want a lot of blur, so have set a relatively low aperture setting, but that first shot (which is the keyframe shot) it's like a MUCH higher aperture setting, thus much shallower depth of field.  The question is, how can I fix this?  I don't have any aperture keyframes on the timeline anywhere. 

                • 5. Re: focal length glitches in After Effects
                  Dave LaRonde Level 6

                  In a real camera a change in aperture changes focal length.  What happens if you set a Hold keyframe for aperture?

                  • 6. Re: focal length glitches in After Effects
                    fredoviolawoodstock Level 1

                    Thanks for your feedback, Dave.  I double checked and not only is the aperture info not changing when visually it appears to do so, but adding a hold keyframe for aperture at the beginning of the piece doesn't do anything either.  The way I have been bandaid the situation is be creating another camera and camera null and cut-pasting the keyframe info from the first camera.  But I'm not sure what that tells me about this problem.  If you have any ideas I'd be very grateful.

                    • 7. Re: focal length glitches in After Effects
                      Rick Gerard Adobe Community Professional & MVP

                      It is hard for me to tell exactly what is going on in you comp because I can't see the properties of the camera layer when the problem occurs. Generally you would not want to animate focal length and aperture. Use one or the other to control the depth of field. When you are shifting the focus point around the comp it is often very handy to attach a null to the focus distance with an expression and then move the null around to shift focus. This expression works if the null is named focus Null:

                      p= position;

                      t = thisComp.layer("focus Null").position;

                      fd = length(p, t)

                      Usually you would not animate zoom value and aperture because that's an odd way to run a camera but if you really need to do that then this kind of a setup may give you better results:

                      Screen Shot 2016-02-03 at 9.09.07 AM.png

                      Here's a CC2014 project file for you to look at. Dropbox - AnimateCameraZoom.aep (note: your browser may add a .txt extension to the AEP file. Just delete it and you should be able to open it)

                      Personally I would rather move the camera than animate the zoom.


                      Once again, if I saw exactly what you were trying to do with the camera and why you were doing it maybe I could figure out what's going wrong.

                      • 8. Re: focal length glitches in After Effects
                        fredoviolawoodstock Level 1

                        Thanks so much, Rick!  That is really helpful!  We have had another small misunderstanding, as I am not animating the aperture, just the focal distance.  The glitch that I'm getting however seems related to the aperture (even though I have not even keyframed it!) in that for one frame at each Focal Distance keyframe I seem to get a very high aperture appearance.  But the aperture number is not changing in the timeline.  But, It's just for that single frame the focus of the project gets extremely shallow - really only the focal point that has been keyframed is in focus and everything else goes WAY out of focus.  So, again, technically nothing has been altered with the aperture, but I'm getting the appearance that that setting has suddenly gone way up.  It may not be that though.  No doubt this is a bug and not how I've set things up, though, as I've gone through over and over with a fine-tooth comb.  Thank you so much again for the expression and the project file!  Very much appreciated!  I will definitely use your technique moving forward!