7 Replies Latest reply on Feb 28, 2008 8:07 AM by (Terry_Coolidge)

    matching an AE 3D camera and 3D comp to the perspective of an existing photo

      I searched the forums for "3D," "camera," "match," and "perspective," but I didn't find the answer I'm looking for.

      I have a 3D comp I have created in AE. Animation is all done of layers moving in 3D. I have a still photograph that I want to composite my 3D comp into, and I need to get the perspective to match as precisely as possible. I do not need to move/animate the camera. Just a simple still shot for my background plate and I want to "place" my 3D comp (or the 3D camera looking at the 3D comp) so that it will animate on top of the still background and match in perspective.

      What technique should I use to get these elements to line up? I tried to "eyeball" it by just pushing the 3D comp around in 3D space and rotating it and the camera, but I don't think I was ever going to get it right. Too many variables. Seems like there should be some way to do this "properly." I'm using AE 7.0 and Photoshop CS2.
        • 1. Re: matching an AE 3D camera and 3D comp to the perspective of an existing photo
          Level 1
          Perspective is controlled by camera position and not by the camera angle of view. The easiest way I know of is to take a guess at the focal length that was used to shoot the still. If it kind of looks like it was shot with a normal lens then pick a 35mm or 50 mm lens for your AE camera.

          The second step is to identify the vanishing point in the photograph.

          The next step is to add a 3D solid to your comp and add the grid lines effect so you have something you can use to line up the camera.

          The comp would now consist of the Camera, a 3D solid with a grid and your Photo as a 2D layer so that it won't move around.

          Now rotate the 3D grid 90º in the X axis if the most obvious plane to match is something like a road or rotate 90º on the Y axis if you're trying to match the side of a building. YOu then turn off auto orientation for the camera, adjust the X Y and Z position and the Y and X rotation of the camera to line up the grid with the scene.

          This will give you camera position. Once you've determined camera position, you add your 3D objects and drag them around in the scene until they line up and, if necessary, adjust the focal length to frame up the 3d objects.

          The easier way to do this would be to upgrade to CS3 for PS and AE and use the Vanishing point tool in Photoshop to analyze your photograph and then export a vpe file to use as a comp in AE. This will give you all the right camera info and it will make the whole process much easier.
          • 2. Re: matching an AE 3D camera and 3D comp to the perspective of an existing photo
            Level 1
            I suspected that someone might suggest upgrading to AE and PS CS3.

            :-)

            I've seen a demo of how the improved Vanishing Point tool allows exporting of 3D data to AE. Very cool. I look forward to being able to utilize that someday. However, I'm not in a position to do that right now, but I appreciate these helpful suggestions. I'll give it a go. Thank you, Rick.
            • 3. Re: matching an AE 3D camera and 3D comp to the perspective of an existing photo
              Mylenium Most Valuable Participant
              You could give this one a try:

              http://www.digilab.uni-hannover.de/docs/manual.html#overview

              It exports Maya ASCII files (*.ma) which you could read into AE using the respective keyframe assistant. It's free, so nothing is lost by trying (except for your time of course). Short of that, Rick is right - find someoen with PS CS3 Extended and use VPE. Takes only 5 minutes and makes such work a no-brainer.

              Mylenium
              • 4. Re: matching an AE 3D camera and 3D comp to the perspective of an existing photo
                Level 1
                If I found someone who has both AE CS3 and PS CS3 Extended, are they able to save out the resulting AE file in such a way that I can open it with my version of AE (7.0)? Or am I completely out of luck until I upgrade myself?

                The more I monkey with this, the more I'm surprised at just how difficult this is. Isn't this something that folks would want to do a lot? Hasn't this sort of thing been done many times before? Surely the pre-CS3 world was able to do this kind of thing before. Right? I'm abandoning the effort of matching the perspective of my photograph using a 3D camera created in AE. I'm going to try to match the camera position, rotation, angle of view, etc. in Maya and then see if I can import the camera and some locators to help me start over in AE.

                BTW... from what I can tell, the camera's angle of view has a HUGE impact on matching perspective. The 35mm default had an angle of view around 26 degrees. I wasn't really close until I bumped the angle of view up to around 55 degrees.

                So... would anyone like to spend 5 minutes (give or take) and send me something I could open in AE 7.0 using their copy of Photoshop CS3 Extended and AE CS3?

                :-D

                Here's the image I'm trying to composite on top of:

                http://webpages.charter.net/terrycoolidge/3D_rendering.jpg

                Here's the same image with a highlight circling the area where I want to place my 3D comp:

                http://webpages.charter.net/terrycoolidge/3D_rendering_highlighted.jpg

                I'm not holding my breath, but if someone wants to be a pal, I'd greatly appreciate it.

                :-D
                • 5. Re: matching an AE 3D camera and 3D comp to the perspective of an existing photo
                  David Wigforss-Hv1BNN Level 2
                  Have you tried to precomp your project, and then use Corner Pin effect to match the perspective?
                  • 6. Re: matching an AE 3D camera and 3D comp to the perspective of an existing photo
                    Level 1
                    Perspective is determined entirely by position. Focal length is only a cropping tool.

                    If I had seen your example I would have suggested corner pin. EZ and Quick.

                    If you really need a 3D element then try dropping your sample photo in a new comp, set the camera position to about 1415, 420, and -1320. Set the point of interest at 628, -197, 0 and then set the position of a replacement 3D solid to approximately -97, -130, and 0.

                    Now adjust the zoom value to about 920 pixels and you should be able to crop or scale the layer to exactly fit over the circled area. It took me about 10 minutes to get there. I set a grid layer to the street and two other grid layers to match the corner of the building. I then set up 2 views, used the top and bottom views to adjust the camera position so the grids lined up, manipulated the point of interest instead of the rotation because it was easier with your example, then positioned the replacement layer without rotation in X and Y space to overlay the sign.

                    Corner pin would have taken about 30 seconds to set up. Using a 3D layer gives more options for compositing.

                    Hope this helps. If you have access to a CS3 copy or a trial I'll post a comp.
                    • 7. Re: matching an AE 3D camera and 3D comp to the perspective of an existing photo
                      Level 1
                      Hi Rick,

                      Thank you very much for the response and for providing the camera and 3D solid data. Quite nearly a perfect match. Thank you, thank you thank you.

                      Regarding focal length / angle of view. We're talking about two different things. You're absolutely right that focal length is "only a cropping tool" and does not alter perspective. However, angle of view is very different from focal length and absolutely changes how edges converge at vanishing points, etc. But I now see that we we're talking about different things.

                      ;-)

                      For what I was doing, I definitely needed to position a 3D camera and work with a 3D comp. Corner pin would not have done the trick. I wish it had been that easy.

                      I'd love to know what process you used to arrive at this combination of camera position and 3D solid position. I would push things back and forth, up and down, here and there, and I just wasn't getting close. Curious to know what your method was. I was trying to be intelligent about it (figuring out the horizon line... making sure the camera was on the same plane... tilting the camera up slightly... placing grids in 3D space to try to get a match... etc.) and it just seemed to be a nightmare. I've been working in 3D for over 15 years and know what I'm doing, but I couldn't get over how difficult this was. Just seemed like way too many variables. I'm much more of a "figure it out the correct way" kind of person, and I don't do well with "guesswork." If you have some thoughts on how to simplify the effort, I'd love to hear them.

                      Thanks again.

                      BTW... I look forward to upgrading to AE CS3 and PS CS3 Extended just as soon as I can. Until then, you may hear from me again on this topic.

                      ;-)