Bias and Gain
An interactive demonstration of Ken Perlin's bias and gain functions. Implemented using Christophe Schlick's fast bias alternative function (as found in game programming gems 2). More information at my blog here:
Bias And Gain Are Your Friend
Function:
Bias
Gain
Parameter:
0.5
Your browser doesn't seem to support the necesary html5 features ):
Your browser doesn't seem to support the necesary html5 features ):
Your browser doesn't seem to support the necesary html5 features ):
Your browser doesn't seem to support the necesary html5 features ):
Functions (in Javascript)
function GetBias(time,bias)
{
return (time / ((((1.0/bias) - 2.0)*(1.0 - time))+1.0));
}
function GetGain(time,gain)
{
if(time < 0.5)
return GetBias(time * 2.0,gain)/2.0;
else
return GetBias(time * 2.0 - 1.0,1.0 - gain)/2.0 + 0.5;
}