diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index 3d5f3c07e1..48c6f521fc 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -52,6 +52,7 @@ impl<'a> Sampler for BlockGen<'a> { cave_xy, cave_alt, rock, + cliff, } = self.sample_column(Vec2::from(wpos))?; let wposf = wpos.map(|e| e as f64); @@ -64,9 +65,20 @@ impl<'a> Sampler for BlockGen<'a> { .get((wposf.div(Vec3::new(120.0, 120.0, 140.0))).into_array()) as f32) .mul((chaos - 0.1).max(0.0)) - .mul(90.0); + .mul(120.0); - let cliff = (0.0 + let is_cliff = if cliff > 0.0 { + (self.world.sim() + .gen_ctx + .warp_nz + .get((wposf.div(Vec3::new(300.0, 300.0, 800.0))).into_array()) + as f32) * cliff > 0.3 + } else { + false + }; + + let cliff = if is_cliff { + (0.0 + (self.world.sim() .gen_ctx .warp_nz @@ -75,18 +87,15 @@ impl<'a> Sampler for BlockGen<'a> { + (self.world.sim() .gen_ctx .warp_nz - .get((wposf.div(Vec3::new(100.0, 100.0, 100.0))).into_array()) - as f32) * 0.2) - .add(0.6) - .mul(64.0); + .get((wposf.div(Vec3::new(100.0, 100.0, 70.0))).into_array()) + as f32) * 0.3) + .add(0.4) + .mul(64.0) + } else { + 0.0 + }; - let is_cliff = (self.world.sim() - .gen_ctx - .warp_nz - .get((wposf.div(Vec3::new(300.0, 300.0, 800.0))).into_array()) - as f32) > 0.25;//4; - - let height = alt + warp + if is_cliff { cliff } else { 0.0 }; + let height = alt + warp + cliff; // Sample blocks @@ -98,7 +107,7 @@ impl<'a> Sampler for BlockGen<'a> { let water = Block::new(1, Rgb::new(100, 150, 255)); let warm_stone = Block::new(1, Rgb::new(165, 165, 90)); - let block = if (wposf.z as f32) < height - 4.0 { + let block = if (wposf.z as f32) < height - 2.0 { // Underground if (wposf.z as f32) > alt { Some(surface_stone) diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index 48a5e815e9..fc625b5d67 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -36,6 +36,7 @@ impl<'a> Sampler for ColumnGen<'a> { let chaos = sim.get_interpolated(wpos, |chunk| chunk.chaos)?; let temp = sim.get_interpolated(wpos, |chunk| chunk.temp)?; let rockiness = sim.get_interpolated(wpos, |chunk| chunk.rockiness)?; + let cliffiness = sim.get_interpolated(wpos, |chunk| chunk.cliffiness)?; let tree_density = sim.get_interpolated(wpos, |chunk| chunk.tree_density)?; let alt = sim.get_interpolated(wpos, |chunk| chunk.alt)? @@ -53,26 +54,30 @@ impl<'a> Sampler for ColumnGen<'a> { let marble = (0.0 + (sim.gen_ctx.hill_nz.get((wposf3d.div(48.0)).into_array()) as f32).mul(0.75) - + (sim.gen_ctx.hill_nz.get((wposf3d.div(3.0)).into_array()) as f32).mul(0.5)) + + (sim.gen_ctx.hill_nz.get((wposf3d.div(3.0)).into_array()) as f32).mul(0.25)) .add(1.0) .mul(0.5); // Colours - let cold_grass = Rgb::new(0.0, 0.4, 0.1); - let warm_grass = Rgb::new(0.25, 0.8, 0.05); + let cold_grass = Rgb::new(0.0, 0.3, 0.1); + let warm_grass = Rgb::new(0.25, 0.9, 0.05); let cold_stone = Rgb::new(0.55, 0.7, 0.75); let warm_stone = Rgb::new(0.65, 0.65, 0.35); - let beach_sand = Rgb::new(0.93, 0.84, 0.33); - let desert_sand = Rgb::new(0.97, 0.84, 0.23); + let beach_sand = Rgb::new(0.93, 0.84, 0.4); + let desert_sand = Rgb::new(0.98, 0.8, 0.15); let snow = Rgb::broadcast(1.0); let grass = Rgb::lerp(cold_grass, warm_grass, marble); - let grassland = grass; //Rgb::lerp(grass, warm_stone, rock.mul(5.0).min(0.8)); + let sand = Rgb::lerp(beach_sand, desert_sand, marble); let cliff = Rgb::lerp(cold_stone, warm_stone, marble); let ground = Rgb::lerp( - Rgb::lerp(snow, grassland, temp.add(0.4).mul(32.0).sub(0.4)), - desert_sand, + Rgb::lerp( + snow, + grass, + temp.add(0.4).add(marble * 0.05).mul(256.0).sub(0.4), + ), + sand, temp.sub(0.4).mul(32.0).add(0.4), ); @@ -108,7 +113,7 @@ impl<'a> Sampler for ColumnGen<'a> { alt, chaos, surface_color: Rgb::lerp( - beach_sand, + sand, // Land Rgb::lerp( ground, @@ -133,6 +138,7 @@ impl<'a> Sampler for ColumnGen<'a> { cave_xy, cave_alt, rock, + cliff: cliffiness, }) } } @@ -147,4 +153,5 @@ pub struct ColumnSample { pub cave_xy: f32, pub cave_alt: f32, pub rock: f32, + pub cliff: f32, } diff --git a/world/src/sim/mod.rs b/world/src/sim/mod.rs index ec6e91abe0..38bd431fa2 100644 --- a/world/src/sim/mod.rs +++ b/world/src/sim/mod.rs @@ -24,6 +24,7 @@ pub(crate) struct GenCtx { pub temp_nz: SuperSimplex, pub small_nz: BasicMulti, pub rock_nz: HybridMulti, + pub cliff_nz: HybridMulti, pub warp_nz: BasicMulti, pub tree_nz: BasicMulti, @@ -53,6 +54,7 @@ impl WorldSim { temp_nz: SuperSimplex::new().set_seed(seed + 5), small_nz: BasicMulti::new().set_octaves(2).set_seed(seed + 6), rock_nz: HybridMulti::new().set_persistence(0.3).set_seed(seed + 7), + cliff_nz: HybridMulti::new().set_persistence(0.3).set_seed(seed + 7), warp_nz: BasicMulti::new().set_octaves(3).set_seed(seed + 8), tree_nz: BasicMulti::new() .set_octaves(12) @@ -140,7 +142,7 @@ impl WorldSim { } } -const Z_TOLERANCE: (f32, f32) = (128.0, 128.0); +const Z_TOLERANCE: (f32, f32) = (128.0, 96.0); pub struct SimChunk { pub chaos: f32, @@ -148,6 +150,7 @@ pub struct SimChunk { pub alt: f32, pub temp: f32, pub rockiness: f32, + pub cliffiness: f32, pub tree_density: f32, } @@ -207,6 +210,12 @@ impl SimChunk { .sub(0.1) .mul(1.2) .max(0.0), + cliffiness: (gen_ctx.cliff_nz.get((wposf.div(2048.0)).into_array()) as f32) + .sub(0.15) + .mul(3.0) + .mul(1.1 - chaos) + .max(0.0) + .min(1.0), tree_density: (gen_ctx.tree_nz.get((wposf.div(1024.0)).into_array()) as f32) .add(1.0) .mul(0.5)