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.
Yes, you can do it. There are two methods I can think of right off the bat:
- 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!
- 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.
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.
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.
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.
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.
Frames from jonnyelwyn.co.uk and creativecow.net.