From 920d7db5f688fb2e87228d9b2411c41fb536cfc2 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Tue, 2 Sep 2025 03:00:06 +1000 Subject: [PATCH] optionally disable emission to vanilla depth --- .../voxy/client/core/IrisVoxyRenderPipeline.java | 12 +++++++----- .../me/cortex/voxy/client/iris/IrisShaderPatch.java | 7 ++++++- .../voxy/client/iris/IrisVoxyRenderPipelineData.java | 2 ++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/cortex/voxy/client/core/IrisVoxyRenderPipeline.java b/src/main/java/me/cortex/voxy/client/core/IrisVoxyRenderPipeline.java index 36557db0..e64dbe0d 100644 --- a/src/main/java/me/cortex/voxy/client/core/IrisVoxyRenderPipeline.java +++ b/src/main/java/me/cortex/voxy/client/core/IrisVoxyRenderPipeline.java @@ -130,11 +130,13 @@ public class IrisVoxyRenderPipeline extends AbstractRenderPipeline { @Override protected void finish(Viewport viewport, int sourceFrameBuffer) { - glColorMask(false, false, false, false); - AbstractRenderPipeline.transformBlitDepth(this.depthBlit, - this.fbTranslucent.getDepthTex().id, sourceFrameBuffer, - viewport, new Matrix4f(viewport.vanillaProjection).mul(viewport.modelView)); - glColorMask(true, true, true, true); + if (this.data.renderToVanillaDepth) { + glColorMask(false, false, false, false); + AbstractRenderPipeline.transformBlitDepth(this.depthBlit, + this.fbTranslucent.getDepthTex().id, sourceFrameBuffer, + viewport, new Matrix4f(viewport.vanillaProjection).mul(viewport.modelView)); + glColorMask(true, true, true, true); + } } diff --git a/src/main/java/me/cortex/voxy/client/iris/IrisShaderPatch.java b/src/main/java/me/cortex/voxy/client/iris/IrisShaderPatch.java index bc831b05..3a0b9685 100644 --- a/src/main/java/me/cortex/voxy/client/iris/IrisShaderPatch.java +++ b/src/main/java/me/cortex/voxy/client/iris/IrisShaderPatch.java @@ -23,6 +23,7 @@ public class IrisShaderPatch { public static final boolean IMPERSONATE_DISTANT_HORIZONS = System.getProperty("voxy.impersonateDHShader", "false").equalsIgnoreCase("true"); + private static final class SSBODeserializer implements JsonDeserializer> { @Override public Int2ObjectOpenHashMap deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { @@ -116,7 +117,7 @@ public class IrisShaderPatch { public Int2ObjectOpenHashMap ssbos; @JsonAdapter(BlendStateDeserializer.class) public Int2ObjectOpenHashMap blending; - + public boolean excludeLodsFromVanillaDepth; public boolean checkValid() { return this.opaqueDrawBuffers != null && this.translucentDrawBuffers != null && this.uniforms != null && this.opaquePatchData != null; } @@ -163,6 +164,10 @@ public class IrisShaderPatch { return this.patchData.translucentDrawBuffers; } + public boolean emitToVanillaDepth() { + return !this.patchData.excludeLodsFromVanillaDepth; + } + public Runnable createBlendSetup() { if (this.patchData.blending == null || this.patchData.blending.isEmpty()) { return ()->{};//No blending change diff --git a/src/main/java/me/cortex/voxy/client/iris/IrisVoxyRenderPipelineData.java b/src/main/java/me/cortex/voxy/client/iris/IrisVoxyRenderPipelineData.java index 93e81b4d..31872c22 100644 --- a/src/main/java/me/cortex/voxy/client/iris/IrisVoxyRenderPipelineData.java +++ b/src/main/java/me/cortex/voxy/client/iris/IrisVoxyRenderPipelineData.java @@ -46,6 +46,7 @@ public class IrisVoxyRenderPipelineData { private final Runnable blendingSetup; private final ImageSet imageSet; private final SSBOSet ssboSet; + public final boolean renderToVanillaDepth; private IrisVoxyRenderPipelineData(IrisShaderPatch patch, int[] opaqueDrawTargets, int[] translucentDrawTargets, StructLayout uniformSet, Runnable blendingSetup, ImageSet imageSet, SSBOSet ssboSet) { this.opaqueDrawTargets = opaqueDrawTargets; this.translucentDrawTargets = translucentDrawTargets; @@ -55,6 +56,7 @@ public class IrisVoxyRenderPipelineData { this.blendingSetup = blendingSetup; this.imageSet = imageSet; this.ssboSet = ssboSet; + this.renderToVanillaDepth = patch.emitToVanillaDepth(); } public SSBOSet getSsboSet() {