简体   繁体   English

帮助使用perlin噪声库libnoise

[英]Help with using the perlin noise library libnoise

When I call libnoise's getvalue function with x, y, and z as integers I always get 0 back as a result. 当我用x,y和z作为整数调用libnoise的getvalue函数时,结果总是得到0。 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. 当我在教程http://libnoise.sourceforge.net/tutorials/tutorial2.html中尝试1.25,0.75,0.5时,我得到了0.686347的预期结果。 Specifically I've tried this with integers under 20. Do I just not understand how this works? 具体来说,我已经尝试过20岁以下的整数。我只是不明白这是如何工作的?

Any help is greatly appreciated. 任何帮助是极大的赞赏。

在此输入图像描述

Although Oli Charlesworth is correct, you're getting zeroes at integer values because all zeroes occur at integer values. 虽然Oli Charlesworth是正确的,但您在整数值处得到零,因为所有零都出现在整数值处。 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? 哪一个山最容易看起来像? :) :)

根据http://libnoise.sourceforge.net/noisegen/index.html#gradientnoise ,整数坐标处的值始终为零。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM