8 Replies Latest reply on Jan 25, 2017 12:00 PM by Roei Tzoref

    Framing camera square to the target


      I have a camera and an image in 3D. I play around with the camera position. Now I want to frame the camera square to the image (target), as it was at the beginning. If I do it manually, it's never perfect. I know there's a way to do this automatically, just don't remember how. Thanks.

        • 1. Re: Framing camera square to the target
          Roei Tzoref Adobe Community Professional

          this would have been easier if you set your orbit rig your camera from the start.

          1. Create a 50mm Camera

          2. right click on the camrea -> camera->create orbit null

          3. parent the null while holding shift to the location of your layer. it will get it's transform values and be at it's exact position


          you can see here in this Creative Cow's Andrew Davis tutorial how he demonstrate using a null controller to shift the camera's position to the exact focal point location of a 3d layer. Working in 3D Part 3: Simple & Fast Camera Animation

          • 2. Re: Framing camera square to the target

            Thank you Roei,


            I did try this. The camera does move towards the object but it doesn't move square to it. What am I doing wrong?

            • 3. Re: Framing camera square to the target
              Dynopete Level 1

              As you can see here, both the camera orbit null and the red rectangle have the same coordinates. However, the camera is not looking square at the object.



              Camera animation.png

              • 4. Re: Framing camera square to the target
                Rick Gerard Adobe Community Professional & MVP

                Your workflow still isn't right.


                For a two node camera:

                1. Change the Auto Orientation of the layer (Alt/Option + Ctrl/Cmnd + o ) from None to Orient Towards Camera.
                  Screen Shot 2017-01-25 at 8.08.34 AM.png
                2. Move the Position of the layer to the Point of interest of the Camera  or move the Point of Interest of the Camera to the Position of the Layer

                This will set the layer parallel to the film plane.


                For a one node camera just make sure that Auto-Orientation is set to off and the Rotation and Orientation of the camera and the matches the Orientation and Rotation of the layer.


                For a 2 node camera you can also add an expression that Dan Ebberts came up with to the Orientation property of the layer providing that the Rotation values for the layer are all zero.

                L = thisComp.activeCamera;

                u = fromWorldVec(L.toWorldVec([1,0,0]));

                v = fromWorldVec(L.toWorldVec([0,1,0]));

                w = normalize(fromWorldVec(L.toWorldVec([0,0,1])));


                sinb = clamp(w[0],-1,1);

                b = Math.asin(sinb);

                cosb = Math.cos(b);

                if (Math.abs(cosb) > .0005){

                c = -Math.atan2(v[0],u[0]);

                a = -Math.atan2(w[1],w[2]);


                a = (sinb < 0 ? -1 : 1)*Math.atan2(u[1],v[1]);

                c = 0;



                I have this expression saved as one of my custom animation presets and I use it quite often. I suggest that you start building up a library of useful animation presets.


                The last quick option which may produce some unexpected results in the animation is to have Auto-orient set to Orient to Camera and then use the Transform Menu or the keyboard shortcut Ctrl/Cmnd + Home to center the layer in the current view. If you have position keyframes for your layer you'll get a new position keyframe. If you do not then the first position of the layer relative to the camera animation will change and things will get fouled up. I never use this technique on an animated layer but I will use it quite often to properly position a new layer in a composition that already has a camera move. It's a very handy way to get the layer centered in the camera view so you can start a new animation.

                • 5. Re: Framing camera square to the target
                  Dynopete Level 1

                  All these options are interesting. However, what they do is to orient the layer to the camera. In my case, I want to orient the camera to the layer.


                  Here's my workflow:


                  1. I create a 3D layer with a rectangle.

                  2. I create a 2-node camera

                  3. I move the camera away (in Z) and than rotate it.


                  Now I want to animate the camera while it zooms back to the rectangle, square to it and full screen. I'm sure there must be a function to do this automatically.

                  • 6. Re: Framing camera square to the target
                    Rick Gerard Adobe Community Professional & MVP

                    You are way over thinking this problem.


                    Set a keyframe for your original camera position. Copy the keyframe (Ctrl/Cmnd + c). Animate the camera to the next to last position. Move the CTI (current time indicator) to the spot where you want the camera to return to being centered on the layer, select position and paste (Ctrl/Cmnd + v). If you want to make Z adjustment from that point feel free to do so.

                    • 7. Re: Framing camera square to the target
                      pierret49083608 Level 1

                      Thanks Rick. I was able to do this manually. I just thought there could be a function where you told the camera to automatically zoom in square on a layer. I guess it has to be done manually.

                      • 8. Re: Framing camera square to the target
                        Roei Tzoref Adobe Community Professional

                        I see now the shift parenting does not create a keyframe so let me fix my suggestion.


                        In fact here's 2 suggestions


                        suggestion #1

                        1. create a 3D solid
                        2. create a camera (1 or 2 node does not matter).
                        3. Now the rectangle fits the screen perfectly so just work in reverse: set keyframes for position and other properties you may change
                        4. move forward in time and change the camera the way you want
                        5. to reverse the keyframes select them all, then right click on one of them and select keyframe asistant->time reverse keyframes


                        suggestion #2


                        1. create a 3D solid
                        2. create a camera (1 or 2 node does not matter)
                        3. create an orbit null. right click on the camera->create orbit null
                        4. use the null's properties to move the camera around. you can copy the 3D layers transform properties to the null and the layer will fill the screen perfectly. This technique is good if you want to move between many 3D layers.
                        5. if you want, you can also use the camera's parameters simultaneously, just make sure you reset them at the ending keyframe, make sure you zero out X and Y for position at the resting pose to not create an offset between the camera and null


                        here's a project file showing both methods: CameraToRectangle.aep - Google Drive


                        BTW theres a plugin called "Sure Target", you might want to try it too.