|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'm still working on that nuclear explosion, but it would be nice if I could
make the brightest parts of it really glow. So I made this:
- begin code -
#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
#macro Blur_green(S,RX,RY,Samples,Division)
#local Seed=seed(S);
function {
f_output_green(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_green(x+X,y+Y)/Division+
#declare C=C+1;
#end
0)/Samples
}
#end
#macro Blur_blue(S,RX,RY,Samples,Division)
#local Seed=seed(S);
function {
f_output_blue(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_blue(x+X,y+Y)/Division+
#declare C=C+1;
#end
0)/Samples
}
#end
global_settings {
post_process {
PP_Init_Alpha_Colors_Outputs()
Blur_red(1565,.05,.05,50,5)
Blur_green(1565,.05,.05,50,5)
Blur_blue(1565,.05,.05,50,5)
function { f_output_alpha(x,y) }
save_file "duplication.png"
}
}
- end code -
But as you probably can imagine, it gets extremely slow at decent settings.
Is there a faster way ? In case it's not clear, this is what I want: I want
the original image combined (additive) with a darkened blurred version of the
original.
cu!
--
camera{location-z*3}#macro G(b,e)b+(e-b)*(C/50)#end#macro L(b,e,k,l)#local C=0
;#while(C<50)sphere{G(b,e),.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1
;#end#end L(y-x,y,x,x+y)L(y,-x-y,x+y,y)L(-x-y,-y,y,y+z)L(-y,y,y+z,x+y)L(0,x+y,
<.5,1,.5>,x)L(0,x-y,<.5,1,.5>,x) // ZK http://www.povplace.be.tf
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
From: Zeger Knaepen
Subject: Re: MegaPOV's PostProcessing and blurring
Date: 9 Mar 2005 11:50:55
Message: <422f296f@news.povray.org>
|
|
|
| |
| |
|
|
"ABX" <abx### [at] abxartpl> wrote in message
news: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.
ok, I removed the randomness and I placed the division after the sum. It's
slightly faster, looks slightly better, but is still way to slow to be useful :(
cu!
--
camera{location-z*3}#macro G(b,e)b+(e-b)*(C/50)#end#macro L(b,e,k,l)#local C=0
;#while(C<50)sphere{G(b,e),.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1
;#end#end L(y-x,y,x,x+y)L(y,-x-y,x+y,y)L(-x-y,-y,y,y+z)L(-y,y,y+z,x+y)L(0,x+y,
<.5,1,.5>,x)L(0,x-y,<.5,1,.5>,x) // ZK http://www.povplace.be.tf
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|