Faking tilt-shift photography

Dear all,

I’m after some help to make a “fake” Tilt-Shift effect for a movie clip. Examples of Tilt-Shift can be found here. So far I’ve tried using Composite nodes with z-depth, color ramps. I’ve tried putting object going away from the camera and then making them transparent. Adding blur to a movie is no problem with Nodes. But doing a proper tilt shift means that a small part (let’s say a horizontal strip) should be perfectly in focus. Then going away from that strip it should get more de-focused the further away you go. That’s why I tried using a color ramp and tried to link the amount of blur to the colours.

Anyone tried this or have an idea? It’s actually for one of my student’s art projects so I’m very anxious not to let him down.

Thanks all!

there’s a specific node called ‘defocus’ under ‘filter’ that’ll let you add any amount of lens defocus effects. all you need is to set a depth of field for your camera (in the camera settings themselves), and hook up all the appropriate inputs and outputs. Also mouse-over all the tooltips, because not all the settings are immediately clear as to what they do, neccesarily.

The only way I can think of to imitate the Tilt-Shift defocus effect is to use the Blur filter in conjunction with separate graphic masks that are use to modulate the Strength of the Blur. These can even be drawn in Blender if you want to keep it all Blender-centric. By painting the masks in B&W, placing them via an Image node, and piping that to the Blur node’s Strength input, you can “paint” the blur effect, with pure white being a Strength of 1.0 and black being zero. It’s also likely you can place a Math node between the mask and the Blur to further modulate the Strength, using Multiply, Add, whatever seems to fit the bill.

By piping the Image through a succession of “masked” Blur nodes, each with different specs for X & Y blurring, you can probably achieve some very distinctive effects akin to a mild directional blur across the Image.

For really out-there effects, think about ways to animate the masks so the blurring effect can change over the length of a scene, kind of like a gonzo rack focus.

The Defocus node itself is pretty good for imitating depth of field but I don’t think it can be directly modulated to affect only certain areas of the image, as is done with Tilt-Shift focus effects. You’d have to use it in such a way that it would require masking and re-combining with the original sharply-focused image.

Is this for a still? If so it should be easy to do in post pro using photoshop or gimp.

I’d say, if you use a renderer which supports dof (such as Yafaray), you can just ‘overdo’ the dof. Testing of this hypothesis recommended.

springboarding from the link by noobie, you could use a blend texture as the factor for a defocus node.
then some hsv/curve adjustments. :yes:

edit: i did some tests

the rotoscoping job is bad :no:
but you get the idea…

i tried with the example image:

intersection tilt_shift.blend (276 KB)

I did this animated for video, by mapping image (sequence in my case) to a plane and using an orco camera with DOF and comp node blur. I distorted the plane with a grad or any texture. You can even paint the texture using paint tool to bring up individual foreground elelements. the DOF blur gives good bokeh while the graduation of the texture gives you actual depth (via distortion).

You can get good reults with tilting the plane too.

Thanks all, really, Thanks!

I’ve been at the 3D modelling malarky for many years, and can handle most vertex / edge / face / material scenarios. But nodes? They really have me stumped. Spacetug, a special thumbs-up to you my good friend, for providing the blend file. I had got all the way to the gradient jpeg being used as the Alpha mask for the blurring effect. I had absolutely no idea about using the RGB curves to control the blur. I was instead using the color ramp node and getting nowhere fast.

I will study your blend file, and add you to the list of the many gurus I owe a debt to. (Love the rotoscoping attempt on the chrysler building. Very cool!)

A quick question all:

I’ve tried Spacetug’s method for a jpg input, and it works beautifully. When I replace the image with a movie clip (I’m using a small .mov file) and then try to apply the same RGB curves, I get a black output in the composite window and the view window. If I take out the RGB curves node, and connect the input to the blur node, the movie does appear in the output nodes. Any ideas what might be going on?

^some good stuff, and a list of the nodes

a more useful page

as always, google, and read the manual :yes:

your last post, probably something is connected wrong, or it can’t fully handle the .mov format (i don’t know)
i will try some tests


works just fine for me
composite test.blend (579 KB)

oh, and by no means am i a guru.
most of what i learned was from looking at Ben Dansie’s stuff.

I must say, this one has me stumped at the moment. I have tried with a jpeg to apply the blur using the gradient texture as a mask, and it works beautifully.

Simply substituting the image with a movie results in a black render.


If I remove the RGB Curves node, the movie is visible on the render, but of course the blur is applied uniformly across the whole movie, thus defeating the whole exercise! Are there any pointers as to what I have done wrong?

I did try the composite test.blend file, but that didn’t really have anything to do with blur!!!

Again, I am your humble student…

i duplicated (nearly) your setup.

at first, it did what you were talking, but i kept playing around with it for a few minutes, and all of a sudden, for no reason, it worked! :eyebrowlift2:
sounds like a bug to me…

composite test2.blend (571 KB)

the only difference i can see, besides the rgb curve points, is that i have the number of frames on the input set to 100, which is the length of my “movie”

on a cheerier note, it looks like your movie was rendered with blender, and you could just use that .blend, and do the compositing in that.

Thanks for the input. The movie I need to tilt-shift is unfortunately not a blender file, but a movie shot using a camera. I used a rendered movie to test the theory that Blender was having a problem with the codecs installed, therefore I used a movie that blender had created.

I actually solved the problem in a slightly different way: Seeing as I could tilt-shift images (according to your intersection setup, I took a sample movie, put it in the sequence editor and rendered the sequence as separate images. I then went into the nodes, and rather than putting in “movie” in the input node, I chose “sequence”. I then pointed it towards the folder with all the rendered pictures. I then re-rendered the sequence from the pictures back into a movie. I tested it, and although it was very slow, it worked wonderfully.

The only thing I’ll have to do is to match the original movie fps rate so as not to mess up the speed of the movie.

I’ll still mess around with the movie input in nodes, as I would love that to work as well. Thanks again Spacetug, your time and effort was well appreciated.

Certainly new movie format CODECs seem to cause Blender some trouble here and there. I have used a plain QT file in the Nodes Comp window with success though.


i think, however, that handbrake can convert .mov into other formats (GPL’d), which would probably be faster.

I just tested your setup Spacetug and had the same problem as Smadahar.

I found out that it had everything to do with the render output size. It was 600x600 and my movie or image had a different size. When I adjusted the rendersize to my own input (image/movie) it worked!

Thanks for sharing your blendfile.