5

I have been researching noise algorithms for a library I wish to build, and have started with Perlin noise (more accurately Simplex noise, I want to work with arbitrary dimensions, or at least up to 6). Reading Simplex noise demystified, helped, but looking through the implementations at the end, i saw a big lookup table named perm.

In the code example, it seems to be used to generate indexes into a set of gradients, but the method seems odd. I assume that the table is just there to provide 1) determinism, and 2) a speed boost.

My question is, does the perm lookup table have any auxiliary meaning or purpose, or it there for the reasons above? Or another way, is there a specific reason that a pseudo-random number generator is not used, other than performance?

Aatch
  • 1,846
  • 10
  • 19
  • Figure this out champ? I would like to know as well - replacing perm with a random generated list between, say, 1 and 300 or 1 and 600 doesn't work. – Aquinas Aug 08 '12 at 22:18
  • @Aquinas unfortunately no. I'm still holding my "speed boost" theory. It was a while ago, but I think that the numbers would have to be in a certain range, however... – Aatch Sep 14 '12 at 04:58
  • I think you're right, the permutation and gradients arrays are just to make sure we get random-ish gradients at each point, and that we always get the same gradient when we visit the same point later. The important things are determinism, randomishness, and that the gradients have unit length and are distributed evenly around 0,0. – James Clark Feb 12 '13 at 03:47
  • I described this here; http://stackoverflow.com/a/43627723/1548601 – Entalpi Apr 26 '17 at 07:32

2 Answers2

2

This is a bytes array. The range is 0 to 255. You may randomize it if you want. You will probably want to seed the random... etc.

Vincent
  • 21
  • 2
0

The perm table (and grad table) is used for optimization. They are just lookup tables of precomputed values. You are correct on both points 1) and 2).

Other than performance and portability, there is no reason you couldn't use a PRN.

Fuzzy Logic
  • 304
  • 1
  • 9