Chunk generation in Factorio

How is the chunk generation implemented in Factorio?
I followed some online tutorials using Perlin noise and tried different parameters but the results looked way different than what I expected.

        public Texture2D GenerateSpread(int seed, int width, int height) {
            var spreadTexture = new Texture2D(width, height);

            for (int x = 0; x < spreadTexture.width; x++) {
                for (int y = 0; y < spreadTexture.height; y++) {
                    var xCoord = (x + seed) * granularity / 100f;
                    var yCoord = (y + seed) * granularity / 100f;
                    var noise = Mathf.PerlinNoise(xCoord, yCoord);

                    var color = Color.black;
                    if (noise > threshold) color = Color.white;
                    spreadTexture.SetPixel(x, y, color);
                }
            }
            spreadTexture.Apply();
            return spreadTexture;
        }

This is the 2D forum, not the Graphics forum. I don’t see what the above has to do with Tilemap either TBH.

I’ll move your post for you.

Well, how are the results different from what you expected? You really gotta be more specific if you want anyone to be able to help.