diff --git a/assets/voxygen/shaders/fluid-frag.glsl b/assets/voxygen/shaders/fluid-frag.glsl index fab8149bc6..ffba9efc6e 100644 --- a/assets/voxygen/shaders/fluid-frag.glsl +++ b/assets/voxygen/shaders/fluid-frag.glsl @@ -21,15 +21,15 @@ out vec4 tgt_color; void main() { vec3 light = get_sun_diffuse(f_norm, time_of_day.x) * f_light + light_at(f_pos, f_norm); - vec3 surf_color = f_col * light; + vec3 surf_color = f_col * light; float fog_level = fog(f_pos.xy, focus_pos.xy); vec3 fog_color = get_sky_color(normalize(f_pos - cam_pos.xyz), time_of_day.x); vec3 cam_to_frag = normalize(f_pos - cam_pos.xyz); vec3 warped_norm = normalize(f_norm + smooth_rand(f_pos * 0.35, tick.x) * 0.2); - vec3 reflect_color = get_sky_color(reflect(cam_to_frag, warped_norm), time_of_day.x); - float passthrough = max(dot(f_norm, -cam_to_frag), 0.0); + vec3 reflect_color = get_sky_color(reflect(cam_to_frag, warped_norm), time_of_day.x) * light; + float passthrough = dot(faceforward(f_norm, f_norm, cam_to_frag), -cam_to_frag); vec4 color = mix(vec4(reflect_color, 1.0), vec4(surf_color, f_opac), passthrough); diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index dadc527fd7..89cfceecdd 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -108,7 +108,7 @@ impl<'a> System<'a> for Sys { if terrain .get(block_pos) - .map(|vox| !vox.is_empty()) + .map(|vox| vox.is_solid()) .unwrap_or(false) { let player_aabb = Aabb { @@ -183,7 +183,7 @@ impl<'a> System<'a> for Sys { .filter(|(block_pos, _)| { terrain .get(*block_pos) - .map(|vox| !vox.is_empty()) + .map(|vox| vox.is_solid()) .unwrap_or(false) }) // Find the maximum of the minimum collision axes (this bit is weird, trust me that it works) diff --git a/common/src/terrain/block.rs b/common/src/terrain/block.rs index 812391f416..e6650576ad 100644 --- a/common/src/terrain/block.rs +++ b/common/src/terrain/block.rs @@ -34,6 +34,14 @@ impl BlockKind { _ => true, } } + + pub fn is_solid(&self) -> bool { + match self { + BlockKind::Air => false, + BlockKind::Water => false, + _ => true, + } + } } #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] diff --git a/voxygen/src/mesh/terrain.rs b/voxygen/src/mesh/terrain.rs index f8c30ea446..ded6a4415b 100644 --- a/voxygen/src/mesh/terrain.rs +++ b/voxygen/src/mesh/terrain.rs @@ -13,12 +13,12 @@ use vek::*; type TerrainVertex = ::Vertex; type FluidVertex = ::Vertex; -fn block_shadow_density(kind: BlockKind) -> Option { +fn block_shadow_density(kind: BlockKind) -> (f32, f32) { match kind { - BlockKind::Air => None, - BlockKind::Normal => Some(0.85), - BlockKind::Dense => Some(3.0), - BlockKind::Water => Some(0.8), + BlockKind::Air => (0.0, 0.0), + BlockKind::Normal => (0.085, 0.3), + BlockKind::Dense => (0.3, 0.0), + BlockKind::Water => (0.08, 0.0), } } @@ -94,16 +94,14 @@ 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[0][i][j] = if let Some(density) = self + let (density, cap) = self .get(pos + Vec3::new(i as i32 - 1, j as i32 - 1, -1)) .ok() - .and_then(|vox| block_shadow_density(vox.kind())) - { - (neighbour_light[0][i][j] * (1.0 - density * 0.1)) - .max(1.0 - density) - } else { - (neighbour_light[0][i][j] * 1.025).min(1.0) - }; + .map(|vox| block_shadow_density(vox.kind())) + .unwrap_or((0.0, 0.0)); + + neighbour_light[0][i][j] = + (neighbour_light[0][i][j] * (1.0 - density)).max(cap); } } diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index 7b1dcd6123..0e70764ac5 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -163,7 +163,7 @@ impl<'a> BlockGen<'a> { let (definitely_underground, height, water_height) = if (wposf.z as f32) < alt - 64.0 * chaos { // Shortcut warping - (true, alt, water_level) + (true, alt, CONFIG.sea_level /*water_level*/) } else { // Apply warping let warp = (world @@ -204,7 +204,11 @@ impl<'a> BlockGen<'a> { (alt + warp).max(cliff_height) }; - (false, height, (water_level + warp).max(CONFIG.sea_level)) + ( + false, + height, + /*(water_level + warp).max(*/ CONFIG.sea_level, /*)*/ + ) }; // Sample blocks @@ -250,9 +254,6 @@ impl<'a> BlockGen<'a> { BlockKind::Normal, saturate_srgb(col, 0.45).map(|e| (e * 255.0) as u8), )) - } else if (wposf.z as f32) < water_height { - // Ocean - Some(water) } else { None }; @@ -296,6 +297,16 @@ impl<'a> BlockGen<'a> { } }); + // Water + let block = block.or_else(|| { + if (wposf.z as f32) < water_height { + // Ocean + Some(water) + } else { + None + } + }); + let block = structures .iter() .find_map(|st| {