11 Replies Latest reply on Apr 18, 2016 8:16 AM by Rick Gerard

    How to create a 3d fly through of photoshop layers

    Houston.Brown Level 1

      I have an image in Photoshop that has lots of layers. I want to take that layers, import them in after effects and create a camera that will fly through the layers just like in this Dave Hill video (Adventure Series - by Dave Hill - YouTube ) . I saw an interview with him and he said it was quite easy to do but I be darned if I can figure it out. I have watched a few AE videos on how to do something similar, but the main problem I am having so far is that after importing the layers into AE, the image looks nothing like it does in PS. I am sure that some layers will need to be combined in Photoshop to get the right look in AE but I am at a loss. Perhps tis may be way over my head as I am not an experienced AE user at all. Just thought it would be really fun to try.


      Any input would be greatly appreciated.


      Many thanks,


        • 1. Re: How to create a 3d fly through of photoshop layers
          Rick Gerard Adobe Community Professional & MVP

          There are two tricks to this technique. It is sometimes called "The Kid Stays in the Picture" effect.


          The first trick is that you have to separate your image into foreground, middle ground and background layers in Photoshop and fill in the holes left when you cut things out on the layers below.


          The second trick is that you import your PSD as a comp, then make all of the layers 3D, add a camera that has approximately the same focal length used to take the shot, then move the middle ground and background layers away from the camera in 3D space. They will get smaller as they are moved back in Z space but you fix that with scale. To make the perspective shift look natural you have to approximate how far these elements would be from each other.


          For example, if you had someone sitting in front of a window and there was a tree outside the window and there was a mountain behind the tree you would first duplicate the background layer 3 times. The background would be the mountain layer, the next layer would be the tree, then next the window, then the top layer would be the person.


          Now you cut out the person, then temporarily turn off the top layer. Now you cut out the window and erase the person where they were in front of the window. You do the best job you can. The more of the person you can remove the more you can move the camera. Then you cut out the tree and erase any part of the window that was in front of the tree. Again, the more of the window and the person you can remove from the third layer the more you can move the camera. The last step is to remove the tree and the window from the background so only the mountain remains. Again, the more of the other elements you can erase using what ever tools you need to, the more you can move the camera. Sometimes you'll have to cheat with scale, sometimes you have to borrow things from other images. It all depends.


          Once you have you Photoshop file prepared you Import as a comp, then add a camera and make all of the layers 3D. You start by grabbing the bottom layer and you move it quite a ways back in Z space. Now you scale the layer up until it fills the frame. If you want the tree about half way between the background and the foreground (the person) you move the tree layer back in Z space about half way between the foreground and the background. Now you scale up the tree layer until it looks right. The last step before starting to animate the camera is to move the window back in Z space. Since the window and the person are close to each other you only move the window back in Z space a little bit, then you scale the layer up until it fills the frame.


          Now you animate the camera. It's as simple as that. The more of the person and the window and the tree you were able to remove from the second, third and fourth layers, the more you are able to move the camera. The photoshop part is the hardest part.


          In the example you posted you can see all of the layers that he has used stacked up in Z space. Most of the time the layer's do not rotate but as he exposes the camera move sometimes he is rotating the layers.  It looks like he used some blend modes for the smoke. It's all pretty simple if you understand how perspective and parallax works.

          Screen Shot 2016-04-16 at 6.41.10 PM.png

          Personally I have never revealed the secret in any of the sequences that I have created that use this technique. I guess that Dave likes to show 'the man behind the curtain' When I estimate the time required for this type of project I devote about 80% of the time to Photoshop.

          • 2. Re: How to create a 3d fly through of photoshop layers
            Houston.Brown Level 1



            Thank you for taking the time to explain all of this. I have managed to get about 1/2 of what I am trying to accomplish. The problem I am having ow is that when I take on e of the Photoshop layers, convert it to 3D, then try and move the position (z) forwards of backwards, it also changes the scale of that layer. I need the scale to stay the same or else all the layers become misaligned. If you look at the first few frames of the example video, you notice the image looks as it would if it was flattened. then the camera starts to move through the layers everything stays in place. Only the layers have gaps between them which is exactly want. I am not sure how to move the layers through the z axis without scaling them.

            • 3. Re: How to create a 3d fly through of photoshop layers
              Rick Gerard Adobe Community Professional & MVP

              You scale them to match the frame size at the first position then you move the camera without changing scale. If the motion does not look right then the spacing is off. common things that cause problems are wrong focal length and incorrect space between foreground, middle ground and background layers. The ratios should match real life.


              If you tied the scale to the distance to the camera then there would be no change in image size as the camera moves and that would never happen in real life.

              • 4. Re: How to create a 3d fly through of photoshop layers
                Houston.Brown Level 1

                But what I am trying to do is to start off the scene looking at the image strait on so all layers so the image APPEARS to be flat (See video at 6 seconds). Then I mean to fly through the layers at which point it will be obvious that the layers will start breaking apart as you fly through them, just like in the example video. So, I have to be spread all the layers along the z axis but when you do that, each layers requires you to resize them to make them look like they are in the right perspective.  This seems an impossible task to do when you have to resize all the layers to match. It's like creating forced perspective on all these layers which to do by hand seems if not near impossible, certainly very time consuming and the interface does not seem to be conducive to such a task either. Certainly I am missing something.


                Many thanks,


                • 5. Re: How to create a 3d fly through of photoshop layers
                  Rick Gerard Adobe Community Professional & MVP

                  Lining up is very easy to do if you import your Photoshop file with Comp size instead of layer size selected for the import as a comp option. Then you can just add your camera, move the background back by adjusting the Z value, then select the scale property and scaling until the edges of the background layer reach the side of the comp. It should take you just a few seconds.


                  If you choose retain layer size then you just have to guess. This does not have to be absolutely precise. If you want it precise you can use and expression to scale the layer precisely to the equivalent of 100%. The expression looks like this:

                  C = thisComp.activeCamera;

                  CP = fromWorld(C.toWorld([0,0,0]));

                  L = thisLayer

                  LP = fromWorld(L.toWorld(anchorPoint));

                  d = length(CP, LP);

                  z = C.zoom;

                  r = d/z

                  r * value

                  You will then have either make a note of the scale value and disable delete the expression and enter the new scale value. The other option is to use the Keyframe Assistant to convert the expression to keyframes  and then delete the keyframes.


                  Let me repeat that you cannot leave the expression turned on. You will not get any 3D effect if you move the camera in  Z.


                  When I do this I always just import the PSD with Comp Size selected for the layer option and then just do the conversion visually. Holding down the shift key lets me drag the Z position value at 10 times the normal rate and makes this a very quick thing to do. I don't really worry about lining things up to perfectly match the original photo because eyeballing the edges of the frame gets you close enough for most projects.


                  The most important part of getting this effect to work well is the relative position of the layers. If you have a person that is 10 feet from the camera and a window that is 15 feet from the camera and a tree that is 150 feet from the camera and a background that appears to be a mile from the camera you need to set up those relationships in AE. If you have picked a focal length for your camera that closely matches the focal length of the camera used to take the photo then the objects in the frame that meet the edge of the frame would be at the default position. Let's say that was the wall that contained the window. If the zoom value of the camera was 900 pixels then the wall would be at a z value of 0 which wold be the equivalent of 15 feet, then the person would be at 1/3 closer to the camera or a z value 1/3 closer to the camera or -300. The tree would be at a z value of 10 times the zoom value or a z value of 9000. The background will work if it is two or three times that value or a z value of 27000. This will get you close and make the camera move fairly closely match the perspective change you would get in real life.


                  The numbers are approximate and don't have to be perfect but the ratios should be close. If you distribute the three layers evenly in Z space you will still get a perspective shift when you move the camera, it just won't be accurate but that stylized look may be just what you are looking for.


                  If you wanted to move in on the layers so it looked like the photo was flat you would set up the comp so you had the original photo as a 3D layer in the same position as the foreground ground. In this case you would want to use the expression to precisely scale the layers so they match the original. Then you would start your camera move and simply cut to the other 3D layers when you wanted the separations to start. You would make the cut when you want the foreground to start moving closer to the camera. This will take some pre-planning and some calculation.

                  • 7. Re: How to create a 3d fly through of photoshop layers
                    Houston.Brown Level 1

                    I think I am getting really close. One of the problems I was having is that the PSD was way too big that I was bringing into AE, over 6000px in the horizontal. I have resized the image to 1920 X 1080 and that seems to work better. But now I am getting a problem with pixelation. Is this because my image that I am importing from PS is too small. I would think there is plenty of resolution as i am not scaling anything up.


                    Screen Shot 2016-04-18 at 8.15.55 AM.png