The newest problem is correctly implimenting the cosine interpolation of two numbers.
On this site, code is provided but it does not give expected results.
http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
from the site:
function Cosine_Interpolate(a, b, x)
ft = x * 3.1415927
f = (1 - cos(ft)) * .5
return a*(1-f) + b*f
end of function
The number should be between number a and number b. However,when I run the interpolation function numbers that are supposed to be between 0 and 10 never exceed 1. They just stay around 0.
My conversion:
Function cos_interpolate:Float(n1:Float, n2:Float, percent:Float)
Local ft:Float = percent * Float(Pi)
Local f:Float = (1 - Cos(ft)) *.5
Return n1 * (1 - f) + n2 * f
End Function
A 10 step progression from 0 to 10 is certainly not correct:
8.26772666e-005
0.000330706593
0.000744080578
0.00132278656
0.00206680736
0.00297612092
0.00405069860
0.00529050967
0.00669551594
0.00826567598
take note of the "return a*(1-f) + b*f"
95% of all perlin noise implementations(and if you based yours on the info from Hugo Elias, yours aswell) returns values in the 0..1 domain... wich is why you are getting weird results.. basically, what you want to do is this:
set up your basic noise function (returns a float between 0 and 1).
set up a smoothed noise function(weighted), that interpolates noise(x,y), noise(x+1,y), noise(x,y+1), noise(x+1,y+1), which in turn returns a float between 0 and 1.
create your final perlin noise function using the smoothed noise function using basically any interpolation you see fit(linear, cosine, cubic, catmull rom, etc) to interpolate the values inbetween your points in texture space.
hope this was of some help

if not, i'll just post my code
