From 739662b73b0b9403c723594a639a46ee2dc7bc8b Mon Sep 17 00:00:00 2001 From: Patrick Owen Date: Sun, 21 Apr 2024 01:24:51 -0400 Subject: [PATCH] Fix overdraw between surfaces at chunk boundaries --- client/shaders/surface-extraction/extract.comp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/shaders/surface-extraction/extract.comp b/client/shaders/surface-extraction/extract.comp index bab68ef6..5a969030 100644 --- a/client/shaders/surface-extraction/extract.comp +++ b/client/shaders/surface-extraction/extract.comp @@ -76,6 +76,9 @@ bool find_face(out Face info) { // Flip face around if the neighbor is the solid one info.inward = self_mat == 0; info.material = self_mat | neighbor_mat; + // If self or neighbor is a void margin, then no surface should be generated, as any surface + // that would be rendered is the responsibility of the adjacent chunk. + if ((self_mat == 0 && info.voxel[info.axis] == dimension) || (neighbor_mat == 0 && neighbor[info.axis] == -1)) return false; return (neighbor_mat == 0) != (self_mat == 0); }