POV-Ray : Newsgroups : povray.unofficial.patches : MCPov Depth of Field : Re: MCPov Depth of Field Server Time
20 Apr 2024 05:17:35 EDT (-0400)
  Re: MCPov Depth of Field  
From: clipka
Date: 12 May 2009 12:20:01
Message: <web.4a09a19fddc8bd2f708085d0@news.povray.org>
Ive <"ive### [at] lilysoftorg"> wrote:
> > I'm experiencing problems with MCPov's depth of field.
> >
> > I basically use the following code:
> >
> > #local CameraLocation   = <80,31,-80>;
> > #local CameraLookAt     = <0,9,-10>;
> > #local CameraDirection  = CameraLookAt - CameraLocation;
> > #local CameraAngle      = 25;
> > #local AspectRatio      = image_width/image_height;
> >
> > global_settings {
> >   montecarlo {
> >     mc_dof {
> >       mc_focal_distance vlength(CameraDirection)
> >       mc_lens_radius 0.5
> >     }
> >   }
> > }
> >
> > camera {
> >   perspective
> >   up        y
> >   right     -x*AspectRatio
> >   location  CameraLocation
> >   look_at   CameraLookAt
> >   angle     CameraAngle
> > }
> >
> > Strangely enough, the look_at point is clearly *not* in focus.
> >
> > What's wrong?
> >
>
> I guess nothing with your code. Coincidently I just stumbled above the
> same issue where in my scene the vlength calculation for
> mc_focal_distance did result in 67.77 but actually I had to use 90.5 -
> as I did find out after a lot of time consuming trial and error.
>
> So *maybe* multiplying the real focal distance by a factor of ca. 1.35
> does work. But I'm currently too bored to verify this with MCPov.

It seems to me that MCPov's DOF code presumes that the camera perspective is
solely controlled by the "up", "right" and "direction" parameters, and is
totally oblivious of the "angle" parameter.

I found that multiplying the intended focal distance by
(right_length/2)/tand(angle/2) does the trick (where "right_length" is the
length of the "right" camera parameter).

To make life easier, it's helpful to set "right" to have a length of 1, applying
the aspect ratio correction to "up" instead (I'm using "angle" to specify the
field of view anyway, so it doesn't hurt).

This is particularly useful in getting the intensity of the blur effect stable
even when aspect ratio changes, as there is some impact on this parameter as
well; unfortunately I wasn't able to find a proper correction factor for this
parameter yet.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.