Have you seen those awesome 3D photos in your Facebook news-feed lately? In this post, you’ll learn how to manually create one from scratch on your computer using Photoshop. We even include a free Photoshop template you can use for creating a depth map. (A depth map is the secret sauce for creating a 3D image on Facebook.)
Facebook 3D photo overview
In late 2018, Facebook announced the 3D photos feature, which allowed iPhone users (supposedly works on other phones too, but the feature doesn’t seem to exist on the phones we tested) to upload images that look three dimensional as you scroll down your news-feed. The feature was limited to pictures taken from the iPhone’s camera, in portrait mode.
Now, they have expanded on this feature to allow anyone to manually create a Facebook 3D photo from their PC, even if you don’t have an iPhone or other compatible device. In order to do this, you need to create a depth map of your image. What is a depth map? It’s a black & white image that uses grey-scale value to represent distance between the camera and the object. The darker areas are further away from the camera, while the lighter areas are closer to the camera.
The iPhone portrait mode actually creates a depth map channel (behind the scenes) when a picture is taken, and that’s how it is able to blur the background. Facebook’s 3D photo generator takes that depth map and uses it in its own algorithm to create the 3D photo. Now that Facebook has expanded this feature, you’re able to upload your own depth map from your computer, without needing an iPhone. This opens up a TON of possibilities for creative 3D photos.
How to Create a Facebook 3D Photo
- Take a source image – The best types of images for a 3D photo have a clear foreground, subject, and background. It’s easier if your image is made up of large surfaces on solid objects. Things like tree branches, hair, or cluttered images with many objects placed at many different distances will make it harder to use.
- Create a depth map image – A grayscale depth map image, with darker areas representing objects far away, and lighter areas representing things close to the camera. (You’ll learn how to create one in the tutorial below.)
- Change depth map filename – Append the depth map image filename with
_depth. So if your file name was
image.png, it should now be
- Upload Images – Drag and drop both files into a new Facebook post. That’s it! Facebook does the magic to create the 3D photo.
You’ll know it worked because you’ll see a progress indicator that says “Creating a 3D Photo”, with the 3D loading icon. If you don’t see that, you might simply see two images uploaded, which means Facebook didn’t recognize that you intended to create a 3D photo. If that happens to you, make sure you comply with the following:
- Both images need to be of the same file type. Either JPG, or PNG. Choose one type, and make the image and the depth map the same.
- Both image files need to start with the same filename. (Remember, the depth map image needs
_depthadded to the end of the filename. For example, if your main image is named
image.png, your depth map needs to be named
- Both images need to have the same aspect ratio. But it’s ok if they have different resolutions.
Depth Map Image Methods
The depth map is clearly where the magic happens, so how the heck do you go about creating one? There are several approaches you can take.
- (Intermediate) You could use a 3D modeling program like SketchUp to create a 3D model of the objects in your image, then render out a depth map using the fog setting.
- (Advanced) Google things like “depth map from stereo images“, “photogrammetry depth map“, or “automatic depth map generator“ and find rabbit holes such as this, this, or this python programming tutorial on how to create a depth map from stereo images. For some reason, most of those sites are WAAAYYY too technical, and seem to be written in the early 2000’s.
- (Easy) Manually create a depth map using Photoshop. YES! This is the winner! 🙂 🙂 🙂
How to create a depth map in Photoshop
Before we create a depth map from scratch, it’s worth noting that you really don’t need to be super accurate here. If you look closely at a 3D photo, there’s a lot of fudging and blurring going on by the 3D Photo generator, so it’s not worth spending a ton of time being super picky.
There are several ways you could go about creating a manual depth map. You could brush over the image freehand on a new layer, using different shades of grey to indicate depth. The workflow we’re going to describe here is just one way to do it. So feel free to modify this workflow as you see fit.
Choosing an image
The best images for 3D Photos have a clear foreground, midground, and background. It’s easiest to create depth maps for objects that have surfaces that are perpendicular to the camera’s perspective. This is because those surfaces can be painted a solid color, so the surface will be represented as being a set distance away from the camera. Surfaces that extend away from the camera, like landscapes, look better when you use a gradient on their surfaces. That can be a little tricky, but we will share some tips for working with these surfaces.
In this tutorial, we will use this image of Half Dome. You can download this image, along with a Photoshop template for creating a depth map at the bottom of this post.
Defining your depths of field
In this example, we will create 5 depths of field, but you can create as many or as few as you want. We will have one layer for each depth of field, starting with black, and getting lighter until we get to pure white. We will start out with solid colors, then we will feather the colors as needed, once we have the shapes roughed out. You can create a new template from scratch, or download our free template at the bottom of this post.
- Create a new layer
SHIFT + CTRL + Nor
SHIFT + COMMAND + N.
- Set Foreground Color to black.
- Activate Paint Bucket tool
G, click in canvas to fill entire layer.
- Repeat until you have 5 layers, with 5 different shades of gray.
TIP: When picking a color for each shade of gray, type in either 0, 25, 50, 75, or 100 in the
Add reference image layer
You should now have 5 layers, each filled with a shade of gray, with the lighter layers above the darker layers. Next, you’ll insert your reference image.
- Go to File > Place Embedded to insert your reference image on top of the gray layers.
- Set the opacity of your image to 50%, so you’ll be able to see the layers below as you work on them.
- Hide all the gray layers, except for the black layer. We’ll start with the furthest objects, and work our way forward to the foreground.
Set background gradient
As you work through each layer, remember that each layer will cover the next one, so you don’t need to mask any areas that will be covered by any of the layers above it. For the background layer, that means we can fill the entire layer with color, because everything else will be in front of the sky.
The area of this photo that is furthest away from the camera would be the sky, so we will use the black layer to create a depth map representing the sky. You could leave the entire layer black, but that would leave the sky looking really flat. Instead, let’s create a gradient, that will make the clouds at the very top of the picture appear closer than the clouds that are further away.
- Activate the Black layer. (This is where you will draw the gradient for the sky.)
- Activate the Gradient tool
G(You can press
SHIFT + Gto cycle through the paint bucket and gradient tool.)
- Click on the Gradient Swatch to edit the gradient.
- Select the Black & White Gradient preset.
- Edit the White color stop and set “L” to
75. This will keep the sky a little deeper than our foreground elements.
- Draw the gradient from the top, downwards, while holding
SHIFTto keep the gradient parallel to the horizon. Toggle the image layer to see the results.
Trace hard depth limits
Hard depth limits are where the edges of an object exist in the image; edges that sharply separate the object from the background. For example, a person standing in front of a landscape would require a hard depth limit traced around their profile to separate them from the background.
In our example, the mountains require a hard depth limit around them where they meet the sky. Within the mountains themselves, you can identify several hard depth limits at ledges and cliffs, where features are clearly separate from those behind it. Your job is to decide which layer you want each feature to reside on, and cut those shapes out of the layers you want them to belong to.
To create these hard depth limits, you can use one of the many selection tools in Photoshop, like the Quick Selection tool or the Magnetic Lasso tool, to create a selection outlining the profile of the object you want to place on the dark gray layer. Remember, Half Dome and the other foreground landscape will be on a more forward layer, so you don’t need to worry about tracing over them.
- Activate the image layer. (You need to have the image layer active in order to create the selection using the smart selection tools, unless you have “Sample All Layers” enabled.)
- Activate the Quick Selection tool.
- Trace around the mountains in the background. Ignore the trees, the Half Dome in the foreground, or anything else that is closer to the camera.
- With the selection active, activate the Dark Gray layer, and add layer mask.
The mask is helpful because it sets the hard limits of the layer, while allowing us to go back later and edit the contents of the layer without worrying about messing up the profile we just created. You may find it helpful to save the selection by going to Select > Save Selection, just in case you need to recall the selection later.
If you find that you need to adjust the hard limits of the layer, you can always select the layer mask in the layers panel, and use a black/white brush to touch up the edges.
Find hard limits for all depths
Repeat this process for the rest of the layers. For finer detail things like hair or tree branches, you might be better off duplicating the image layer and using the background removal tool, instead of creating a layer mask. Another approach you could take is to use the select by color range, if the foreground elements are a distinct color.
You should end up with something like this: (Notice how I got sloppy with the foreground trees? This won’t matter too much once it’s converted to a 3D photo, but it’s up to you how precise you want to get.)
Add detail to layers
You could export the layers as-is, and a 3D photo would be created. However, each layer would look very flat, and there would be a sharp drop-off where each layer transitions to the next. This look is very similar to the classic Walt Disney Multi-plane camera effect.
If you’d like to add more texture and depth to each layer, you can do so manually. It will also reduce the blur at the edges of each profile if you blend the colors to closely match. Here are some tips for manually adding texture to each layer.
- For large areas like the mountains, that gradually go off into the distance, start the edit by creating a gradient on the layer. A gradient basically shifts the depth plane on an angle. You want to make sure your color stops are half way between the current layer color, and the colors of the layers adjacent to it. Otherwise, you’ll make the depth extend beyond the original intended distance. Basically, try to keep the color range within the original scale of gray the layer was set to.
- For sharp changes in direction within a single layer, you can use the Lasso tool to isolate a certain part of the layer, then apply the gradient tool to it. Remember, the gradient direction should do darker towards the furthest point.
- If you want to manually dodge & burn high and low spots, you could follow this tutorial to non-destructively dodge & burn. Or, you can simply use the dodge & burn tools in Photoshop.
- Sometimes, you can blend parts of the actual image as a depth map overlay. You should be careful with this though, because darker areas of an image do not necessarily mean they are further away, but sometimes it works. For example, copying the sky onto a layer set to luminosity blend mode will add subtle cloud texture to the depth map. Be careful though, dark clouds will actually make them look depressed and far away. You might need to invert the colors.
When you’re all done, you should have something like this:
This depth map will create a 3D photo like the following. Notice how each layer has subtle depth and texture to it. I hope you enjoyed this tutorial! Go out there and create awesome Facebook 3D photos!
If you’d like to download the sample files for this tutorial, unlock the download by helping us spread the word!