![Tekken 4 characters](https://kumkoniak.com/106.jpg)
![perlin noise c perlin noise c](http://files.smashingmagazine.com/wallpapers/june-15/the-amazing-water-park/cal/june-15-the-amazing-water-park-cal-1280x720.jpg)
I have implemented the pseudocode in the following C++ program. That value isn't used as an index into your array. Where you see x-1 in the code, it's just an intermediate value for the noise calculation. You were correct in your original supposition that the function expects you to pass in a coordinate pair. The PerlinNoise_2D (or Total) function definitely looks like the intended entry point for the Perlin class, and it also looks like the function that will give me back the values I want, but I can't for the life of me figure out what I'm supposed to be passing in, because it definitely isn't my x and y pixel array indices.ĭoes anybody know what I'm supposed to be passing in here?
Perlin noise c code#
I have a 500 by 500 array that I'm storing my pixel values into, so at first I thought I was just supposed to loop through the PerlinNoise_2D (or Total) function for each and every pixel, but that causes me to go out of bounds of my array IMMEDIATELY, because one of the first function calls has code that uses the index x - 1, which of course means when I give it my first x index (0, obviously), it breaks. The trouble is that I have no idea what the input values for x and y are supposed to be in the PerlinNoise_2D function near the bottom of the Hugo Elias article (or the i and j values in the Total function if you're looking at the earlier Stack Overflow question).
![perlin noise c perlin noise c](http://fundza.com/c4serious/noise/perlin/heightfield.gif)
Similar code is shown in the answer to this question. I've been trying to get Perlin Noise generation working all day, and I'm having trouble implementing the pseudocode in this tutorial.
![Tekken 4 characters](https://kumkoniak.com/106.jpg)