Here's what I figured out:
I'm basing my perlin noise generation off what it says on
this webpage. Instead of using the ease curve it describes to get a weighted average, I just added my s, t, u, v together and divided by 4. (At first, I was all, "oh man, I'd better figure out what I did wrong before I move on to this ease curve stuff." Fortunately, I figured it out before I wasted too much time.)
What's supposed to happen is that as the sample point gets closer to one side of a grid cell, the contribution to the output value from the grid points on the opposite side of that cell approaches zero. At the border between two cells, only the grid points shared by both cells should have an impact on the value.
In my version, all four grid points around a cell contributed to the value right up to the border of the cell. When the cell border is crossed, the grid points that aren't shared between the cells still have an influence - but those points suddenly change, so the value does, too.
The other thing I did wrong was I used ceiling(x) where I wanted floor(x+1) to find the grid points around a given sample point. That meant that when x
samplepoint was an integer, I was getting grid cells where the two points that made up the left side of the cell, whose x values were floor(x
samplepoint), and the two points that made up the right side, whose x values were ceiling(x
samplepoint), had the same x values and were therefore the same two points. (And ditto for y, of course.) That's what causes the bright and dark borders along the edges of the cells: It's like there are one-dimensional grid cells made of only two points lining the two-dimensional ones.
Hopefully that's helpful and not just completely unclear.
While I'm babbling about it, I might as well show what it looks like now:
So I guess it's working vertically, but not horizontally?
I don't have any idea why yet. Maybe my weighted average is still wrong.