diff --git a/crates/horizon-client/src/streaming.rs b/crates/horizon-client/src/streaming.rs index 664606fbe..1837216e5 100644 --- a/crates/horizon-client/src/streaming.rs +++ b/crates/horizon-client/src/streaming.rs @@ -821,13 +821,21 @@ impl Streaming { self.waiting.insert((x, sy, z)); continue; } - // Once per column: the 3x3 lit check would otherwise repeat for - // each of its sections every frame. - let lit = &self.lit; + // Once per column: the 3x3 check would otherwise repeat for each + // of its sections every frame. A neighbour being lit or waiting + // for light dirties this column again when it finishes (new + // chunks relight their eight neighbours), so mesh once its light + // has settled rather than once per neighbour. + let (lit, lighting, dirty_light) = (&self.lit, &self.lighting, &world.dirty_light); let ready = *ready_columns.entry((x, z)).or_insert_with(|| { - (-1..=1).all(|dz| (-1..=1).all(|dx| lit.contains(&(x + dx, z + dz)))) + (-1..=1).all(|dz| { + (-1..=1).all(|dx| { + let n = (x + dx, z + dz); + lit.contains(&n) && !lighting.contains_key(&n) && !dirty_light.contains(&n) + }) + }) }); - if !ready || self.lighting.contains_key(&(x, z)) { + if !ready { continue; } let region = columns