1
\$\begingroup\$

I am making an infinite voxel terrain that generates around the player. The blue boxes are the chunks that are currently loaded and the white ones are unloaded.

When building the mesh for a chunk I check if the blocks in the edges of surrounding chunks are air blocks and add a face if they are. The issue comes when the is no chunk loaded adjacent to a chunks mesh and so I don't add a face these since the player isn't going to see it (as is the case for the 8 chunks on the outside).

chunks 1

And so when the player moves and new chunks are generated there will be a seam because the remember the previous chunks had no way to tell if there was a block there in the first place.

chunks 2

One way I tried to fix this is to rebuild the meshes of chunks adjacent to the newly generated chunks which works but I feel like there is a simpler solution to this problem.

Any pointers will be super helpful. Thanks.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

For every chunk mesh you have to render you need to create the chunk data of its neighbors.

And no, this does not create an endless loop since chunks have two stages of initialisation: first is generate data (for example from simplex noise of whatever algorithm) and the second stage is to create a mesh from the data. For the neighbors you only need the data. mesh is only needed when actually rendering the chunk.

I used this in my minecraft-like game and it worked well.

\$\endgroup\$

You must log in to answer this question.

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