Can't overpass 65 000 vertices limit

Hi,
It’s been a week since i’m stuck on a single problem. I’m trying to create a map with an cubic aspect but with more optimization if I may. I created a script who allows me to create a 7171 map but I want something around the 250250. I tried to split the script in several ones (one for the height of the general map, one for the interface and the last one for creating the chunks), I tried to create a function and finally I tried to make a repetition of my creation but I can’t make it work…

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
[RequireComponent(typeof(MeshCollider))]
public class Code : MonoBehaviour {
    /*public int size_x = 100;
    public int size_z = 50;*/
   
    [HideInInspector]
    public int ChunkSize = 71;
   
   
    [Header("Ground properties")]
       
    //Overpass the 65 000 vertices limit
    public int ChunkX = 1;
    public int ChunkZ = 1;
   
    public float tileSize = 1.0f;
    [Range(0,70)]
    public int heightMax = 5;
    [Range(0,30)]
    public int flat = 10;
   
    public int[,] Matrix;
   
    // Use this for initialization
    void Start () {
        BuildMesh();   
    }
   
    void BuildMesh(){
        // Fixing data
        int size_x = ChunkSize;
        int size_z = ChunkSize;
        int numTiles     = size_x * size_z;
        int numTris     = numTiles * 2 * 2;
        int numverts     = numTiles * 4;
        int numberOfChunks = ChunkX * ChunkZ;
        int[,] triangles    = new int [numTris * 3*2, numberOfChunks];
       
        // Generate the mesh Data
        Vector3[,] vertices = new Vector3[numverts * 3, numberOfChunks];
        Vector3[,] normals  = new Vector3[numverts*3, numberOfChunks];
        Vector2[,] uv       = new Vector2[numverts*3, numberOfChunks];
       
       
        // Generation on the Y axes
        Matrix = new int[size_x * ChunkX ,size_z * ChunkZ];
        int scale = 1;
        int power = 1;
        Vector2 v2SampleStart = new Vector2(0.0f, 0.0f);
        v2SampleStart = new Vector2(Random.Range (0.0f, 10000.0f), Random.Range (0.0f, 10000.0f));
        for (int x_y = 0; x_y < size_x * ChunkX ; x_y++) {
            for (int z_y = 0; z_y < size_z * ChunkZ ; z_y++) {
                float xCoord = v2SampleStart.x + x_y * scale;
                float yCoord = v2SampleStart.y + z_y * scale;
                Matrix[x_y, z_y] = (int) (heightMax * (Mathf.PerlinNoise (xCoord / flat, yCoord / flat)) * power);
            }
        }

        for(int zChunk = 0; zChunk < ChunkZ; zChunk++)
        {
            for(int xChunk = 0; xChunk < ChunkX; xChunk++)
            {
                // Generation of the planes
                int x, z = 0;
                for(z = 0 ; z < size_z ; z++){
                    for(x = 0 ; x < size_x ; x++){
                        int height = Matrix[x,z];
                        //Vertices
                        vertices[(x + z * size_x) * 4 + 0,xChunk + zChunk*ChunkX] = new Vector3((x + 0 + ChunkX * ChunkSize) * tileSize, height, (z + 0 + ChunkZ * ChunkSize) * tileSize);
                        vertices[(x + z * size_x) * 4 + 1,xChunk + zChunk*ChunkX] = new Vector3((x + 1 + ChunkX * ChunkSize) * tileSize, height, (z + 0 + ChunkZ * ChunkSize) * tileSize);
                        vertices[(x + z * size_x) * 4 + 2,xChunk + zChunk*ChunkX] = new Vector3((x + 0 + ChunkX * ChunkSize) * tileSize, height, (z + 1 + ChunkZ * ChunkSize) * tileSize);
                        vertices[(x + z * size_x) * 4 + 3,xChunk + zChunk*ChunkX] = new Vector3((x + 1 + ChunkX * ChunkSize) * tileSize, height, (z + 1 + ChunkZ * ChunkSize) * tileSize);
                        //Normals
                        normals [(x + z * size_x) * 4 + 0,xChunk + zChunk*ChunkX] = Vector3.up;
                        normals [(x + z * size_x) * 4 + 1,xChunk + zChunk*ChunkX] = Vector3.up;
                        normals [(x + z * size_x) * 4 + 2,xChunk + zChunk*ChunkX] = Vector3.up;
                        normals [(x + z * size_x) * 4 + 3,xChunk + zChunk*ChunkX] = Vector3.up;
                        //Uvs
                        uv [(x + z * size_x) * 4 + 0,xChunk + zChunk*ChunkX] = new Vector2(x + 0, z + 0);
                        uv [(x + z * size_x) * 4 + 1,xChunk + zChunk*ChunkX] = new Vector2(x + 1, z + 0);
                        uv [(x + z * size_x) * 4 + 2,xChunk + zChunk*ChunkX] = new Vector2(x + 0, z + 1);
                        uv [(x + z * size_x) * 4 + 3,xChunk + zChunk*ChunkX] = new Vector2(x + 1, z + 1);
                        //Triangles
                        //First
                        triangles[6 * (z * size_x + x) + 0,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 2;
                        triangles[6 * (z * size_x + x) + 1,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 1;
                        triangles[6 * (z * size_x + x) + 2,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 0;
                        //Second
                        triangles[6 * (z * size_x + x) + 3,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 1;
                        triangles[6 * (z * size_x + x) + 4,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 2;
                        triangles[6 * (z * size_x + x) + 5,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 3;
                    }
                }
                // Generation in the X axe
                int essais = 0;
                for(int cycle = 0; cycle < size_x * size_z - 1; cycle++){
                    essais = size_x * size_z + cycle;
                    if(((cycle+1) % size_x) != 0){
                        vertices[(essais) * 4 + 0,xChunk + zChunk*ChunkX] = vertices[1 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices[(essais) * 4 + 1,xChunk + zChunk*ChunkX] = vertices[3 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices[(essais) * 4 + 2,xChunk + zChunk*ChunkX] = vertices[4 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices[(essais) * 4 + 3,xChunk + zChunk*ChunkX] = vertices[6 + cycle * 4,xChunk + zChunk*ChunkX];
                       
                        normals [(essais) * 4 + 0,xChunk + zChunk*ChunkX] = new Vector3(1, 0, 0);
                        normals [(essais) * 4 + 1,xChunk + zChunk*ChunkX] = new Vector3(1, 0, 0);
                        normals [(essais) * 4 + 2,xChunk + zChunk*ChunkX] = new Vector3(1, 0, 0);
                        normals [(essais) * 4 + 3,xChunk + zChunk*ChunkX] = new Vector3(1, 0, 0);
                       
                       
                        triangles[(essais) * 6 + 0,xChunk + zChunk*ChunkX] = (essais) * 4 + 0;
                        triangles[(essais) * 6 + 1,xChunk + zChunk*ChunkX] = (essais) * 4 + 1;
                        triangles[(essais) * 6 + 2,xChunk + zChunk*ChunkX] = (essais) * 4 + 2;
                       
                        triangles[(essais) * 6 + 3,xChunk + zChunk*ChunkX] = (essais) * 4 + 3;
                        triangles[(essais) * 6 + 4,xChunk + zChunk*ChunkX] = (essais) * 4 + 2;
                        triangles[(essais) * 6 + 5,xChunk + zChunk*ChunkX] = (essais) * 4 + 1;
                    }
                }
               
                // Generation in the Z axe
                essais = essais + 1;
                for (int cycle = 0; cycle < size_x * (size_z - 1); cycle++) {
                    if(cycle != 0){
                        vertices [(essais + cycle) * 4 + 0,xChunk + zChunk*ChunkX] = vertices [2 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices [(essais + cycle) * 4 + 1,xChunk + zChunk*ChunkX] = vertices [3 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices [(essais + cycle) * 4 + 2,xChunk + zChunk*ChunkX] = vertices [0 + size_x * 4 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices [(essais + cycle) * 4 + 3,xChunk + zChunk*ChunkX] = vertices [1 + size_x * 4 + cycle * 4,xChunk + zChunk*ChunkX];
                       
                        normals [(essais + cycle) * 4 + 0,xChunk + zChunk*ChunkX] = new Vector3 (0, 0, 1);
                        normals [(essais + cycle) * 4 + 1,xChunk + zChunk*ChunkX] = new Vector3 (0, 0, 1);
                        normals [(essais + cycle) * 4 + 2,xChunk + zChunk*ChunkX] = new Vector3 (0, 0, 1);
                        normals [(essais + cycle) * 4 + 3,xChunk + zChunk*ChunkX] = new Vector3 (0, 0, 1);
                       
                       
                        triangles [(essais + cycle) * 6 + 0,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 2;
                        triangles [(essais + cycle) * 6 + 1,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 1;
                        triangles [(essais + cycle) * 6 + 2,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 0;
                       
                        triangles [(essais + cycle) * 6 + 3,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 1;
                        triangles [(essais + cycle) * 6 + 4,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 2;
                        triangles [(essais + cycle) * 6 + 5,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 3;
                    }
                }
                // Create a new mesh and populate with data
                int[] ChunkTriangles = new int[numTris * 3*2];
                Vector3[] ChunkVertices = new Vector3[numverts * 3];
                Vector3[] ChunkNormals = new Vector3[numverts*3];
                Vector2[] ChunkUVs = new Vector2[numverts*3];

                for(x = 0 ;x < numTris * 3*2 ; x++)
                {
                    ChunkTriangles[x] = triangles[x,xChunk + zChunk*ChunkX];
                }
                for(x = 0 ;x < numTris * 3 ; x++)
                {
                    ChunkVertices[x] = vertices[x,xChunk + zChunk*ChunkX];
                    ChunkNormals[x] = normals[x,xChunk + zChunk*ChunkX];
                    ChunkUVs[x] = uv[x,xChunk + zChunk*ChunkX];
                }
                Mesh mesh = new Mesh ();
                mesh.vertices     = ChunkVertices;
                mesh.triangles     = ChunkTriangles;
                mesh.normals     = ChunkNormals;
                mesh.uv         = ChunkUVs;

                // Assign our mesh to our Flter/Renderer/Collider
                MeshFilter      mesh_filter   =     GetComponent<MeshFilter>();
                MeshCollider mesh_collider =     GetComponent<MeshCollider>();
                MeshRenderer mesh_renderer =     GetComponent<MeshRenderer>();

                mesh_filter.mesh = mesh;
            }
        }
    }
}

If anyone could come up with an idea it would be appreciated. If you have any idea on how it would be more optimized I would like it too !

PS: Sorry if I made spelling mistake I’m french

I made some changes to your script. Look for ‘kwd’ to see the changes.

The two problems you had were:

  • all meshes were offset the same amount, and going int he same place in space
  • all meshes were being added to one game object. This makes each prior mesh go away, or just “dangle” in memory, not rendered or anything.

I changed this:

  • all meshes are still generated in place (see my notes at the bottom of the code)
  • each mesh is on a separate game object
  • I recalculated bounds and normals automatically (not necessary really, just preferred)

Again, look for ‘kwd’ for the things I changed.

Kurt

using UnityEngine;
using System.Collections;

// kwd - removed component requirements

public class Code : MonoBehaviour {
    /*public int size_x = 100;
    public int size_z = 50;*/
 
    [HideInInspector]
    public int ChunkSize = 71;
 
 
    [Header("Ground properties")]
 
    //Overpass the 65 000 vertices limit
    public int ChunkX = 1;
    public int ChunkZ = 1;
 
    public float tileSize = 1.0f;
    [Range(0,70)]
    public int heightMax = 5;
    [Range(0,30)]
    public int flat = 10;
 
    public int[,] Matrix;
 
    // Use this for initialization
    void Start () {
        BuildMesh();
    }
 
    void BuildMesh(){
        // Fixing data
        int size_x = ChunkSize;
        int size_z = ChunkSize;
        int numTiles     = size_x * size_z;
        int numTris     = numTiles * 2 * 2;
        int numverts     = numTiles * 4;
        int numberOfChunks = ChunkX * ChunkZ;
        int[,] triangles    = new int [numTris * 3*2, numberOfChunks];
     
        // Generate the mesh Data
        Vector3[,] vertices = new Vector3[numverts * 3, numberOfChunks];
        Vector3[,] normals  = new Vector3[numverts*3, numberOfChunks];
        Vector2[,] uv       = new Vector2[numverts*3, numberOfChunks];
     
     
        // Generation on the Y axes
        Matrix = new int[size_x * ChunkX ,size_z * ChunkZ];
        int scale = 1;
        int power = 1;
        Vector2 v2SampleStart = new Vector2(0.0f, 0.0f);
        v2SampleStart = new Vector2(Random.Range (0.0f, 10000.0f), Random.Range (0.0f, 10000.0f));
        for (int x_y = 0; x_y < size_x * ChunkX ; x_y++) {
            for (int z_y = 0; z_y < size_z * ChunkZ ; z_y++) {
                float xCoord = v2SampleStart.x + x_y * scale;
                float yCoord = v2SampleStart.y + z_y * scale;
                Matrix[x_y, z_y] = (int) (heightMax * (Mathf.PerlinNoise (xCoord / flat, yCoord / flat)) * power);
            }
        }
     
        for(int zChunk = 0; zChunk < ChunkZ; zChunk++)
        {
            for(int xChunk = 0; xChunk < ChunkX; xChunk++)
            {
                // Generation of the planes
                int x, z = 0;
                for(z = 0 ; z < size_z ; z++){
                    for(x = 0 ; x < size_x ; x++){
                        int height = Matrix[x,z];
                        //Vertices
                        vertices[(x + z * size_x) * 4 + 0,xChunk + zChunk*ChunkX] = new Vector3((x + 0 + ChunkX * ChunkSize) * tileSize, height, (z + 0 + ChunkZ * ChunkSize) * tileSize);
                        vertices[(x + z * size_x) * 4 + 1,xChunk + zChunk*ChunkX] = new Vector3((x + 1 + ChunkX * ChunkSize) * tileSize, height, (z + 0 + ChunkZ * ChunkSize) * tileSize);
                        vertices[(x + z * size_x) * 4 + 2,xChunk + zChunk*ChunkX] = new Vector3((x + 0 + ChunkX * ChunkSize) * tileSize, height, (z + 1 + ChunkZ * ChunkSize) * tileSize);
                        vertices[(x + z * size_x) * 4 + 3,xChunk + zChunk*ChunkX] = new Vector3((x + 1 + ChunkX * ChunkSize) * tileSize, height, (z + 1 + ChunkZ * ChunkSize) * tileSize);
                        //Normals
                        normals [(x + z * size_x) * 4 + 0,xChunk + zChunk*ChunkX] = Vector3.up;
                        normals [(x + z * size_x) * 4 + 1,xChunk + zChunk*ChunkX] = Vector3.up;
                        normals [(x + z * size_x) * 4 + 2,xChunk + zChunk*ChunkX] = Vector3.up;
                        normals [(x + z * size_x) * 4 + 3,xChunk + zChunk*ChunkX] = Vector3.up;
                        //Uvs
                        uv [(x + z * size_x) * 4 + 0,xChunk + zChunk*ChunkX] = new Vector2(x + 0, z + 0);
                        uv [(x + z * size_x) * 4 + 1,xChunk + zChunk*ChunkX] = new Vector2(x + 1, z + 0);
                        uv [(x + z * size_x) * 4 + 2,xChunk + zChunk*ChunkX] = new Vector2(x + 0, z + 1);
                        uv [(x + z * size_x) * 4 + 3,xChunk + zChunk*ChunkX] = new Vector2(x + 1, z + 1);
                        //Triangles
                        //First
                        triangles[6 * (z * size_x + x) + 0,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 2;
                        triangles[6 * (z * size_x + x) + 1,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 1;
                        triangles[6 * (z * size_x + x) + 2,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 0;
                        //Second
                        triangles[6 * (z * size_x + x) + 3,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 1;
                        triangles[6 * (z * size_x + x) + 4,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 2;
                        triangles[6 * (z * size_x + x) + 5,xChunk + zChunk*ChunkX] = (x + z * size_x) * 4 + 3;
                    }
                }
                // Generation in the X axe
                int essais = 0;
                for(int cycle = 0; cycle < size_x * size_z - 1; cycle++){
                    essais = size_x * size_z + cycle;
                    if(((cycle+1) % size_x) != 0){
                        vertices[(essais) * 4 + 0,xChunk + zChunk*ChunkX] = vertices[1 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices[(essais) * 4 + 1,xChunk + zChunk*ChunkX] = vertices[3 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices[(essais) * 4 + 2,xChunk + zChunk*ChunkX] = vertices[4 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices[(essais) * 4 + 3,xChunk + zChunk*ChunkX] = vertices[6 + cycle * 4,xChunk + zChunk*ChunkX];
                     
                        normals [(essais) * 4 + 0,xChunk + zChunk*ChunkX] = new Vector3(1, 0, 0);
                        normals [(essais) * 4 + 1,xChunk + zChunk*ChunkX] = new Vector3(1, 0, 0);
                        normals [(essais) * 4 + 2,xChunk + zChunk*ChunkX] = new Vector3(1, 0, 0);
                        normals [(essais) * 4 + 3,xChunk + zChunk*ChunkX] = new Vector3(1, 0, 0);
                     
                     
                        triangles[(essais) * 6 + 0,xChunk + zChunk*ChunkX] = (essais) * 4 + 0;
                        triangles[(essais) * 6 + 1,xChunk + zChunk*ChunkX] = (essais) * 4 + 1;
                        triangles[(essais) * 6 + 2,xChunk + zChunk*ChunkX] = (essais) * 4 + 2;
                     
                        triangles[(essais) * 6 + 3,xChunk + zChunk*ChunkX] = (essais) * 4 + 3;
                        triangles[(essais) * 6 + 4,xChunk + zChunk*ChunkX] = (essais) * 4 + 2;
                        triangles[(essais) * 6 + 5,xChunk + zChunk*ChunkX] = (essais) * 4 + 1;
                    }
                }
             
                // Generation in the Z axe
                essais = essais + 1;
                for (int cycle = 0; cycle < size_x * (size_z - 1); cycle++) {
                    if(cycle != 0){
                        vertices [(essais + cycle) * 4 + 0,xChunk + zChunk*ChunkX] = vertices [2 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices [(essais + cycle) * 4 + 1,xChunk + zChunk*ChunkX] = vertices [3 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices [(essais + cycle) * 4 + 2,xChunk + zChunk*ChunkX] = vertices [0 + size_x * 4 + cycle * 4,xChunk + zChunk*ChunkX];
                        vertices [(essais + cycle) * 4 + 3,xChunk + zChunk*ChunkX] = vertices [1 + size_x * 4 + cycle * 4,xChunk + zChunk*ChunkX];
                     
                        normals [(essais + cycle) * 4 + 0,xChunk + zChunk*ChunkX] = new Vector3 (0, 0, 1);
                        normals [(essais + cycle) * 4 + 1,xChunk + zChunk*ChunkX] = new Vector3 (0, 0, 1);
                        normals [(essais + cycle) * 4 + 2,xChunk + zChunk*ChunkX] = new Vector3 (0, 0, 1);
                        normals [(essais + cycle) * 4 + 3,xChunk + zChunk*ChunkX] = new Vector3 (0, 0, 1);
                     
                     
                        triangles [(essais + cycle) * 6 + 0,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 2;
                        triangles [(essais + cycle) * 6 + 1,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 1;
                        triangles [(essais + cycle) * 6 + 2,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 0;
                     
                        triangles [(essais + cycle) * 6 + 3,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 1;
                        triangles [(essais + cycle) * 6 + 4,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 2;
                        triangles [(essais + cycle) * 6 + 5,xChunk + zChunk*ChunkX] = (essais + cycle) * 4 + 3;
                    }
                }
                // Create a new mesh and populate with data
                int[] ChunkTriangles = new int[numTris * 3*2];
                Vector3[] ChunkVertices = new Vector3[numverts * 3];
                Vector3[] ChunkNormals = new Vector3[numverts*3];
                Vector2[] ChunkUVs = new Vector2[numverts*3];
             
                for(x = 0 ;x < numTris * 3*2 ; x++)
                {
                    ChunkTriangles[x] = triangles[x,xChunk + zChunk*ChunkX];
                }
                for(x = 0 ;x < numTris * 3 ; x++)
                {
                    ChunkVertices[x] = vertices[x,xChunk + zChunk*ChunkX];
                    ChunkNormals[x] = normals[x,xChunk + zChunk*ChunkX];
                    ChunkUVs[x] = uv[x,xChunk + zChunk*ChunkX];
                }
                Mesh mesh = new Mesh ();
                mesh.vertices     = ChunkVertices;
                mesh.triangles     = ChunkTriangles;
                mesh.normals     = ChunkNormals;
                mesh.uv         = ChunkUVs;

                // kwd - added a new game object to hold each
                // new piece of mesh and renderer
             
                GameObject piece = new GameObject( "piece");

                // kwd - move that game object around to line up

                piece.transform.position = new Vector3( xChunk, 0, zChunk) * ChunkSize;
     
                // Assign our mesh to our Flter/Renderer/Collider
                MeshFilter      mesh_filter   =    piece.AddComponent<MeshFilter>();
                MeshCollider mesh_collider =     piece.AddComponent<MeshCollider>();
                MeshRenderer mesh_renderer =     piece.AddComponent<MeshRenderer>();
             
                mesh_filter.mesh = mesh;

                // kwd - I prefer doing this automatically initially...
                mesh.RecalculateBounds();
                mesh.RecalculateNormals ();

                // kwd - in the vertex generation above, I would recommend
                // making all pieces of ground around (0,0,0) in the mesh space,
                // then the center of the game object associated with it will
                // be close to where the geometry is.
            }
        }
    }
}
2 Likes

Thank you very much ! (for your precision and how quick you answered)
For all the meshes going in the same place in space, I observed that when I was changing the number of chunks, the only chunk appears in a spot defined by coordinates (ChunkX, ChunkZ). So I was admitting that the creation was working but was just replacing with new data each cycle.
Thank you again !

Félix Olivier

You are very welcome. That last recommendation though: if you make all the geometry “centered” around (0,0,0) on your game object, I think you will enjoy working in the editor much more, because then you can select a piece of ground in the editor, and press F to instantly Focus on the ground and see it clearly framed.

Also, when I work with procedural geometry, I like to put a checkered pattern texture (via material) onto things as early as possible, such that you can see what is going on in the geometry.

Also… I have found if you write your mesh-builder as a CoRoutine and move some things around a bit, you can see “on the fly” as the geometry is created and figure out where your problems are better. I have solved many of my bugs by turning a routine into a coroutine and then single-framing through to see visually where things are going.

That is all, I hope you have fun with your terrain!

Also, I have attached the test package I put together when looking at your code…

2162953–142993–TiledGeometry.unitypackage (18.7 KB)

I’ll try to change my program to have it centered.
I had a texture applied but not as intuitive as yours once again thank you for that !
I just downloaded your attachment but one thing is bugging me, why does the overall shape seem to have the same dimensions independently of the settings? I’ll be searching on my own but I would like to know if you have any advice concerning that!

Felix Olivier.