Skip to content

Commit

Permalink
Fix overdraw between surfaces at chunk boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
patowen committed Apr 26, 2024
1 parent f6ba498 commit 7738b0f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/shaders/surface-extraction/extract.comp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 7738b0f

Please sign in to comment.