|
 |
Sean Day wrote:
> Christian Froeschlin wrote:
>> you could try using a bozo / noise pattern for the probability
>> (instead of fixed probability over rectangle)
>
> I like that idea, not sure how to do it though ;-)
I mean something like the code below. It places objects
in random positions in a square from (-1,-1) to (1,1) but
also uses a "die roll" for each placement. The function
used should yield values from 0 to 1 based on position.
In the sample I use an f_boxed (to taper out at the edge),
multiplied by f_bozo (to give some structured variation),
and a power just to increase "contrast".
#include "rand.inc"
#include "functions.inc"
global_settings
{
assumed_gamma 1.0
}
camera
{
location <0.0, 1.5, 0.0>
look_at <0.0, 0.0, 0.0>
angle 90
}
#declare NUM = 20000;
#declare f_distribution = function
{
pow(f_boxed(x,y,z)*f_bozo(x*5, y*5, z*5),2)
}
#declare R = seed(42);
#declare I = 0;
// Just to visualize the probability in the background
plane
{
y,0
pigment
{
function {f_distribution(x,y,z)}
}
finish {ambient 1}
}
// Actual placement
union
{
#for (I,0,NUM,1)
#declare X = 2*rand(R)-1;
#declare Y = 2*rand(R)-1;
#if (rand(R) < f_distribution(X,0,Y))
sphere {<X,0,Y>, 0.005}
#end
#end
pigment {color rgb <1,0,0>}
finish {ambient 1}
}
Post a reply to this message
Attachments:
Download 'testplacement.png' (60 KB)
Preview of image 'testplacement.png'

|
 |