Sodium

Sodium

35M Downloads

Smooth Lighting + Sodium 0.5.x: In some cases, blocks don't obstruct the passage of light.

Lolothepro opened this issue ยท 6 comments

commented

Bug Description

2023-08-30.14-01-25.mp4

This does not happen with Sodium 0.4.10

Reproduction Steps

Watch the video (snow required)

Log File

latest.log

Crash Report

crash-2023-08-30_14.04.50-client.txt

commented

Can you post the expected result?

commented

Can you post the expected result?

2023-08-30.17-52-38.mp4
commented

reproduced, also heres the world preset string minecraft:bedrock,minecraft:snow,10*minecraft:air,minecraft:grass_block;minecraft:plains

commented

The behavior in vanilla is indescribably insane and I have no idea what it's doing (or what it's even trying to accomplish for that matter.)

image
image

I'm not going to "fix" our renderer so that it replicates the insane vanilla behavior.

commented

@jellysquid3 When it was being discussed on Discord, I recall finding that the issue with it not dimming when Sodium is installed is fixed by rounding the lightmap coordinates before they are encoded - see below patch.

diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/vertex/format/impl/CompactChunkVertex.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/vertex/format/impl/CompactChunkVertex.java
index c192ac7c..1a25dd09 100644
--- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/vertex/format/impl/CompactChunkVertex.java
+++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/vertex/format/impl/CompactChunkVertex.java
@@ -62,6 +62,14 @@ public class CompactChunkVertex implements ChunkVertexType {
         int block = (light >> 4) & 0xF;
         int sky = (light >> 20) & 0xF;
 
+        // round
+        if(((light >> 0) & 0xF) > 0x7 && block < 0xF) {
+            block++;
+        }
+        if(((light >> 16) & 0xF) > 0x7 && sky < 0xF) {
+            sky++;
+        }
+
         return ((block << 0) | (sky << 4));
     }
commented

Closing in favor of #2228 since this is a symptom of that problem.