POV-Ray : Newsgroups : povray.advanced-users : Focal Blur Server Time
1 Jul 2024 06:16:31 EDT (-0400)
  Focal Blur (Message 1 to 9 of 9)  
From: Reactor
Subject: Focal Blur
Date: 3 Aug 2008 23:05:00
Message: <web.4896717ca2356e99c90c6aa70@news.povray.org>
I do a lot of photography, and setting up the camera in POV as a 35mm helps me
think of better ways to position the camera for animations.  As a result, I
have been working on a short macro to help me quickly set a camera in POV based
on real world 35mm settings.  However, I have hit an odd roadblock regarding
focal blur:
From the documentation:

> To turn on focal blur, you must specify the aperture keyword followed by a float
> value which determines the depth of the sharpness zone. Large apertures give a
> lot of blurring, while narrow apertures will give a wide zone of sharpness.

> Note: while this behaves as a real camera does, the values for aperture are
> purely arbitrary and are not related to f-stops.

Uh oh.  So... does anyone know what the values do relate to?


-Reactor


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Focal Blur
Date: 4 Aug 2008 08:48:59
Message: <4896fabb$1@news.povray.org>

>> Note: while this behaves as a real camera does, the values for aperture are
>> purely arbitrary and are not related to f-stops.
> 
> Uh oh.  So... does anyone know what the values do relate to?

  To me, "purely arbitrary" means that they are not related to anything at 
all. But some trial & error, plus visual comparison with real photos, 
perhaps can give you the relation with f-stops.

   Regards,

--
Jaime


Post a reply to this message

From: Leroy Whetstone
Subject: Re: Focal Blur
Date: 4 Aug 2008 14:35:22
Message: <489768AE.9030803@joplin.com>
Have you tried  http://www.wozzeck.net/images/DoF.html


Post a reply to this message

From: Reactor
Subject: Re: Focal Blur
Date: 4 Aug 2008 16:20:00
Message: <web.489763983d3f48e7c90c6aa70@news.povray.org>
Leroy Whetstone <lrw### [at] joplincom> wrote:
> Have you tried  http://www.wozzeck.net/images/DoF.html

I have already looked at it, and it does do something very similar to what I
want, but is still on arbitrary values.

To Jaime:
I should have been more clear.  I interpreted arbitrary to mean that it was
simply a convenient selected unit not based on a real world value.  What I am
actually looking for is what the aperture value does internally, such as its
relation to the angle the blur sample rays will be shot.


-Reactor


Post a reply to this message

From: Tim Attwood
Subject: Re: Focal Blur
Date: 5 Aug 2008 21:12:32
Message: <4898fa80@news.povray.org>
> I have already looked at it, and it does do something very similar to what 
> I
> want, but is still on arbitrary values.

The origin of a ray is perturbed semi-randomly X,Y along the "film",
from there it passes through the focal point until it has some
color from raytracing the scene. Aperture controls the amount of
random displacement of the origin of the ray. Each final pixel on
the "film" is the weighted average of the sample rays cast. At certain
sample sizes the displacement pattern is pre-set to provide a good
hexagonal grid, as more samples are used they are added randomly
positioned in addition to the pre-set grids. So for example if you
have 50 samples, 37 of the samples will be the largest pre-set
pattern, and 13 samples will be random patterned. In general the
pre-set patterns are weighted so that rays that are displaced farther
from the actual pixel origin have less contribution to the final pixel
value. That's why it's considered arbitrary, the falloff data comes
from an array instead of a function.
Overall it's close to being recpirocal of displacement distance.

Unfortunately this means that there is no easy way to set DoF without
accounting for differences based on samples, and general POV scales.

The results are also not diminished in luminance over distance
like with a RL camera, so far away blurred objects can look brighter.


Post a reply to this message

From: Reactor
Subject: Re: Focal Blur
Date: 5 Aug 2008 23:35:00
Message: <web.48991aa93d3f48e7bf3475910@news.povray.org>
"Tim Attwood" <tim### [at] comcastnet> wrote:
> > I have already looked at it, and it does do something very similar to what
> > I
> > want, but is still on arbitrary values.
>
> The origin of a ray is perturbed semi-randomly X,Y along the "film",
> from there it passes through the focal point until it has some
> color from raytracing the scene. Aperture controls the amount of
> random displacement of the origin of the ray. Each final pixel on
> the "film" is the weighted average of the sample rays cast. At certain
> sample sizes the displacement pattern is pre-set to provide a good
> hexagonal grid, as more samples are used they are added randomly
> positioned in addition to the pre-set grids. So for example if you
> have 50 samples, 37 of the samples will be the largest pre-set
> pattern, and 13 samples will be random patterned. In general the
> pre-set patterns are weighted so that rays that are displaced farther
> from the actual pixel origin have less contribution to the final pixel
> value. That's why it's considered arbitrary, the falloff data comes
> from an array instead of a function.
> Overall it's close to being recpirocal of displacement distance.
>
> Unfortunately this means that there is no easy way to set DoF without
> accounting for differences based on samples, and general POV scales.
>
> The results are also not diminished in luminance over distance
> like with a RL camera, so far away blurred objects can look brighter.


