From 4ad081e0c692464afaff9ff6c6a1f37c98bfa9e3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 25 Oct 2021 22:20:00 -0500 Subject: [PATCH] Add a advanced graphics option to use a extended near clip plain This prevents some overdraw issues but causes LODs in the ocean to render incorrectly. --- src/main/java/com/seibel/lod/config/LodConfig.java | 12 +++++++++++- src/main/java/com/seibel/lod/render/LodRenderer.java | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/seibel/lod/config/LodConfig.java b/src/main/java/com/seibel/lod/config/LodConfig.java index a9d570a59..235e76117 100644 --- a/src/main/java/com/seibel/lod/config/LodConfig.java +++ b/src/main/java/com/seibel/lod/config/LodConfig.java @@ -53,7 +53,7 @@ import net.minecraftforge.fml.config.ModConfig; * This handles any configuration the user has access to. * @author Leonardo Amato * @author James Seibel - * @version 10-24-2021 + * @version 10-25-2021 */ @Mod.EventBusSubscriber public class LodConfig @@ -238,6 +238,8 @@ public class LodConfig public final ForgeConfigSpec.EnumValue gpuUploadMethod; + public final ForgeConfigSpec.BooleanValue useExtendedNearClipPlane; + AdvancedGraphicsOption(ForgeConfigSpec.Builder builder) { @@ -299,6 +301,14 @@ public class LodConfig + " " + GpuUploadMethod.BUFFER_MAPPING + ": Slow rendering but won't stutter when uploading. Possibly better than " + GpuUploadMethod.SUB_DATA + " if using a integrated GPU. \n") .defineEnum("GPU Upload Method", GpuUploadMethod.BUFFER_STORAGE); + // This is a temporary fix (like vanilla overdraw) + // hopefully we can remove both once we get individual chunk rendering figured out + useExtendedNearClipPlane = builder + .comment("\n\n" + + " Will prevent some overdraw issues, but may cause nearby fake chunks to render incorrectly \n" + + " especially when in/near an ocean. \n") + .define("Use Extended Near Clip Plane", false); + builder.pop(); } diff --git a/src/main/java/com/seibel/lod/render/LodRenderer.java b/src/main/java/com/seibel/lod/render/LodRenderer.java index 27e7759a9..c9aa5fa6a 100644 --- a/src/main/java/com/seibel/lod/render/LodRenderer.java +++ b/src/main/java/com/seibel/lod/render/LodRenderer.java @@ -568,7 +568,7 @@ public class LodRenderer Matrix4f.perspective( getFov(partialTicks, true), (float) this.mc.getWindow().getScreenWidth() / (float) this.mc.getWindow().getScreenHeight(), - vanillaBlockRenderedDistance / 5, + LodConfig.CLIENT.graphics.advancedGraphicsOption.useExtendedNearClipPlane.get() ? vanillaBlockRenderedDistance / 5 : 1, farPlaneBlockDistance * LodUtil.CHUNK_WIDTH / 2); // get Minecraft's un-edited projection matrix