开发者

Perlin noise: I have the source code, now what?

I have been开发者_如何学Python looking all over the internet on how exactly to use the Perlin noise class (the C version), but I can't seem to find anything.

Here's what I'm doing:

double height = noise1(12);
NSLog(@"%f", height);

I set a double equal to noise1 with a random argument. Then I output height to the console with the NSLog (objective-c). Now the strange thing is that the console outputs

Perlin noise: I have the source code, now what?

and

Perlin noise: I have the source code, now what?


Am I missing something?


Try, e.g.,

for(double x = 0; x < 10; x+=0.1)
{
  double height = PerlinNoise1D(x,2,2,n);
  //...
}

Here x is the coordinate of the texture; it seems the functions the code is blending together are all 0 at integer values of x so it makes sense that their blend is also always 0. As best as I can tell n is the number of functions to blend... not sure what the best value is, but 20ish seems to work well in some quick tests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