Interesting... for some reason, I am more intrigued than anything else.  I do
think I still may be able to fake things, but this also interests me from an
improvement and development standpoint for 4.0.

-Reactor


Post a reply to this message

From: Blue Herring
Subject: Re: Focal Blur
Date: 6 Aug 2008 08:17:29
Message: <48999659$1@news.povray.org>
Tim Attwood wrote:
> The origin of a ray is perturbed semi-randomly X,Y along the "film",
> from there it passes through the focal point until it has some
> color from raytracing the scene. Aperture controls the amount of
> random displacement of the origin of the ray. Each final pixel on
> the "film" is the weighted average of the sample rays cast. At certain
> sample sizes the displacement pattern is pre-set to provide a good
> hexagonal grid, as more samples are used they are added randomly
> positioned in addition to the pre-set grids. So for example if you
> have 50 samples, 37 of the samples will be the largest pre-set
> pattern, and 13 samples will be random patterned. In general the
> pre-set patterns are weighted so that rays that are displaced farther
> from the actual pixel origin have less contribution to the final pixel
> value. That's why it's considered arbitrary, the falloff data comes
> from an array instead of a function.
> Overall it's close to being recpirocal of displacement distance.
> 
> Unfortunately this means that there is no easy way to set DoF without
> accounting for differences based on samples, and general POV scales.
> 
> The results are also not diminished in luminance over distance
> like with a RL camera, so far away blurred objects can look brighter.

Very interesting.  Do you know what these "certain" sample sizes are? 
Is there any benefit (performance or otherwise) to using certain 
blur_samples values?  (I'm thinking of how there are certain "optimal" 
values for adaptive area light sizes.)

-- 
-The Mildly Infamous Blue Herring


Post a reply to this message

From: Tim Attwood
Subject: Re: Focal Blur
Date: 6 Aug 2008 19:47:20
Message: <489a3808@news.povray.org>
> Very interesting.  Do you know what these "certain" sample sizes are? Is 
> there any benefit (performance or otherwise) to using certain blur_samples 
> values?  (I'm thinking of how there are certain "optimal" values for 
> adaptive area light sizes.)

The grids contain 4, 7, 19, and 37 values.

grid1 (4 values, square)
  {-0.25,  0.25},
  { 0.25,  0.25},
  {-0.25, -0.25},
  { 0.25, -0.25}

grid2 (7 values, hexagonal)
  {-0.288675,  0.000000},
  { 0.000000,  0.000000},
  { 0.288675,  0.000000},
  {-0.144338,  0.250000},
  {-0.144338, -0.250000},
  { 0.144338,  0.250000},
  { 0.144338, -0.250000}


grid3 (19 values, hexagonal)
  {-0.192450,  0.333333},
  {-0.192450, -0.333333},
  { 0.192450,  0.333333},
  { 0.192450, -0.333333},
  { 0.384900,  0.000000},
  {-0.384900,  0.000000},
  { 0.000000,  0.000000},
  { 0.000000,  0.333333},
  { 0.000000, -0.333333},
  {-0.288675,  0.166667},
  {-0.288675, -0.166667},
  { 0.288675,  0.166667},
  { 0.288675, -0.166667},
  {-0.096225,  0.166667},
  {-0.096225, -0.166667},
  { 0.096225,  0.166667},
  { 0.096225, -0.166667},
  {-0.192450,  0.000000},
  { 0.192450,  0.000000}


grid4 (37 values, hexagonal)
  { 0.000000,  0.000000},
  {-0.216506,  0.375000},
  { 0.216506, -0.375000},
  {-0.216506, -0.375000},
  { 0.216506,  0.375000},
  {-0.433013,  0.000000},
  { 0.433013,  0.000000},
  {-0.144338,  0.250000},
  { 0.144338, -0.250000},
  {-0.144338, -0.250000},
  { 0.144338,  0.250000},
  {-0.288675,  0.000000},
  { 0.288675,  0.000000},
  {-0.072169,  0.125000},
  { 0.072169, -0.125000},
  {-0.072169, -0.125000},
  { 0.072169,  0.125000},
  {-0.144338,  0.000000},
  { 0.144338,  0.000000},
  {-0.360844,  0.125000},
  {-0.360844, -0.125000},
  { 0.360844,  0.125000},
  { 0.360844, -0.125000},
  {-0.288675,  0.250000},
  {-0.288675, -0.250000},
  { 0.288675,  0.250000},
  { 0.288675, -0.250000},
  {-0.072169,  0.375000},
  {-0.072169, -0.375000},
  { 0.072169,  0.375000},
  { 0.072169, -0.375000},
  {-0.216506,  0.125000},
  {-0.216506, -0.125000},
  { 0.216506,  0.125000},
  { 0.216506, -0.125000},
  { 0.000000,  0.250000},
  { 0.000000, -0.250000},


Post a reply to this message

From: Blue Herring
Subject: Re: Focal Blur
Date: 8 Aug 2008 07:56:00
Message: <489c3450$1@news.povray.org>
Tim Attwood wrote:
> The grids contain 4, 7, 19, and 37 values.
<snip>

Thanks!  Though, I'm not sure I know how to apply this information.  I 
probably will have to take a look at the source code.

-- 
-The Mildly Infamous Blue Herring


Post a reply to this message

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