From fae9e9dfa9ae73fe1846a3fa3634ec8aa16d7fde Mon Sep 17 00:00:00 2001 From: octarine-noise Date: Sun, 16 May 2021 12:02:42 +0200 Subject: [PATCH] adopt AO calculation tweak from Indigo --- gradle.properties | 2 +- .../render/lighting/VanillaAoCalculation.kt | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 260aca7..78e6629 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.daemon=false group = com.github.octarine-noise jarName = BetterFoliage-Forge -version = 2.6.1 +version = 2.6.3 mcVersion = 1.15.2 forgeVersion = 31.2.44 diff --git a/src/main/kotlin/mods/betterfoliage/render/lighting/VanillaAoCalculation.kt b/src/main/kotlin/mods/betterfoliage/render/lighting/VanillaAoCalculation.kt index d2eb5e7..f0987a1 100644 --- a/src/main/kotlin/mods/betterfoliage/render/lighting/VanillaAoCalculation.kt +++ b/src/main/kotlin/mods/betterfoliage/render/lighting/VanillaAoCalculation.kt @@ -23,6 +23,10 @@ data class LightingData( } } +// Vanilla has a very suspicious-looking offset here, which Indigo gets rid of and calls it a fix +// Naturally, we're going to believe Indigo, it's a hardcoded option for now +const val OCCLUSION_OFFSET_FIX = true + /** * Replacement for [BlockModelRenderer.AmbientOcclusionFace] * This gets called on a LOT, so object instantiation is avoided. @@ -87,9 +91,9 @@ class VanillaAoCalculator { sideHelper.sides.forEachIndexed { sideIdx, sideDir -> // record light data in the block 1 step to the side probe.position { setPos(lightOrigin).move(sideDir) }.writeTo(sideAo[sideIdx]) - // side is considered occluded if the block 1 step to that side and - // 1 step forward (in the lightface direction) is not fully transparent - isOccluded[sideIdx] = probe.position { move(lightFace) }.isNonTransparent + // side is considered occluded if the block 1 step to that side is not fully transparent + if (!OCCLUSION_OFFSET_FIX) probe.position { move(lightFace) } + isOccluded[sideIdx] = probe.isNonTransparent } // AO Calculation for the 4 corners