0

I was looking at this doc: https://code.google.com/p/fractalterraingeneration/wiki/Perlin_Noise

And in the document it says:

  • top-left: just x, y
  • top-right: x-1
  • bottom-left: x, y-1
  • bottom-right: x-1, y-1

This may seem counter-intuitive, but it is to adjust for the possibly negative values in the gradients. Gradients pointing left or down will have negative values, so subtracting 1 from the values compensates for this. I admit I'm still not 100% clear on this, but it is a necessary step.

Am I right in assuming that this only applies if we plan to draw pixels using the final final as the weight? Otherwise, there is no need to subtract 1, correct?

fuzzylogical
  • 852
  • 1
  • 7
  • 9

1 Answers1

0

As shown by the last image on the page you've linked, the authour is quite wrong about the -1's in the paragraph quoted. The actual purpose is to generate the four corners of a grid region from a single input point, this axis-aligned square grid is precisely the region size Perlin Noise is designed to operate in.

If the four points are generated in a way that does not correctly align with adjacent patches (like x+1 in a left to right count, or y-1 in a bottom up count), the image breaks sharply on the patch boundaries as that author describes at the bottom of page. Choosing the same point four times (not adding or subtracting anything) turns the entire patch into a single pixel - generating a white noise image with wasted computation.