|
![](/i/fill.gif) |
swiped from Rune's Particle System v1.01 for POV-Ray 3.5
and edited for my use into a small macro; added and commented more media vars:
credit:
/*
Rune's Particle System v1.01 for POV-Ray 3.5
Copyright (C) 2002 Rune S. Johansen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// random
#macro Hash1(t1)
#local p1=sin(t1);
#local pf=cos(1e7*(p1));
abs(1e4*pf-int(1e4*pf))
#end
#macro Hash2(t1,t2)
#local p1=sin(t1);
#local p2=cos(t2*2.2361);
#local pf=cos(1e7*(p1+p2));
abs(1e4*pf-int(1e4*pf))
#end
#macro Hash3(t1,t2,t3)
#local p1=sin(t1);
#local p2=cos(t2*2.2361);
#local p3=sin(t3*1.8708+1);
#local pf=cos(1e7*(p1+p2+p3));
abs(1e4*pf-int(1e4*pf))
#end
// random vector
#macro Hash3p (A,B,C)
#local D = A;
#local Vector = 2*x;
#while (vlength(Vector)>1)
#local Vector = <Hash3(D,B,C),Hash3(D,B,C+1),Hash3(D,B,C+2)>*2-<1,1,1>;
#local D = D+1;
#end
Vector
#end
#macro glow(glow_color,glow_size,p_location,sampn,sampm)
#local p_id = 0.1;
#local glow_state = 0.001; // fader
#local glow_colorturb = <0.3,0.3,0.3>; //magnitude Randomness to color
#local ColorJitter =
(<Hash2(p_id,1),Hash2(p_id,2),Hash2(p_id,3)>-<0.5,0.5,0.5>)*glow_colorturb;
//echov(ColorJitter)
#local Color =
(
glow_color
*(1+ColorJitter) // Randomness to color
<0.08566,-0.00723,0.04424>
*(1.001-glow_state) // fader
);
#local ColorM = max(Color.x,max(Color.y,Color.z)); // highest RGB
#local Color = Color/2;
sphere {
0, 1 hollow no_shadow
pigment {rgbf 1}
finish {ambient 1 diffuse 0}
interior {
media {
emission Color // color
intervals 10 // default 10
ratio 0.9 // default 0.9 distributes intervals differently
between lit and unlit areas
samples sampn,sampm // default 1,1
variance 1.0/128
confidence 0.9
method 2 //1,2,3adaptive
density {
spherical
density_map {
[0.0, rgb 0 ]
[0.6, rgb Color ]
[1.0, rgb 2*ColorM]
}
}
}
media {
absorption Color*.1 // color
intervals 10 // default 10
ratio 0.9 // default 0.9 distributes intervals differently
between lit and unlit areas
samples sampn,sampm // default 1,1
variance 1.0/128
confidence 0.9
method 2 //1,2,3adaptive
density {
spherical
density_map {
[0.0, rgb 0 ]
[0.6, rgb ColorM-Color]
[1.0, rgb 0 ]
}
}
}
}
scale glow_size
//echov(0.5/glow_size)
translate p_location
}
#end
glow(<1.0,0.2,0.2>,<2.0,100.0,2.0>,<20,0,15>,4,8)
//glow(glow_color,glow_size,p_location,sampn,sampm)
Post a reply to this message
Attachments:
Download 'sandman1.jpg' (26 KB)
Preview of image 'sandman1.jpg'
![sandman1.jpg](/povray.binaries.scene-files/attachment/%3Cweb.479e050dd5ed02373ffee9290%40news.povray.org%3E/sandman1.jpg?preview=1)
|
![](/i/fill.gif) |