PDA

View Full Version : particle size - power curve distribution?


rxgeez
10-18-2009, 09:26 AM
I'm trying to assign particles a random size between two values...then I want to be able to control the ratio of small to large based on a power curve.

i.e.
sizeMin value = 1
sizeMax value = 10
sizeRatio is a 0-1 attribute

when sizeRatio = 0 -- all smaller ones (blue curve in image)
when sizeRatio = .5 -- even distribution of small and large (green curve in image)
when sizeRatio = 1 -- all larger ones (red curve in image)


I'm assuming its a pretty simple pow function....any ideas?

marcinm
10-18-2009, 10:25 AM
I think bias function is all you need in this case. Something like this:


global proc float bias(float $val, float $b)
{
if ($b>0)
{
return pow($val,log($b) / log(0.5));
}
else
{
return 0;
}
}

CGTalk Moderation
10-18-2009, 10:25 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.