Merge pull request #2967 from kacpherek/fix/blindness-sky-fog

Apply blindness fog and hide the blocked sky
This commit is contained in:
rdbt
2026-10-28 00:40:49 +00:00
committed by GitHub
3 changed files with 24 additions and 8 deletions
+12
View File
@@ -11764,6 +11764,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
@@ -14665,6 +14676,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,
@@ -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(),
+5 -6
View File
@@ -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 {