From f35ee164128f73166c7be610e866c0911fcc8d6c Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 19:39:49 +0100 Subject: [PATCH] Apply blindness fog and hide the blocked sky --- crates/horizon-client/src/game.rs | 12 ++++++++++++ crates/horizon-client/src/game/render_tick.rs | 9 +++++++-- crates/horizon-client/src/gfx.rs | 11 +++++------ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 8e591cf3b..67ded3da7 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -11755,6 +11755,17 @@ impl Game<'_> { depth_far, underwater, title, + sky_blocked: self.potions.effects.get("blindness").is_some() + || self.potions.effects.get("darkness").is_some() + || matches!( + horizon_client::fog::fog_type( + &self.world, + self.res.facts(), + [camera.x, camera.y, camera.z], + self.forward(), + ), + horizon_client::fog::FogType::Lava | horizon_client::fog::FogType::PowderSnow + ), skybox: self.dim == Dim::Overworld && self.settings.horizon.sky, end_sky: self.dim == Dim::End && self.settings.horizon.sky, end_sky_sprite: self @@ -14655,6 +14666,7 @@ fn loading_frame(hud: &HudBatch) -> Frame<'_> { underwater: false, cave_culling: false, title: true, + sky_blocked: false, skybox: false, end_sky: false, end_sky_sprite: None, diff --git a/crates/horizon-client/src/game/render_tick.rs b/crates/horizon-client/src/game/render_tick.rs index 26a5a81cd..ddfd0a335 100644 --- a/crates/horizon-client/src/game/render_tick.rs +++ b/crates/horizon-client/src/game/render_tick.rs @@ -108,7 +108,11 @@ impl Game<'_> { rain, thunder, skybox: self.dim == Dim::Overworld, - blindness: None, + blindness: self + .potions + .effects + .get("blindness") + .map(|effect| (effect.duration, effect.duration == -1)), darkness: self.darkness_fog(), darken_world: self .boss_overlay @@ -140,7 +144,8 @@ impl Game<'_> { } else { 63.0 }; - camera.y < horizon + self.dim == Dim::Overworld + && camera.y < horizon && fog_type( &self.world, self.res.facts(), diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index ad1fd0561..e5a168d15 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -105,12 +105,9 @@ const COMPLETE_COLUMN: u32 = (1 << (crate::chunk::HEIGHT / 16)) - 1; /// its fixed-point UVs (`terrain.wgsl`'s `terrain_uv`). /// The world pass again after occlusion culling's test: it loads both /// targets (phase 2 draws over phase 1, reading the test's results). -/// LevelRenderer: no sky inside lava or powder snow (sky fog ends within 2 blocks). +/// `LevelRenderer.addSkyPass`: fluids and camera effects block the sky pass. fn sky_open(frame: &Frame) -> bool { - match frame.fog { - Some(f) => f.sky_end > 2.0, - None => !frame.underwater, - } + !frame.sky_blocked } /// The Overworld-style sky (disc, sunset, stars, void) draws this frame. @@ -235,6 +232,8 @@ pub struct Frame<'a> { pub cave_culling: bool, /// Title screen: only the dedicated panorama cube map and the HUD. pub title: bool, + /// Lava, powder snow, blindness or darkness blocks the sky pass. + pub sky_blocked: bool, /// Dimensions without a skybox (the Nether) clear to the fog colour. pub skybox: bool, /// The End: clear to black and draw the resident sky box behind the world. @@ -4508,7 +4507,7 @@ impl Renderer { cull.bind_depth(&self.device, world_depth); } let cull = self.cull.as_ref().filter(|_| culling && solid_draws > 0); - let clear = if frame.title || (frame.end_sky && !frame.underwater) { + let clear = if frame.title || (frame.end_sky && !frame.underwater && sky_open(frame)) { wgpu::Color::BLACK } else { wgpu::Color {