fix 3-layer clouds culling at low render distances

This commit is contained in:
James Seibel
2026-06-06 11:04:20 -05:00
parent a4e2003e0e
commit b836f675e1
@@ -388,16 +388,17 @@ public class CloudRenderHandler
float newMinPosX = float newMinPosX =
cloudParams.deltaOffsetX cloudParams.deltaOffsetX
+ (cloudParams.instanceOffsetX * cloudParams.widthInBlocks) + (cloudParams.instanceOffsetX * cloudParams.widthInBlocks)
+ instanceOffsetX + cloudParams.halfWidthInBlocks; + instanceOffsetX + cloudParams.halfWidthInBlocks;
float newMinPosY = float newMinPosY =
this.level.getLevelWrapper().getMaxHeight() this.level.getLevelWrapper().getMaxHeight()
+ 200 // render clouds at least 200 blocks above the height limit to prevent players/blocks from intersecting (since DH always renders behind everything else) + 200 // render clouds at least 200 blocks above the height limit to prevent players/blocks from intersecting (since DH always renders behind everything else)
+ cloudParams.heightOffset; + cloudParams.heightOffset;
float newMinPosZ = cloudParams.deltaOffsetZ float newMinPosZ =
+ (cloudParams.instanceOffsetZ * cloudParams.widthInBlocks) cloudParams.deltaOffsetZ
+ instanceOffsetZ + cloudParams.halfWidthInBlocks; + (cloudParams.instanceOffsetZ * cloudParams.widthInBlocks)
+ instanceOffsetZ + cloudParams.halfWidthInBlocks;
boolean cullCloud = this.shouldCloudBeCulled( boolean cullCloud = this.shouldCloudBeCulled(
newMinPosX, newMinPosY, newMinPosZ, newMinPosX, newMinPosY, newMinPosZ,
@@ -515,10 +516,13 @@ public class CloudRenderHandler
DhVec3f cameraLookAtVector = MC_RENDER.getLookAtVector(); DhVec3f cameraLookAtVector = MC_RENDER.getLookAtVector();
cameraLookAtVector.normalize(); cameraLookAtVector.normalize();
double renderDistance = Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius.get() double renderDistance =
// * 1.5 is so we have a little extra buffer where clouds will render further than // minimum distance of 256 to handle 3-layer clouds correctly,
// necessary to prevent seeing the cloud border // otherwise the upper layers will be culled
* LodUtil.CHUNK_WIDTH * 1.5; Math.max(Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius.get(), 256)
// * 1.5 is so we have a little extra buffer where clouds will render further than
// necessary to prevent seeing the cloud border
* LodUtil.CHUNK_WIDTH * 1.5;