[Bf-committers] Patch for controlling Cycles DOF with f/stops

Ejner Fergo ejnersan at gmail.com
Sun Mar 4 14:35:33 CET 2012

Hola all,

I made a patch that enables the use of f/stop numbers to control DOF in Cycles:


I tried to make it as non-invasive as possible and luckily the formula
is very easy (radius=focal/F#*0.5), but I would appreciate any
comments on the code as this is still new to me. Hope the small size
and changes makes it acceptable.

In the beginning I was a little confused about the aperture size being
in radius instead of diameter, and while I don't doubt Brecht, my
initial tests were not super conclusive. So I just made a new test
with the largest lens aperture I have (F/3.5) and it definitely looks
like the radius is correct, but you be the judge :) (excuse the
primitive modelling - the point is to check the bokeh, not


Tomorrow or tuesday I'll get a new lens that is very fast (F/1.4) and
will make new test images that will hopefully be a bit more
"scientific" and useful for documentation.

Hope you will find this as useful as I do!

Best regards,
Ejner Fergo

More information about the Bf-committers mailing list