POV-Ray : Newsgroups : povray.programming : additional focal blur related option in camera Server Time
2 May 2024 10:00:44 EDT (-0400)
  additional focal blur related option in camera (Message 1 to 8 of 8)  
From: Raf256
Subject: additional focal blur related option in camera
Date: 26 Nov 2005 09:43:57
Message: <st8m53-nt.ln1@raf256.com>
Hi, 
I was thinking of adding more options that controll how meany rays are taken
when rendering with focal blur.

I would like to add additional parameter, like min_samples, I want it to
behave simmilar to max_samples (when parsing), and I need to access it from
render.cpp.

What exacly should I change in the sources/where?

-- 


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: additional focal blur related option in camera
Date: 26 Nov 2005 10:16:33
Message: <43887c51$1@news.povray.org>
Raf256 wrote:
> Hi, 
> I was thinking of adding more options that controll how meany rays are taken
> when rendering with focal blur.
> 
> I would like to add additional parameter, like min_samples, I want it to
> behave simmilar to max_samples (when parsing), and I need to access it from
> render.cpp.
> 
> What exacly should I change in the sources/where?

Nothing. You just need to read the manual. You are looking for "confidence" 
and "variance"...
<http://www.povray.org/documentation/view/3.6.1/248/>

	Thorsten


Post a reply to this message

From: Raf256
Subject: Re: additional focal blur related option in camera
Date: 26 Nov 2005 10:49:16
Message: <incm53-upv.ln1@raf256.com>
Thorsten Froehlich <43887c51$1@news.povray.org> Saturday 26 of November 2005
16:16

> Nothing. You just need to read the manual. You are looking for
> "confidence" and "variance"...
> <http://www.povray.org/documentation/view/3.6.1/248/>

Controling of number of rays is just one of things Im trying to implement
here. 

Thanks, I know about thoes settings, but IMHO they do not work as expected
in some situations, Im testing it now...

-- 


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: additional focal blur related option in camera
Date: 26 Nov 2005 11:05:42
Message: <438887d6$1@news.povray.org>
Raf256 wrote:
> Controling of number of rays is just one of things Im trying to implement
> here. 
> 
> Thanks, I know about thoes settings, but IMHO they do not work as expected
> in some situations, Im testing it now...

They do, it is just that the statistical methods they are based on are not 
easy to understand without some background in statistics (and daily use). 
basically, what you are trying to do will not improve things because what 
you are trying to do does not fit into the statistical model at all.  You 
would end up not taking samples, which would unbalance the distribution as a 
whole.  This in turn would create some strong but unpredictable (probably 
appearing randomly and visual as noise) bias in the samples.  Obviously this 
would make things a lot worse.

	Thorsten


Post a reply to this message

From: Raf256
Subject: Re: additional focal blur related option in camera
Date: 26 Nov 2005 12:57:35
Message: <r8km53-dc8.ln1@raf256.com>
Thorsten Froehlich <438887d6$1@news.povray.org> Saturday 26 of November 2005
17:05

> would end up not taking samples, which would unbalance the distribution as
> a
> whole.  This in turn would create some strong but unpredictable (probably
> appearing randomly and visual as noise) bias in the samples.  Obviously
> this would make things a lot worse.

Concider checker plane y,0 with too small scale, it is very very aliased,
and if we are unlucky then in example first 4 rays could gave identical
result quickly fooling statistical function.

I did some testing with minimal samples setting, and It seems for checker it
is better(*) then any combination of variance/confidence/samples of regular
algorithm.

But I can be mistaking ofcourse, I will play a bit with that.

(*) better = in possible small render time eliminate the random very brights
pixels. I do not talk here about the "usual" quality of focal blur, but
about 100% green or 100% blue pixels showing when rendering very aliased
pigment { checker } plane.


