# Seaming between procedurally generated terrain meshes in Unity

I have been generating procedural terrain for an upcoming project however I am coming across a seaming effect between the tiles:

I have searched for solutions including this video.

Here is the code (sorry for the lack of comments):

chunkx and chunky are the x and y coordinates of the chunk that is being generated.

seed is a randomly generated integer.

float Gen_Height(int x, int y, int seed)
{
float height = 0;
float newx;
float newy;
for (float resolution = 128; resolution >= 8; resolution /= 8)
{
newx = (seed / 40f) / resolution + x / resolution;
newy = (seed / 40f) / resolution + y / resolution;
height += (Mathf.PerlinNoise(newx, newy) - 0.5f) * resolution;
}
if (height < 0) height = 0;
return height;
}

public List<Vector3> Gen_Vertices(int chunkx, int chunky, int seed)
{
float height;
int x = 101;
List<Vector3> vertices = new List<Vector3>();

for (int i = 0; i < x; i++)
{
for (int j = 0; j < x; j++)
{
height = Gen_Height(i + chunkx * (int)x, j + chunky * (int)x, seed) * heightmod;