When I call libnoise's getvalue function with x, y, and z as integers I always get 0 back as a result. Is this normal? When I try 1.25, 0.75, 0.5 as in the tutorial http://libnoise.sourceforge.net/tutorials/tutorial2.html I get the expected result of 0.686347. Specific开发者_Python百科ally I've tried this with integers under 20. Do I just not understand how this works?
Any help is greatly appreciated.
Although Oli Charlesworth is correct, you're getting zeroes at integer values because all zeroes occur at integer values. See the above graph for an easy visual demonstration! The reason why zeroes occur at integers is due to the fact that coherent noise is stipulated to be smooth (as opposed to jagged) and a very easy way to achieve that is to just set zeroes at integers and interpolate pseudorandom numbers between them. The benefit of smooth noise is the fact that it's organic and realistic in nature.
Compare this coherent noise function:
With this non-coherent noise function:
Which one is a mountain most likely to look like? :)
According to http://libnoise.sourceforge.net/noisegen/index.html#gradientnoise, the values at integer coordinates will always be zero.
精彩评论