-- 


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: additional focal blur related option in camera
Date: 26 Nov 2005 13:25:41
Message: <4388a8a5$1@news.povray.org>
Raf256 wrote:
>> would end up not taking samples, which would unbalance the distribution
>> as a whole. This in turn would create some strong but unpredictable
>> (probably appearing randomly and visual as noise) bias in the samples.
>> Obviously this would make things a lot worse.
> 
> Concider checker plane y,0 with too small scale, it is very very aliased,
> and if we are unlucky then in example first 4 rays could gave identical
> result quickly fooling statistical function.

You don't fix aliasing by taking *fewer* samples, but by taking *more* 
samples.  If you are having problems with too few samples being taken, you 
have poor settings for the focal blur variance.  Taking fewer samples will 
certainly *not* improve the result.

	Thorsten


Post a reply to this message

From: Raf256
Subject: Re: additional focal blur related option in camera
Date: 26 Nov 2005 15:05:58
Message: <eorm53-a5r.ln1@raf256.com>
Thorsten Froehlich <4388a8a5$1@news.povray.org> Saturday 26 of November 2005
19:25

> You don't fix aliasing by taking *fewer* samples, but by taking *more*
> samples.  If you are having problems with too few samples being taken, you
> have poor settings for the focal blur variance.  Taking fewer samples will
> certainly *not* improve the result.

My idea was to force blur to trace at least in example 5 first rays per
pixel, even if they are identical to eachother and even if otherwise they
will be bellow threshold,

one liner:

--- megapov-1.2.1/source/render.cpp     2005-08-23 21:20:33.000000000 +0200
+++ megapov-1.2.1+rmaj/source/render.cpp        2005-11-26
16:29:12.000000000 +0100
@@ -3119,7 +3119,8 @@
     if ((V1[pRED]  < Sample_Threshold[nr-1]) && (V1[pGREEN]  <
Sample_Threshold[nr-1]) &&
         (V1[pBLUE] < Sample_Threshold[nr-1]) && (V1[pTRANSM] <
Sample_Threshold[nr-1]))
     {
-      break;
+      if (nr > Frame.Camera->Blur_Samples / 4) // raf256
+                               break;
     }
   }


of course it is better to just set Sample_Threshold for min_sample first
value to 0

So the idea is to bump up minimal rays traced without affecting rest of
adaptive system... 

I will do some testes after weekend probably



-- 


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: additional focal blur related option in camera
Date: 26 Nov 2005 16:46:58
Message: <4388d7d2@news.povray.org>
Raf256 wrote:
  > My idea was to force blur to trace at least in example 5 first rays per
> pixel, even if they are identical to eachother and even if otherwise they
> will be bellow threshold,

Actually, POV-Ray takes at least seven samples if "blur_samples" is at least 
seven...

> +      if (nr > Frame.Camera->Blur_Samples / 4) // raf256

This logic is clearly broken. It certainly does not force at least five 
samples to be taken.  The division actually has no useful effect at all.

> of course it is better to just set Sample_Threshold for min_sample first
> value to 0
> 
> So the idea is to bump up minimal rays traced without affecting rest of
> adaptive system... 

As I have been telling you, and as your change shows (well, would show if it 
was coded correctly*), you are not understanding the way the sampling and 
the threshold works at all. Your change would successfully disable the 
statistical sampling method altogether.

The only time when the focal blur sampling will produce aliasing is when 
dealing with some unfortunate sub-pixel-size scene details.  And *only* 
then.  It will not fail for a checker pattern if configured correctly (or 
using the defaults).  If nothing else, chess2.pov is a perfect example of 
focal blur handing checker patterns correctly.

As such, I repeat my strong recommendation to first familiarise yourself 
with the focal blur settings the SDL provides.  They are certainly 
sufficient for 99.9% of cases. And with POV-Ray 3.7 you will be able to use 
AA with focal blur to render the other 0.1% of cases as well.

	Thorsten

* It is also done at the wrong place, it should have been in the for-loop 
further up in the function and been "|| (nr < 5)".


Post a reply to this message

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