Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.
Rust differential-testinggame-enginegamedevlinuxminecraftminecraft-javareimplementationrustvoxelvulkanwgpu
HDR: fog hides light sources, animated sprites keep shining, the vignette keeps the lift
Senjinf5be69df7033
diff --git a/crates/horizon-client-render/src/entity.wgsl b/crates/horizon-client-render/src/entity.wgslindex 6dab91ac1..119bd43a6 100644--- a/crates/horizon-client-render/src/entity.wgsl+++ b/crates/horizon-client-render/src/entity.wgsl@@ -329,7 +329,10 @@ fn shadow_color(in: Out) -> vec4<f32> {if in.overlay == 6u { uv.y = in.wrap.x + fract(in.uv.y) * in.wrap.y; }let texel = textureSample(atlas, atlas_sampler, uv);if in.tier == 0u || texel.a < 0.1 { discard; }- return vec4(0.0, 0.0, 0.0, hdr_mark(in.tier, brightness(texel.rgb * in.color.rgb)));+ // Fog hides a light source as it hides everything else.+ let fogged = max(linear_fog(in.spherical, globals.fog.x, globals.fog.y),+ linear_fog(in.cylindrical, globals.fog.z, globals.fog.w)) * globals.fog_color.a;+ return vec4(0.0, 0.0, 0.0, hdr_mark(in.tier, brightness(texel.rgb * in.color.rgb) * (1.0 - fogged)));}fn brightness(c: vec3<f32>) -> f32 {let l = pow(max(c, vec3(0.0)), vec3(2.2));diff --git a/crates/horizon-client-render/src/hdr.wgsl b/crates/horizon-client-render/src/hdr.wgslindex b053817c6..ebb4c25af 100644--- a/crates/horizon-client-render/src/hdr.wgsl+++ b/crates/horizon-client-render/src/hdr.wgsl@@ -53,7 +53,7 @@ fn shows_world(c: vec3<f32>, w: vec3<f32>) -> bool {return true;}let f = (c.r + c.g + c.b) / max(w.r + w.g + w.b, 1.0 / 255.0);- return f <= 1.01 && f > 0.5 && all(abs(c - f * w) <= 0.03 * w + 1.0 / 255.0);+ return f <= 1.01 && f > 0.02 && all(abs(c - f * w) <= 0.03 * w + 1.0 / 255.0);}// Linear BT.709 to BT.2020 (ITU-R BT.2087), columns first.diff --git a/crates/horizon-client-render/src/terrain.wgsl b/crates/horizon-client-render/src/terrain.wgslindex 6b990664e..3162cec2b 100644--- a/crates/horizon-client-render/src/terrain.wgsl+++ b/crates/horizon-client-render/src/terrain.wgsl@@ -463,8 +463,12 @@ fn solid_finish(in: TerrainOut, texel: vec4<f32>, color: vec4<f32>) -> vec4<f32>let l = in.layer & 0x7fffu;let t = textureLoad(emission_thresholds, vec2(i32(l % SPRITE_SPLIT), i32(l / SPRITE_SPLIT)), 0);let y = brightness(texel.rgb);- if y >= select(t.r, t.g, whole) {- emissive = hdr_mark(tier, y);+ // All over means all over: the sprite's range is one frame's, and an animated sprite's+ // other frames dip below it. Fog hides a light source as it hides everything else.+ if whole || y >= t.r {+ let fogged = max(linear_fog(in.spherical, globals.fog.x, globals.fog.y),+ linear_fog(in.cylindrical, globals.fog.z, globals.fog.w)) * globals.fog_color.a;+ emissive = hdr_mark(tier, y * (1.0 - fogged));}}if in.emissive_layer != 0xffffffffu {