如何用Perlin噪声填充二维数组?

时间:2022-05-28 21:34:02

I've devised a small personal project to help me learn how to use Perlin Noise. This project involves filling a 2D array of r rows and c columns with random, coherent data generated with a Perlin Noise algorithm.

我设计了一个小型个人项目来帮助我学习如何使用Perlin噪声。这个项目涉及用Perlin噪声算法生成的随机、相干数据填充r行和c列的二维数组。

Now, I've just spent hours reading a wide variety of resources about generating Perlin Noise. However, it's all over my head and I'm totally lost. I understand the basic concept, but I don't have a clue how to begin implementing this in Java. I think it would be most helpful if someone could show me some well-commented code that accomplishes my goal so I can work backwards and apply it myself.

现在,我花了几个小时阅读各种各样的关于产生Perlin噪声的资源。然而,这一切都在我的脑海中,我完全迷失了。我理解基本概念,但是我不知道如何在Java中开始实现它。我认为,如果有人能向我展示一些注释良好的代码,以实现我的目标,这样我就可以自己反向工作并应用它,那将是最有帮助的。

3 个解决方案

#1


6  

If you want a perfectly documented implementation, check out this. You can download the source code and open src\java\org\j3d\texture\procedural\PerlinNoiseGenerator.java to get your commented code. I take no credit for any of this. All I did was hunt around on Google a bit.

如果您想要一个完整的文档化实现,请检查这个。您可以下载源代码,并打开src\java\ j3d\texture\ \ \PerlinNoiseGenerator。java来获得注释代码。这一切我都不相信。我所做的只是在谷歌上找了点东西。

Since it's licensed under LGLPL, I'll also provide a direct link to it. (If I'm mistaken about what LGLPL means and my ability to do this, please notify me.)

由于它是根据LGLPL许可的,我还将提供一个直接链接到它。(如果我对LGLPL的含义和我的能力有误解,请通知我。)

#2


0  

Check out the accepted answer. Perlin Noise in Java . I am pretty sure this is exactly what you want to do. Just tweak the roughness variable and what is added whenever nextFloat() is called an you got yourself a filled 2d array of Perlin noise.

查看已接受的答案。Java中的Perlin噪声。我很确定这正是你想做的。只要调整roughness变量,当nextFloat()被调用时,你就会得到一个填充的Perlin噪声的2d数组。

#3


0  

Processing provides a Perlin noise generator.

Processing提供了Perlin噪声发生器。

Reference documentation

参考文档

Source code look for the noise(...) method(s)

寻找噪声(…)方法的源代码

#1


6  

If you want a perfectly documented implementation, check out this. You can download the source code and open src\java\org\j3d\texture\procedural\PerlinNoiseGenerator.java to get your commented code. I take no credit for any of this. All I did was hunt around on Google a bit.

如果您想要一个完整的文档化实现,请检查这个。您可以下载源代码,并打开src\java\ j3d\texture\ \ \PerlinNoiseGenerator。java来获得注释代码。这一切我都不相信。我所做的只是在谷歌上找了点东西。

Since it's licensed under LGLPL, I'll also provide a direct link to it. (If I'm mistaken about what LGLPL means and my ability to do this, please notify me.)

由于它是根据LGLPL许可的,我还将提供一个直接链接到它。(如果我对LGLPL的含义和我的能力有误解,请通知我。)

#2


0  

Check out the accepted answer. Perlin Noise in Java . I am pretty sure this is exactly what you want to do. Just tweak the roughness variable and what is added whenever nextFloat() is called an you got yourself a filled 2d array of Perlin noise.

查看已接受的答案。Java中的Perlin噪声。我很确定这正是你想做的。只要调整roughness变量,当nextFloat()被调用时,你就会得到一个填充的Perlin噪声的2d数组。

#3


0  

Processing provides a Perlin noise generator.

Processing提供了Perlin噪声发生器。

Reference documentation

参考文档

Source code look for the noise(...) method(s)

寻找噪声(…)方法的源代码