diff --git a/common/src/terrain/block.rs b/common/src/terrain/block.rs index f346ee4cb8..e5717ee025 100644 --- a/common/src/terrain/block.rs +++ b/common/src/terrain/block.rs @@ -26,11 +26,11 @@ impl Block { } } - pub fn get_opacity(&self) -> f32 { + pub fn get_opacity(&self) -> Option { match self.kind { - 0 => 0.0, - 1 => 0.3, - 2 => 1.0, + 0 => None, + 1 => Some(0.85), + 2 => Some(1.0), _ => unimplemented!(), } } diff --git a/voxygen/src/mesh/terrain.rs b/voxygen/src/mesh/terrain.rs index d3619b615b..1b70885145 100644 --- a/voxygen/src/mesh/terrain.rs +++ b/voxygen/src/mesh/terrain.rs @@ -51,7 +51,7 @@ impl + ReadVol + Debug, S: VolSize + Clone> Meshable for for x in range.min.x + 1..range.max.x - 1 { for y in range.min.y + 1..range.max.y - 1 { - let mut neighbour_light = [[1.0f32; 3]; 3]; + let mut neighbour_light = [[(1.0f32, 0.0); 3]; 3]; for z in (range.min.z..range.max.z).rev() { let pos = Vec3::new(x, y, z); @@ -62,7 +62,7 @@ impl + ReadVol + Debug, S: VolSize + Clone> Meshable for .iter() .map(|col| col.iter()) .flatten() - .fold(0.0, |a, x| a + x) + .fold(0.0, |a, (x, _)| a + x) / 9.0; let light = avg_light; @@ -85,13 +85,19 @@ impl + ReadVol + Debug, S: VolSize + Clone> Meshable for // Accumulate shade under opaque blocks for i in 0..3 { for j in 0..3 { - neighbour_light[i][j] = if let Ok(opacity) = self + let max_opacity = neighbour_light[i][j].1; + neighbour_light[i][j] = if let Some(opacity) = self .get(pos + Vec3::new(i as i32 - 1, j as i32 - 1, 0)) - .map(|vox| vox.get_opacity()) + .ok() + .and_then(|vox| vox.get_opacity()) { - neighbour_light[i][j] * (1.0 - opacity * 0.5) + ( + (neighbour_light[i][j].0 * (1.0 - max_opacity * 0.3)) + .max(1.0 - max_opacity * 0.999), + max_opacity.max(opacity), + ) } else { - (neighbour_light[i][j] * 1.05).min(1.0) + ((neighbour_light[i][j].0 * 1.02).min(1.0), max_opacity) }; } } diff --git a/world/src/sim.rs b/world/src/sim.rs index 987ae0451a..f2049f6076 100644 --- a/world/src/sim.rs +++ b/world/src/sim.rs @@ -181,7 +181,7 @@ impl<'a> Sampler<'a> { .mul(0.5); // Colours - let cold_grass = Rgb::new(0.1, 0.6, 0.3); + let cold_grass = Rgb::new(0.0, 0.55, 0.15); let warm_grass = Rgb::new(0.25, 0.8, 0.05); let cold_stone = Rgb::new(0.55, 0.7, 0.75); let warm_stone = Rgb::new(0.65, 0.65, 0.35); @@ -461,7 +461,6 @@ impl SimChunk { .add(1.0) .mul(0.5) .mul(1.0 - chaos * 0.85) - .mul(1.2) .add(0.1) .mul(if alt > SEA_LEVEL + 2.0 { 1.0 } else { 0.0 }), }