Smooth Lighting + Sodium 0.5.x: In some cases, blocks don't obstruct the passage of light.
Lolothepro opened this issue ยท 6 comments
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
Crash Report
reproduced, also heres the world preset string minecraft:bedrock,minecraft:snow,10*minecraft:air,minecraft:grass_block;minecraft:plains
@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));
}
Closing in favor of #2228 since this is a symptom of that problem.