|
![](/i/fill.gif) |
I'd had a version of depth of field blur in my stochastic render rig for some
time, but there was something not quite right with it.
After some time, and reading Paul Bourke's website
(http://local.wasp.uwa.edu.au/~pbourke/modelling_rendering/povcameras/ and
http://local.wasp.uwa.edu.au/~pbourke/projection/stereorender/ helped the most)
I realised that I had made the classic blunder, and was moving the camera to
achieve focal blur, which gave me a focal point, and not a focal plane.
The correct solution, as Paul and others have pointed out, is to use a shear
operation (which POV-Ray supports via a transform { matrix <...> } line in the
camera { ... } declaration.
If you are looking down the z axis, then all you need is
camera {
transform { matrix <1, 0, 0, 0, 1, 0, rx, ry, 1, 0, 0, 0> }
...
}
where rx and ry are the amount of shearing that occurs, and therefore the amount
of depth of field blur.
If you are not looking along the z axis, then you need to transform the camera
so it is along the z axis, do the shear, then transform it back.
The results are exactly what I was after to start with, but had gotten wrong - a
nice clear focal plane, passing through the look_at point, and parallel to the
image plane.
Cheers,
Edouard.
Post a reply to this message
Attachments:
Download 'dof-shear-fixed.jpg' (153 KB)
Preview of image 'dof-shear-fixed.jpg'
![dof-shear-fixed.jpg](/povray.binaries.images/attachment/%3Cweb.48ad486a8ff8017fdbf7248f0%40news.povray.org%3E/dof-shear-fixed.jpg?preview=1)
|
![](/i/fill.gif) |