diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/occlusion/OcclusionCuller.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/occlusion/OcclusionCuller.java index 554a968b0..4c832c0e3 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/occlusion/OcclusionCuller.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/occlusion/OcclusionCuller.java @@ -177,8 +177,13 @@ private static int nearestToZero(int min, int max) { return clamped; } + // The bounding box of a chunk section must be large enough to contain all possible geometry within it. Block models + // can extend outside a block volume by +/- 1.0 blocks on all axis. Additionally, we make use of a small epsilon + // to deal with floating point imprecision during a frustum check (see GH#2132). + private static final float CHUNK_SECTION_SIZE = 8.0f /* chunk bounds */ + 1.0f /* maximum model extent */ + 0.125f /* epsilon */; + public static boolean isOutsideFrustum(Viewport viewport, RenderSection section) { - return !viewport.isBoxVisible(section.getCenterX(), section.getCenterY(), section.getCenterZ(), 8.0f); + return !viewport.isBoxVisible(section.getCenterX(), section.getCenterY(), section.getCenterZ(), CHUNK_SECTION_SIZE); } private void init(Consumer visitor,