Search Unity

Grid based procedural world generation Mesh failure

Discussion in 'Scripting' started by badacsonyigorenyember, Jul 4, 2022.

  1. badacsonyigorenyember

    badacsonyigorenyember

    Joined:
    Jul 3, 2021
    Posts:
    6
    Hey guys! I'm trying to make something with IndividualKex's tutorial about how to make a grid based procedural map (). It works properly, when the size of the map is around 100 or lower, but if I try to make a bigger map, it is not working properly. I think the problem is with the Mesh's vertices. It looks like this as a 100x100 grid. With 200x200 it is like this, and with 500x500 it's like this. From the tutorial, there is a method called DrawTerrainMesh. I think this is the problematic part, but i don't know where exactly.
     
  2. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    4,011
    By default meshes start with a 16 bit index buffer which only allows to address 64k vertices. You have to explicitly change the indexFormat to 32 bit before you assign any data to the mesh object. With a 32 bit index buffer you can address about 4 billion vertices. Keep in mind that a 32 bit index buffer requires twice the size for the same amount of indices.
     
    badacsonyigorenyember likes this.