1

Here is one implementation in C# of the simplex noise algorithm

You'll notice that each noise function (2d, 3d, and 4d) scales the corner contributions to fit in the -1 to 1 range (this is the magic number on the return statements), which is reasonable. As far as I know these were figured out experimentally.

The problem is that I want to template this into an arbitrary number of dimensions, and this factor seems to be the one roadblock to doing that, so I'd like to find an algorithmic way of getting that scaling factor. I'm not familiar enough with the algorithm to see what factors contribute to the scale, but if I had to guess I'd think the permutations table at the top is a major one.

Does anyone have any ideas on this, perhaps just to say it isn't feasible?

kniteli
  • 491
  • 3
  • 10
  • 1
    I think it's possible, but there's a lot of magic to untangle. The permutations table is probably not as important as the gradients tables. The big question is, what is the range of `dot(grad, x0, y0)` for all the gradients over all possible `x0,y0`? If you know that you can figure the range of `n0+n1+n2`. – James Clark Feb 12 '13 at 03:34

0 Answers0