How To Create 2D To 3D Projections In After Effects
December 10, 2019
Ben Thompson
Learn how to create a 3D projection from a flat 2D layer.
After Effects has the nifty 3D layer box you can check to automatically convert any layer to 3D, but of course, this doesn’t really make the layer truly 3D. It just gives you the ability to interact with a flat image in a 3D space, like a postcard.
Today, we’re going to look at how you can make a 2D image much more interesting by creating a 3D projection from a 2D layer, effectively allowing you to sell more of a 3D effect from your once-flat 2D layer. Your image still won’t be a true 3D layer, but it will have a much more compelling result, and could even allow you to give the impression the photo has been captured as a video.
How to Create a 3D Displacement Map
The first step in building a 3D projection is to create a 3D displacement map.
One way to think about a 3D displacement map is to think about a depth sensor on a camera. Most of the latest flagship phones now include a time-of-flight camera, which allows 3D depth information to be captured along with the actual 2D image. The time-of-flight camera uses light measurements to gauge a subject’s proximity to the camera and embeds an extra layer of metadata in the image.
Once the 3D data has been captured, users can manipulate their photo in interesting ways, such as adjusting the depth of field with amazing detail and clarity. It also allows for enhanced AR experiences.
In a similar way, you can make your own 3D data by creating a 3D displacement map for the image you want to manipulate in After Effects. You can watch the video above for a clear walkthrough on the process, but we’ve also got a breakdown on this technique below!
The easiest way to envision this technique is this: the furthest areas from the camera should be the darkest, and areas closest to the camera should be the lightest. You’ll want to make sure the image has a nice balance of black, white, and shades of gray to achieve a balanced depth map. You can play with brush opacity to generate variances in gray and white.
- First, open your image in Photoshop.
- Create a new layer.
- Fill the layer with black, lower the opacity so you can see the original image below it, and use a white brush to fill in areas you’d like to accent in 3D. The black region is for areas with no light, furthest away (without depth), and white is for surfaces the light is hitting, nearest the camera (with depth). Shades of gray signify a medium distance between the subject and camera.
- Once your displacement map is complete, save it as a .PNG or .JPG.
- Now open After Effects, and import your original image and your displacement map.
- Open your displacement map image in a new comp.
- Add a Gaussian Blur to the displacement map image, setting the blurriness value to around 20 to 30. This will smooth out the 3D effect and allow it to blend more seamlessly with the initial image.
- Open the original image in a new comp, and drag the displacement map comp above it.
- Search for “Displacement Map” in the Effects & Presets, and apply it to the original image layer, which should again be below the displacement map layer.
- Adjust the Displacement Map effect so that the Displacement Map Layer is set to Layer 1 (the displacement map comp you created).
- For the “Use for Horizontal/Vertical Displace” parameters, set them both to Luminance.
- Add keyframes for “Max Horizontal/Vertical Displace” until you’re happy with the results!
How to Animate and Add Parallax to a 3D Projection
Now that you’ve got an understanding of how to create a displacement map, we’re going to look at expanding that with animation and even a bit of a parallax effect with After Effects’ 3D camera.When selecting a camera in After Effects, you’re given the option to choose a one-node camera or a two-node camera. If you’d like to learn about how each camera type operates, check out our breakdown here.
In the video below, David O’Dwyer walks through isolating a subject in Photoshop on a separate layer and using Content-Aware Fill to paint over where the subject was in the background, yielding a clean plate. He then creates a displacement map layer and paints over his subject’s masked layer (which has transparency).
He sets up the displacement map in After Effects (as we discussed earlier), but the key difference is the additional layer for the clean background plate. This will allow for achieving a bit of parallax when animating our subject.
You can skip to the 18-minute mark to see how you can adjust the background layer and add a 3D camera with a parented Null layer for animation control.This technique is so intricate, because not only is the camera moving through 3D space and generating a parallax, but you’re also able to make subtle three-dimensional adjustments to the subject’s facial features to coincide with the camera movement.
Projection 3D v2 (3D Projection Plugin)
If you’d like more of an automated way to achieve a 3D projection in After Effects from a 2D asset, you can use Projection 3D v2. This helpful After Effects plugin allows you to quickly generate a 3D effect without the need for creating a displacement map.
Additionally, it has several very useful features for building a depth-filled 3D projection, such as 3D plane generation that can give your 2D elements geometric 3D properties and create 3D surfaces. You can also automatically blur the edges of your 2.5D objects to make them look more natural in the scene. You can even export your assets as a .obj file straight out of the Projection 3D window in After Effects!This is a quick and effective technique that can create some truly creative shots. We hope this article will help you generate some new ideas for breathing life into 2D assets!