|
![](/i/fill.gif) |
"Samuel Benge" <stb### [at] hotmail com> wrote:
> "Edouard Poor" <pov### [at] edouard info> wrote:
> > 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.
>
> This is useful information! Thanks! I occasionally mess around with averaged
> frames, and I can get a certain kind of focal_blur by moving the camera
> around... but this looks even better :)
Thank-you! I'm glad someone found it useful.
Attached is my test object with focal blur using the technique above - I'd
posted one a few days ago, but this one has the corrected focal blur, and does
look a little better for it.
This image also has anti-aliasing done by moving both the camera and look_at
points by a sub-pixel distance in x and y based on a random gaussian function.
Not having anti-aliasing per frame I'm rendering speeds things up quite
noticeably.
The code adds the following over what I posted above:
//This macro created by Rico Reusser <reu### [at] chorus net>
#declare e = 2.718281828459;
#macro Gauss(RSR)
sqrt(-2*log(rand(RSR))/log(e))*cos(2*pi*rand(RSR))
#end
#declare cam_location = <-14, 16, -20>;
#declare look_location = < 0, 2.8, 0>;
#declare eye_direction = look_location - cam_location;
#declare rot_angle = VAngleD(z, eye_direction);
// -- Anti-aliasing emulation ---------------------------
#declare aa_scale = 1/ ( image_width / 6 );
#declare rot = rand(s) * 360;
#declare g = Gauss( s );
#declare offset_vec = < sin( rot ) * g, cos( rot ) * g, 0 >;
#if ( rot_angle = 0 )
#declare aa_offset = offset_vec;
#else
#declare aa_offset = vaxis_rotate(offset_vec, vcross(eye_direction, z),
-rot_angle);
#end
// -- Camera declaration (already using focal_blur calculations) --------
camera {
perspective
transform {
translate look_location * -1
Reorient_Trans( eye_direction, z )
matrix <1, 0, 0, 0, 1, 0, rx, ry, 1, 0, 0, 0>
Reorient_Trans( z, eye_direction )
translate look_location
}
location cam_location + (aa_offset * aa_scale)
look_at look_location + (aa_offset * aa_scale)
angle 20
right x * 1
up y * image_height/image_width
}
The next big challenges (and I'm not sure I'm quite up to the task - maths is
not my strong point) is to define the focal blur in terms of the aperture for
the angle of the camera (i.e. the "lens"), and to automatically set the
aa_scale value based on the camera angle, camera to look_at distance, and image
size being rendered.
> Sam
Cheers,
Edouard.
Post a reply to this message
Attachments:
Download 'dof-shear-test-object.jpg' (54 KB)
Preview of image 'dof-shear-test-object.jpg'
![dof-shear-test-object.jpg](/povray.binaries.images/attachment/%3Cweb.48ae80c590c1c695dbf7248f0%40news.povray.org%3E/dof-shear-test-object.jpg?preview=1)
|
![](/i/fill.gif) |