12

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.

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.

Sonic42
  • 689
  • 1
  • 14
  • 21
  • A similar question was asked here that I found useful http://stackoverflow.com/questions/5531019/perlin-noise-in-java And here's an old Java applet example complete with source code I found http://dzzd.net/demo/PERLINSample/ – Jered Cuenco Feb 09 '12 at 19:51

3 Answers3

7

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.

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.)

Zenexer
  • 18,788
  • 9
  • 71
  • 77
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.

Community
  • 1
  • 1
Pillager225
  • 439
  • 1
  • 3
  • 15
0

Processing provides a Perlin noise generator.

Reference documentation

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

arkon
  • 2,209
  • 3
  • 27
  • 36
cdc
  • 2,511
  • 2
  • 17
  • 15