How to Create a 3D Shallow Depth of Field in After Effects

After Effects June 29, 2019 5 min read

In this tutorial, you’ll learn how to give your elements a 3D shallow depth of field in After Effects. You have probably seen this effect in other videos. It’s when the webpage is made to look three dimensional and like it’s being viewed through a camera with a shallow depth of field — for example, showing a webpage in a product video or presentation, or even a handy video tutorial from your favorite online outlet. 

You could quite easily add movement to your footage, such as tracking or scaling to make it look more interesting, but what looks really cool is a 3D effect with shallow depth of field. Since working with screen captures is rapidly becoming part of the evolving list of tools, almost every editor needs this skillset. But don’t worry! This effect is quite easy, and we’re going to show you how to do it. Let’s dive in! 

How to Make a 3D Shallow Depth of Field in After Effects

If you’re not working from existing or already provided screen captures, you’ll need to record and prepare these first. It’s always advisable to record an area slightly bigger than what you will need, so you can be sure you will fit everything in the frame. 

Step 1: Prepare your Clip(s)

As with most processes in After Effects, you will need to do a little bit of clip preparation. By trimming and editing the clips before starting the animation, you won’t waste time working on the bits that won’t make the final cut. 

  1. Import your screen capture(s) in to After Effects.
  2. Create a New Composition (Command/Control N) using the Frame Size you need. A lot of screen recording software won’t capture exactly 1920×1080 footage, but you’re going to scale it up a bit later, so this can be a good thing.
  3. Trim your clip to just the section you want to use.
  4. Position your Playhead at the end of the clip(s) and press N to set the workspace. 
  5. Right-click on the work area bar and select Trim Comp to Workarea.
  6. Finally, select the clip and go to the Scale settings. Increase the Scale so that the clip is larger than your frame size.

If you want to work with multiple screen recordings cut together before adding this effect, it might be easier to edit them in Premiere Pro. Once you are happy with the cut, select all of the clips, right-click and choose Replace with After Effects.

Learn more about dynamic linking between After Effects and Premiere Pro in this tutorial.

Step 2: Setting up your Camera

To create the shallow depth of field, you’ll need to add a camera. No, not a real camera, an imaginary one, or to be more accurate one that exists within After Effects. The aptly named After Effects Cameras allow you to replicate the effects of a real camera but in a virtual space. 

  1. Right-click in your composition and select New > Camera, and the Camera settings box will pop up.
  2. Choose a Focal Length that will give you the effect that you’re trying to achieve. If you’re not sure, just stick with 50mm. If you want to change this later you can do so by going to the Camera Layer dropdown > Camera Options.
  3. Name your Camera and click OK. Simple right!  

Step 3: Changing your Camera View

Now that you have created a camera, everything you see in the view window will be from your imaginary camera. You can change the view to give you a better understanding of where things are in your virtual world. Let’s take a quick look at how.

  1. In the play window, find the dropdown box labeled 1 View. Here you will find several options for the number of perspectives you want to see, and how you will view them. Select 2 Views – Horizontal, and you will be able to see your composition from two different angles.
  2. To change the angles you are viewing the world from, click on one of the views so the box is highlighted and find the Angle dropdown menu (it will be next to the Views dropdown). Select ‘Top’ and you will see a birds-eye view of your scene.

It can be a little challenging to understand what you are looking at, but once you start moving things around the space, you will be able to see the effect from each of the views. When you go to export a piece with a camera, it will always export the Active Camera, so it’s a good idea to make sure that one of your views is still set to Active Camera.

Step 4: Creating a 3D Clip

You now have a Camera set up (great job), but it will only work if the layer is also 3D. This allows the camera to move around the clip; it becomes an object in your virtual space.

  1. Click the 3D box for your clip layer. You will notice that under the Position and Orientation settings, a third set of coordinates have been added. 
  2. Press W on your keyboard and rotate your footage to orient how you want. You can hit the V key to go back to your normal Selection tool and change the position of the clips. 
  3. Play around with your clip until you are happy with its angle and position.

Step 5: Creating a real Depth of Field

With your clips set up, you can move the image around to give it perspective, but there’s something important missing. You’ll need to make it look like there is a real depth of field. Thankfully, once again, this process is incredibly simple.   

  1. Dropdown your Camera Settings and go down to Camera Options.  
  2. Creating a realistic depth of field is as simple as clicking it from off to on, but you won’t see a dramatic change straight away. To finesse the depth of field, you want to control two specific parameters: Aperture and Focus Distance.  
  3. Adjust the Aperture setting until you are happy with the depth of focus in your shot.
  4. The Focus Distance setting allows you to choose the point the camera will focus on. In the Top View panel, it’s represented by a pink line on the camera, which moves as the setting is changed. This line can help you specify where, in the virtual world, your camera is focused.

The Focal Distance and Aperture settings work together to create your 3D depth of field. The best way to learn how to use the camera is to play around with these settings and see what effects you can achieve.

Step 6: Keyframing your Clip

Now you get to have some fun; you’re going to add movement to the clip. When you move your footage layer around the screen, the focal point of the clip will change, as it would if a real object moved passed a real camera.

  1. Select your clip in the sequence, and go to the Transform dropdown.
  2. Adjust the Position, Scale, and Orientation of your clip to where you want the animation to begin, and add a keyframe to each of the properties.
  3. Move the playhead along the timeline to where you want the animation to end.
  4. Reposition the clip to where you want the animation to finish, the keyframes should be added automatically.

Step 7: Adding a Background (Optional)

This final step is optional, but it can help make your composition look more professional. If your screen capture is of a webpage, it’s most likely you will need a white background. However, you can choose any background color, gradient, footage, or image you’d like.

  1. Right-click on the sequence and choose New > Solid.
  2. Select Solid Color and hit OK.
  3. Move the Solid to the bottom, below your camera and clip layers.

Using screen capture footage in videos is a popular trend and a great way to display valuable information in a video. This technique has many more uses, such as creating awesome transitions between clips or title sequences. Using a 3D shallow depth of field animation in After Effects is a fun way to make your screen recorded clips look more visually pleasing, and are sure to keep your clients happy!