From e618e97b1f199ed5b29f47479c955293c1d79327 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Fri, 31 May 2019 19:11:02 +0100 Subject: [PATCH] Improved cave noise --- assets/world/tree/birch/5.vox | 4 ++-- world/src/sim.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/world/tree/birch/5.vox b/assets/world/tree/birch/5.vox index d8c923c3cf..c147235f5d 100644 --- a/assets/world/tree/birch/5.vox +++ b/assets/world/tree/birch/5.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35b0991b46b5dce39edfc5199d3b918c7a8ce65dd5c128a5ede1b64a92a627f7 -size 53264 +oid sha256:891d8cf201209259b0be75218144a3ba5cae9e4eaeda47bab95e98f04d3a15c4 +size 53252 diff --git a/world/src/sim.rs b/world/src/sim.rs index f40e3174dc..a4c59b7e57 100644 --- a/world/src/sim.rs +++ b/world/src/sim.rs @@ -206,7 +206,9 @@ impl<'a> Sampler<'a> { .neg() .add(1.0) .mul((1.15 - chaos).min(1.0)); - let cave_alt = alt - 24.0 + (sim.gen_ctx.cave_1_nz.get(Vec2::new(wposf.x, wposf.y).div(300.0).into_array()) as f32).add(1.0).mul(0.5).powf(10.0).mul(96.0); + let cave_alt = alt - 24.0 + + (sim.gen_ctx.cave_1_nz.get(Vec2::new(wposf.x, wposf.y).div(32.0).into_array()) as f32) * 6.0 + + (sim.gen_ctx.cave_1_nz.get(Vec2::new(wposf.x, wposf.y).div(300.0).into_array()) as f32).add(1.0).mul(0.5).powf(12.0).mul(96.0); Some(Sample2d { alt, @@ -294,7 +296,7 @@ impl<'a> Sampler<'a> { }; let ground_block = if let Some(block) = ground_block { // Underground - let cave = cave_xy.powf(2.0) * (wposf.z as f32 - cave_alt).div(20.0).powf(4.0).neg().add(1.0) > 0.9994; + let cave = cave_xy.powf(2.0) * (wposf.z as f32 - cave_alt).div(20.0).powf(4.0).neg().add(1.0) > 0.996; if cave { None