POV-Ray : Newsgroups : povray.binaries.images : Odd blur effect: squared spheres : Re: Odd blur effect: squared spheres Server Time21 Sep 2023 22:18:52 EDT (-0400)
 Re: Odd blur effect: squared spheres
 From: Zeger Knaepen Date: 27 Aug 2002 15:24:54 Message: <3d6bd206\$1@news.povray.org>
> > Shouldn't it be a circular area for realism?
>   ^^^^^^
> correct ...
I don't think that's correct actually...

> either that or you can start modelling complex shapes for a
> probability model. Meaning, you support a greyscale bitmap
> where black says "no here won't get a ray shooten from" and
> white means that from here will get a ray shooten with the
> highest probability.
>
> This would allow you to form flare shapes as they sometimes
> appear in photography; think of hexagonal or triangular ones.
>
> The problem would be, that it will even slower to determine
> the point.
True, but I would be happy with the possibility to choose between a circular
area and an area in the shape of a regular polygon.

I was trying to do focalblur by averaging different renders earlier this day.  I
came up with the following formula to scatter points inside a regular polygon:

#declare Seed=seed(whatever);
#declare angles=<insert number of angles here>;
#declare Rot=360*rand(Seed);
#declare X=pow(rand(Seed),.5);
#declare Rot2=Rot/(360/angles);
#declare fraqrot=Rot2-int(Rot2);
#declare fraqrot2=abs(fraqrot-.5);
#declare fraqrot3=pow(fraqrot2*2,.5);
#declare Location=vrotate(x*X*(.8+.2*fraqrot3),Rot*z);

This produces a random point within a regular polygon inside a circle with
radius 1 (I think, could be that it's a bit outside that circle...) (more or
less, it's not a perfect polygon, and it needs more than 3 angles to look like a
polygon)

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