|
![](/i/fill.gif) |
triple_r wrote:
> SharkD <mik### [at] gmail com> wrote:
>> I would like to create a function for a heightfield that has a nice bell
>> curve shape, but can also be normalized between 0 and 1 along each axis.
>> I've looked at the normal distribution and beta distribution functions,
>> but they can only be normalized along one axis.
>
> Oh. It took me a bit to realize what you meant, but why not just
>
> exp(-x*x-y*y) * (x-1) * (x+1) * (y-1) * (y+1)
>
> This just clamps the edges to zero while keeping the center at 1. Still 'looks'
> gaussian.
>
> - Ricky
>
>
>
I ended up using this function:
#local BetaA = 3;
#local BetaB = 3;
#local ThingX = ((BetaA - 1) / (BetaB - 1 + BetaA - 1) - 1/2) * 2;
#local ThingY = pow(ThingX/2 + 1/2, BetaA - 1) * pow(1 - (ThingX/2 +
1/2), BetaB - 1);
function {pow(f_r(x,y,z)/2 + 1/2, BetaA - 1) * pow(1 - (f_r(x,y,z)/2 +
1/2), BetaB - 1) / ThingY}
It's basically the same as the beta distribution function, minus the
exponent (or beta function). I realized it was not necessary.
-Mike
Post a reply to this message
|
![](/i/fill.gif) |