I want to make those Shallow Depth of Field type videos but don't have any expensive cameras. So can I make a video with my regular camera and just the blur the background in blender? Maybe with masking or something you know I don't want any chroma or something like that. What I want is to blur the already existing background in my video like a park, a room, a wall or anything.

  • 2
    $\begingroup$ How you do that with 3D graphics is with a Depth pass, which measures the distance from the camera. With standard footage, there is no accurate way to do this. $\endgroup$
    – J Sargent
    Jan 20, 2016 at 16:30
  • 1
    $\begingroup$ I think this is a perfectly valid question I vote to reopen. $\endgroup$
    – user1853
    Jan 22, 2016 at 2:45
  • $\begingroup$ Ok, do you have an answer? This is a very tough thing to pull off properly, as he wants to simulate DoF, not just blurring if I understand it correctly. $\endgroup$
    – J Sargent
    Jan 22, 2016 at 3:17
  • $\begingroup$ If it's a cheap way of doing things - which the question seems to impose - would be a cheap effect then blurring an image plate is pretty easy to do. Just add a plane and apply a shadeless material with the video sequence you have shot. And output those files to the compositor to be post process by a blur filter node ... that's all :) BUT BUT ... I suspect After effects would have been a better tool ... or the free version of fusion. $\endgroup$
    – hawkenfox
    Jan 22, 2016 at 5:13
  • $\begingroup$ @hawkenfox fusion would be easier, and certainly faster, but also doable in blender... $\endgroup$
    – user1853
    Jan 23, 2016 at 3:36

3 Answers 3


Yes, you can do it. There are two methods I can think of right off the bat:

  1. Use a Difference Key! This will NOT work if your camera is moving, but can give you decent results that don't require masking by hand. If your footage is from a stationary camera that was mounted to a stable tripod, you could take the difference of the background with no actors, and then the background with actors. Just take the time to shoot the background alone, and then bring your actors in for another shot without moving the camera at all (you might want to just let the camera record continually for both shots so you don't have to touch it).

A word of warning though: if your actors appear in color that is similar to the background footage, the mask will have lots of nasty holes in it. So don't wear blue shirts if your background is blue, etc.

Also, the backgrounds in both shots have to stay EXACTLY the same; I would avoid anything that moves like trees in the wind etc because they will ruin the Difference Key. Cheap cameras also tend to auto adjust exposure / brightness, and this will also ruin your Difference Key if this happens. A good rule is to shoot in a bright area and do not get too close to the camera or block the light from entering it in any way. Also, watch out for shadows because they WILL show up with your actors, and cannot easily be separated (unless you mask them out by hand or try some layer filter curves to block darker color values).

Using a Difference Key on the two pieces of footage, you can apply a blur effect to your background while preserving the focus of your actors. In the image below, I have simulated a background shot, and a background shot with an actor, and used the Compositor to achieve fake DOF. You can use the same node set up for your video footage! You could further tweak the layers in Compositor to get more specific results, but I wanted to keep the example as simple as possible so you can build on it however you like. Notice on the "Difference Key" node I turned "Tolerance" to "0.009". You will need to play with "Tolerance" and "Falloff" to see how it affects your video footage for best results! enter image description here

  1. Use Tracking and Masking, and patience. If your footage has spots that work well for tracking (high contrast areas that are stable) you could use masks in Blender like the guy in this Youtube tutorial explains, showing how he did it on a still photo, but this same technique can be used with video, even video from a moving camera if you can track and animate the mask for the subject. The difficulty level to get good results varies a lot depending on what you want to do, and how complex your subject / scene is. Tracking and masking is awesomely powerful, and the scope of it is beyond what I can answer right now. I will say though, you will have to plan your shots well if you want the best tracking results, even placing markers or using props to make things easier when working with the footage in Blender. For Masking, it helps if you know how to use the Pen Tool / Bezier curve handles. Knowing those tools is essential for making good masks. Best wishes!

To fake Shallow Depth Of Field (DOF) you can simply generate some gray scale images to drive a blur node. In fact there are some specific tools in the compositor to do just that.

Start with an image that allows you to hight-light a foreground element.

Before DOF effect

In the UV Image editor find the image (or if compositor setup already use a render) and switch to Mask Editor view. See bottom menu bar. Create a new circle mask around the foreground object, then Mask>Transform>Scale Feather or Alt-S to drag a feathered edge away from the shape. In this example I have edited the feather boundaries.

Create a mask in image viewer

Turn on the compositor and add an image input node and choose image or movie. If it is a movie you could track the mask shape to something moving in the shot (if so, create the mask in the movie clip editor).

Add a Bokeh Node to select the shape of the bur, add a Mask node and select the mask that you just created. Add a Bokeh blur node and input the earlier nodes, make sure that the mask is placed into the "size" socket. Then make sure that "Variable Size" is turned on.

Setup the compositor

If you want to create multiple levels of blur you could create multiple mask shapes and insert them into multiple blurs or perhaps add them to each other before the Bokeh Blur node.

And if you want to blur the foreground image just alter the mask colors via the invert button in the UV Image editor mask tool. It is the small triangle box next to the opacity value.

Blur result

  • $\begingroup$ Nice! You think a greyscale gradient for the background could also control the DOF for a nice smooth transition of far blurry and near sharpness? I think it would work if the gradient was right, and go really well with your masking. $\endgroup$ Jan 25, 2016 at 5:45
  • $\begingroup$ In this case the mask IS the greyscale. Of course you could also create actual masks to define fore mid and backgrounds. Be aware however that there would be bleed from one edge to another due to lack of light transport "around" each boundary. $\endgroup$
    – 3pointedit
    Jan 25, 2016 at 10:44

A combination of techniques will work well for you here. Remember that the goal is to recreate a depth of field based on distances via circles of confusion. This cannot be simulated without adding a degree of geometry to artificially craft the depth required, as is similar to 3D post production creation.

Assuming you have a raking vantage of some element such as a ground plane or along a wall, simulate the plane in 3D space from a base 3D tracking pass. Project from view across the frames such that the end image looks identical, but mapped along the rough geometry. You can cheat as much as is acceptable for a given shot.

Simpler rotoscoping to planes can fill in the void for deeper objects with little to no parallax. Couples walking in the distance. A pole here or there. A tree in the deeper BG.

From there, render using proper depth of field.

With a little elbow grease and attention to the most important elements in the shot to sell the effect, you can end up with some very solid results.

Here are some samples of a similar technique used to generate 3D in post production footage shot in 2D. Notice how they use a combination of rotoscoping and depth generation bases off of meshes.

2D plate Depth generation Geometry generation Rotoscope

Frames from jonnyelwyn.co.uk and creativecow.net.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .