Focal blur made easy!
Version franšaise

balls.jpg [63k]

What is it about?

In POV-Ray 3.x, focal blur can be achieved using the following camera commands:

camera {
...
focal_point ...
aperture ...
blur_samples ...
confidence ...
variance ...
}

The two first parameters, especially the second, are a bit tricky to set up properly, thus involving a lot of trial-and-error to find the proper values.

So what?

Being tired of this situation, I picked some common photographic formulas concerning the relations between focal length, aperture, distance and depth of field. After a two hours cooking in POV-Ray 3.1, I came to a much easier way to describe the needed depth of field, quite close to what Canon introduced in their low end SLR camera bodies as the "DEPTH" mode.

The little macro used just calculates the right focal_point and aperture values so that a couple of given points in the image are the limits of the sharp zone. Between them, the area will remain sharp, and outside, it will progressively blur.

To call the macro, just #include the plug-in, and, instead of providing the two difficult parameters, call the DoF macro:

#include "DoF.inc"
...
camera {
...
DoF (location, width, angle, look_at, 1st point, 2nd point)
blur_samples ...
confidence ...
variance ...
}

The values for location, angle, and look_at are the same as those provided to the camera (which still need to be provided).
the width parameter is the width of the rendered picture, in pixels. It is used to determine the amount of blur. The resulting picture is likely to seem "too sharp". So do not hesitate to decrease the value to get stronger effects.
The 1st point and 2nd point vectors are the coordinates of the two extreme sharp points.

Download

Click here to download the archive including the plug-in, its documentation and an example file:

DoF.zip (6.9 kb)


Background: strongly blurred picture of a Leica Elmarit M 21mm f/2.8 asph. lens
This page is (c) 1998 F.Dispot