POV-Ray : Newsgroups : povray.unofficial.patches : MegaPOV's PostProcessing and blurring : Re: MegaPOV's PostProcessing and blurring Server Time
1 Jun 2024 08:27:09 EDT (-0400)
  Re: MegaPOV's PostProcessing and blurring  
From: ABX
Date: 9 Mar 2005 11:25:13
Message: <is7u211jgu7cgc8u1cv8g4nss4hhr4med0@4ax.com>
On Wed, 9 Mar 2005 16:20:42 +0100, "Zeger Knaepen"
<zeg### [at] studentkuleuvenacbe> wrote:
> #macro Blur_red(S,RX,RY,Samples,Division)
> #local Seed=seed(S);
>    function {
>     f_output_red(x,y)
>     +( #declare C=0;
>      #while (C<Samples)
>       #declare X=(rand(Seed)-rand(Seed))*RX;
>       #declare RY=rand(Seed)*pi;
>       #declare Y=sin(RY)*X;
>       #declare X=cos(RY)*X;
>       f_output_red(x+X,y+Y)/Division+
>       #declare C=C+1;
>      #end
>    0)/Samples
>    }
> #end

One thing is that you are doing "/Division" 'Samples' times. Instead of this
you could do "/(Samples*Division)" after sum.

More difficoult improvement (in fact I'm not sure it will improve but hard to
judge without testing) could be to move rand from parsing to runtime and
decrease length of the function. I mean take benefits of sum() function like

#macro Blur_red(S,RX,RY,Samples,Division)
   #local Seed=seed(S);
   function {
     f_output_red(x,y) +   
     sum(i,0,Samples-1,f_output_red(x+f_X(i,S),y+f_Y(i,S)))/(Samples*Division)
   }
#end

where f_X() and f_Y() are functions which simulate random generator using some
noise pattern with your trigonometry applied.

ABX


Post a reply to this message

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