3 D Perlin Noise Interpolation
← 3D Perlin Noise Textures | ● | 3D Perlin Noise Examples →
Interpolating functions between two data values a and b in the range $x\in[0,1]$.
Linear interpolation:
graph by Hugo Elias
{
return(a*(1-x) + b*x);
}
Rating: Linear interpolation is unsuitable for 3D Perlin Noise, because sharp corners look ugly.
Cosine Interpolation:
graph by Hugo Elias
{
double ft = x*3.1415927;
f = (1 - cos(ft)) * 0.5;
return(a*(1-f) + b*f);
}
Rating: Cosine interpolation is very suitable for 3D Perlin Noise, because it is smooth and easy to implement.
Cubic interpolation with the polynom $p(x)=ax^3+bx^2+cx+d$:
graph by Hugo Elias
// v1 = the point a
// v2 = the point b
// v3 = the point after b
double cubic_interpolate(double v0, double v1, double v2, double v3, double x)
{
double a = (v3 - v2) - (v0 - v1);
double b = (v0 - v1) - a;
double c = v2 - v0;
double d = v1;
return(d+(c+(b+a*x)*x)*x);
}
Rating: Cosine interpolation is suitable for 3D Perlin Noise, because it is smooth, but the additional effort and computation time are not justified by a hardly noticeable visual improvement. Also the cubically interpolated function is not bounded by the corner values, leading to interpolation shoot over.