I've done a research and tried implementing for months, but I've gotten nowhere trying to make seamless/tileable Perlin noise.
Here is my current Perlin noise file without seamless implementation. In my program, I am calling FractionalBrownianMotion to generate.
Each of the research articles have given me issues. In FractionalBrownianMotion I change the call from Perlin to PerlinSeamless.
Research Articles
How to make one-axis tileable simplex noise? Produces broken noise using x2, y2 as period; xsize, ysize as map size. Also tried vice-versa.
Added code:
public float PerlinSeamless(float x, float y)
{
int width = gradientArray.GetLength(0);
int length = gradientArray.GetLength(1);
// map size 250
float x1 = 0, x2 = 50;
float y1 = 0, y2 = 50;
float dx = x2 - x1;
float dy = y2 - y1;
//Sample noise at smaller intervals
float s = x / width;
float t = y / length;
// Calculate our 3D coordinates
float nx = x1 + Mathf.Cos(s * 2 * Mathf.PI) * dx / (2 * Mathf.PI);
float ny = y1 + Mathf.Sin(t * 2 * Mathf.PI) * dy / (2 * Mathf.PI);
float nz = t;
return Perlin3D(nx, ny, nz);
}
public float Perlin3D(float x, float y, float z)
{
y += 1;
z += 2;
float xy = perlin3DFixed(x, y);
float xz = perlin3DFixed(x, z);
float yz = perlin3DFixed(y, z);
float yx = perlin3DFixed(y, x);
float zx = perlin3DFixed(z, x);
float zy = perlin3DFixed(z, y);
return xy * xz * yz * yx * zx * zy;
}
private float perlin3DFixed(float a, float b)
{
return Mathf.Sin(Mathf.PI * Perlin(a, b));
}
How do you generate tileable Perlin noise?
hashed = perm[perm[int(gridX)%per] + int(gridY)%per]
goes OOB.3D Perlin Noise Technique does not replicate 2D noise when z value always 0, but using this method for 3D Perlin noise assuming that's the way it's supposed to be
I have also tried various implementations of non-answer accepted comments in these articles to see only broken noise.