Skip to content

Commit dfb64d1

Browse files
committed
fix: always remesh gen-0 chunks to fix border face culling
1 parent 4d403f9 commit dfb64d1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/client/world/ChunkManager.zig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,12 @@ pub const ChunkManager = struct {
805805
// Apply the new mesh
806806
render_chunk_ptr.setMesh(result.mesh);
807807

808-
// A neighbor arrived while this chunk was being meshed — the mesh we just
809-
// applied may have stale boundary faces. Queue a follow-up remesh now that
810-
// the chunk is in .ready state (setMesh transitions to .ready).
811-
if (render_chunk_ptr.needs_remesh.swap(false, .acq_rel)) {
808+
// Initial mesh (gen 0) was generated on the worker before the RenderChunk
809+
// existed in storage. Neighbors generated concurrently couldn't see this chunk,
810+
// and this chunk's mesh may not have seen them. Always follow up with a remesh
811+
// to capture all currently-loaded neighbors and fix boundary face culling.
812+
// For subsequent meshes (gen > 0), only remesh if a neighbor arrived during meshing.
813+
if (result.mesh_generation == 0 or render_chunk_ptr.needs_remesh.swap(false, .acq_rel)) {
812814
self.queueChunkRemesh(result.pos);
813815
}
814816

0 commit comments

Comments
 (0)