In my voxel engine, I have a vertex buffer for each 16*64*16 chunk. The vertex buffer is created at the maximum size needed (i.e. it has space for the whole chunk full of blocks), however most of the chunks are only half-full. This is done because each block has its own index in the vertex buffer (I have an equation to get the index), and if I made the VB smaller, it could result in access violations when adding blocks, even if the chunk was nowhere near full.
This results in huge memory wastage.
How could I minimise this wastage? I thought maybe I could have no indexing system, and just dump all the vertices in the VB, and make the VB only the size needed. But then I would have to recreate all the vertices and the VB every time I add a block, which could affect performance.
What is the best way to solve this problem?