Hic Sunt Dracones

Fake Miniatures in darktable

Posted on Thursday, March 13, 2014
in Category Howto

Faking the looks of a miniature shot with its shallow depth of field is quite easy in raster image editors like GIMP, but sometimes you might want to do that step directly inside of darktable. While that is not as flexible and fast for single images when you have a complicated composition in your photo and need to work pixel perfect it can however save you a lot of time for simple scenes and when you have to apply the same editing steps to a big number of images, for example when doing a timelapse.

the photo I am working with, only default modules applied the photo I am working with, only default modules applied

In order to pull off a convincing job the photo you are working with should have a fairly wide view, some objects of interest in the middle ground and not too many overlaps of objects with different distances from the camera. Ideal is a view from some high point on a relatively flat area.

I am going to use a not-quite ideal photo to show different techniques and where a tool like GIMP has benefits.

As we can see the image has something to focus on in a medium distance from the camera, a relatively flat ground, and the view isn’t too narrow either. However the sitting people are overlapping parts of the pavement that is much farther away from the camera which we have to deal with somehow.

exposure and saturation changed exposure and saturation changed

In a first step I am fixing the exposure and adding quite some saturation to make it look more like an artificial miniature world.

Next I am enabling the lowpass module in the effects group, setting the blur radius to 15. In order to keep the man on the bench in focus I add a first bézier mask in the form of a rectangle with a falloff that is wider on the bottom to simulate a shallow depth of field. By default that would lead to a blurred region in the middle of the image with the rest untouched. That’s not exactly what I want, so I enable invert mask in the module settings.

the mask for the ground the mask for the ground

Due to the aforementioned overlap of man and background I also have to mask him out, so I add a second bézier mask and try to trace around him, playing with the falloff size where I have to. With this image it’s possible to do that, even though it would have been easier in GIMP where layer masks allow working really precise. The resulting mask should exclude everything with the same distance from the camera and thus be in focus.

preview of the mask for the in-focus area preview of the mask for the in-focus area

The result isn’t that bad if my sloppy work with masking out the guy is ignored. If you invest more time it could be done much better.

result with just one instance of lowpass result with just one instance of lowpass

Since objects that are further away from the camera are blurred more I add a second instance of the lowpass module with a radius of 30. To mask out the center part I add two gradient masks. They can be dragged on the canvas, and the falloff can be changed with the mouse wheel – just as with other mask types.

preview of the gradient masks for the big blur preview of the gradient masks for the big blur

For simpler scenes without overlapping or if less blurring is used this is a quick and copy&pasteable way of adding a miniature effect to image sequences. In this case it would be borderline as the man would probably be moving so a tracking mask would be needed, something darktable doesn’t support (yet). For static landscape scenes it’s a viable option though.

final result with two passes of blurring final result with two passes of blurring

If you want to try it yourself you can download the raw file and the XMP of my result to play around with.

In case you didn’t notice: you can click on all the images to see them bigger.

Update: I replaced the final version with a less sloppy one. The raw+XMP package got updated.

Update2: Tobias made a nice video using this technique!