POV-Ray : Newsgroups : povray.unofficial.patches : MCPov Depth of Field Server Time
10 Dec 2024 17:03:33 EST (-0500)
  MCPov Depth of Field (Message 1 to 3 of 3)  
From: clipka
Subject: MCPov Depth of Field
Date: 11 May 2009 15:05:00
Message: <web.4a0875d49cf7dfcd2c873ec30@news.povray.org>
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?


Post a reply to this message

From: Ive
Subject: Re: MCPov Depth of Field
Date: 12 May 2009 07:10:58
Message: <4a095942@news.povray.org>
clipka 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.

-Ive


Post a reply to this message

From: clipka
Subject: Re: MCPov Depth of Field
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.