I made a program that uses perlin noise to generate a height map. It worked very good. Later I changed it to use simplex noise.

What I want to achieve now is that the left edge fits in the right edge, so I want to make it tileable.

I did some research and found this: https://gamedev.stackexchange.com/a/23639/116727. This formula makes it tileable on every edge but I only want it to be tileable on the left and right edges. Then I found this website: http://www.jgallant.com/procedurally-generating-wrapping-world-maps-in-unity-csharp-part-2/#wrap1. It was just what I needed, with a formula that only tiles on one axis. I the tried to implement it, but I could not get it to work.

Here is my implementation:

//Noise range
double x1 = 0, x2 = 1;
double y1 = 0, y2 = 1;
double dx = x2 - x1;
double dy = y2 - y1;

//Sample noise at smaller intervals
double s = x / xsize;
double t = y / ysize;

// Calculate our 3D coordinates
double nx = x1 + Math.Cos(s * 2 * Math.PI) * dx / (2 * Math.PI);
double ny = y1 + Math.Sin(t * 2 * Math.PI) * dy / (2 * Math.PI);
double nz = t;

float PerlinValue = (float)SimpNoise.Evaluate(nx, ny, nz); //* 2 - 1;

map[x, y] = PerlinValue;

This is the result that I get: enter image description here

What am I doing wrong? How can I fix this?

  • \$\begingroup\$ What type are x and xsize? Could there be integer division happening? \$\endgroup\$
    – user35344
    May 27, 2018 at 10:32
  • \$\begingroup\$ yep it was because they were integers. thx for helping. but do you also know how i can increase the scale becouse i cant use my old scale formula on this. \$\endgroup\$ May 27, 2018 at 12:48
  • \$\begingroup\$ Note that while 2D Perlin/Simplex noise is band-limited, a 2D slice through a higher-dimensional noise as suggested here is not. You tend to get frequency leakage that makes it more like white noise. If band limitation is important to your use of noise, we can construct a natively tiling 2D noise. Or is the cylindrical slice through 3D noise sufficient for your needs? \$\endgroup\$
    – DMGregory
    May 27, 2018 at 13:22

1 Answer 1


Your x / xsize and y / ysize use integer division and return incorrect values because of that.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .