This commit is contained in:
flyingfryingpan 2019-11-06 03:19:50 -08:00 committed by Joshua Yanovski
parent 6a3f979290
commit a98d4adc27
5 changed files with 57 additions and 45 deletions

BIN
assets/voxygen/background/bg_main.png (Stored with Git LFS)

Binary file not shown.

View File

@ -168,6 +168,7 @@ impl<'a> BlockGen<'a> {
temp,
humidity,
chunk,
stone_col,
..
} = sample;
@ -233,7 +234,7 @@ impl<'a> BlockGen<'a> {
// Sample blocks
// let stone_col = Rgb::new(240, 230, 220);
let stone_col = Rgb::new(195, 187, 201);
//let stone_col = Rgb::new(195, 187, 201);
// let dirt_col = Rgb::new(79, 67, 60);
@ -252,6 +253,7 @@ impl<'a> BlockGen<'a> {
saturate_srgb(sub_surface_color, 0.45).map(|e| (e * 255.0) as u8),
stone_col,
(height - grass_depth - wposf.z as f32) * 0.15,
);
// Underground

View File

@ -825,23 +825,24 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
.mul(0.5)
.add(marble_small.sub(0.5).mul(0.25));
let temp = temp.add((marble - 0.5) * 0.25);
let humidity = humidity.add((marble - 0.5) * 0.25);
//let temp = temp.add((marble - 0.5) * 0.1);
//let humidity = humidity.add((marble - 0.5) * 0.10);
// Colours
let cold_grass = Rgb::new(0.0, 0.5, 0.25);
let warm_grass = Rgb::new(0.4, 0.8, 0.0);
let dark_grass = Rgb::new(0.15, 0.4, 0.1);
let wet_grass = Rgb::new(0.1, 0.8, 0.2);
let cold_stone = Rgb::new(0.57, 0.67, 0.8);
let warm_stone = Rgb::new(0.77, 0.77, 0.64);
let cold_grass = Rgb::new(0.1, 0.5, 0.1);
let warm_grass = Rgb::new(0.1, 0.6, 0.0);
let dark_grass = Rgb::new(0.1, 0.3, 0.2);
let wet_grass = Rgb::new(0.1, 0.5, 0.5);
let cold_stone = Rgb::new(0.5, 0.5, 0.5);
//let warm_stone = Rgb::new(0.6, 0.6, 0.5);
let warm_stone = Rgb::new(0.7, 0.8, 0.7);
let beach_sand = Rgb::new(0.9, 0.82, 0.6);
let desert_sand = Rgb::new(0.95, 0.75, 0.5);
let snow = Rgb::new(0.8, 0.85, 1.0);
let dirt = Lerp::lerp(
Rgb::new(0.075, 0.07, 0.3),
Rgb::new(0.75, 0.55, 0.1),
let desert_sand = Rgb::new(0.7, 0.7, 0.4);
let snow = Rgb::new(0.0, 0.0, 0.1);
let stone_col = Rgb::new(205, 186, 50);
let dirt = Lerp::lerp(
Rgb::new(0.6, 0.5, 0.0),
Rgb::new(0.6, 0.5, 0.1),
marble,
);
let tundra = Lerp::lerp(snow, Rgb::new(0.01, 0.3, 0.0), 0.4 + marble * 0.6);
@ -880,7 +881,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
sand,
temp.sub(CONFIG.snow_temp)
.div(CONFIG.desert_temp.sub(CONFIG.snow_temp))
.mul(0.5),
.mul(4.5),
),
cliff,
alt.sub(CONFIG.mountain_scale * 0.25)
@ -901,7 +902,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
.div(CONFIG.snow_temp.neg())
/*.sub((marble - 0.5) * 0.05)
.mul(256.0)*/
.mul(1.0),
.mul(8.0),
),
// 0 to tropical_temp
grass,
@ -911,18 +912,18 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
moss,
temp.sub(CONFIG.tropical_temp)
.div(CONFIG.desert_temp.sub(CONFIG.tropical_temp))
.mul(1.0),
.mul(8.0),
),
// above desert_temp
sand,
temp.sub(CONFIG.desert_temp)
.div(1.0 - CONFIG.desert_temp)
.mul(4.0),
.mul(8.0),
),
humidity
.sub(CONFIG.desert_hum)
.div(CONFIG.forest_hum.sub(CONFIG.desert_hum))
.mul(1.0),
.mul(8.0),
);
// From forest to jungle humidity, we go from snow to dark grass to grass to tropics to sand
// depending on temperature.
@ -940,18 +941,18 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
tropical,
temp.sub(CONFIG.tropical_temp)
.div(CONFIG.desert_temp.sub(CONFIG.tropical_temp))
.mul(1.0),
.mul(8.0),
),
// above desert_temp
sand,
temp.sub(CONFIG.desert_temp)
.div(1.0 - CONFIG.desert_temp)
.mul(4.0),
.mul(8.0),
),
humidity
.sub(CONFIG.forest_hum)
.div(CONFIG.jungle_hum.sub(CONFIG.forest_hum))
.mul(1.0),
.mul(8.0),
);
// From jungle humidity upwards, we go from snow to grass to rainforest to tropics to sand.
let ground = Rgb::lerp(
@ -968,13 +969,13 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
tropical,
temp.sub(CONFIG.tropical_temp)
.div(CONFIG.desert_temp.sub(CONFIG.tropical_temp))
.mul(4.0),
.mul(8.0),
),
// above desert_temp
sand,
temp.sub(CONFIG.desert_temp)
.div(1.0 - CONFIG.desert_temp)
.mul(4.0),
.mul(8.0),
),
humidity.sub(CONFIG.jungle_hum).mul(1.0),
);
@ -1045,7 +1046,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
// Beach
((ocean_level - 1.0) / 2.0).max(0.0),
),
sub_surface_color: dirt,
sub_surface_color: warm_grass,
tree_density,
forest_kind: sim_chunk.forest_kind,
close_structures: self.gen_close_structures(wpos),
@ -1062,6 +1063,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
humidity,
spawn_rate,
location: sim_chunk.location.as_ref(),
stone_col,
chunk: sim_chunk,
spawn_rules: sim_chunk
@ -1102,6 +1104,8 @@ pub struct ColumnSample<'a> {
pub humidity: f32,
pub spawn_rate: f32,
pub location: Option<&'a LocationInfo>,
//making cliffs
pub stone_col: Rgb<u8>,
pub chunk: &'a SimChunk,
pub spawn_rules: SpawnRules,

View File

@ -48,7 +48,7 @@ pub const CONFIG: Config = Config {
mountain_scale: 2048.0,
snow_temp: -0.6,
tropical_temp: 0.2,
desert_temp: 0.6,
desert_temp: 0.9,
desert_hum: 0.15,
forest_hum: 0.5,
jungle_hum: 0.85,

View File

@ -67,13 +67,13 @@ struct GenCdf {
rivers: Box<[RiverData]>,
}
pub(crate) struct GenCtx {
pub(crate) struct GenCtx {
pub turb_x_nz: SuperSimplex,
pub turb_y_nz: SuperSimplex,
pub chaos_nz: RidgedMulti,
pub alt_nz: HybridMulti,
pub hill_nz: SuperSimplex,
pub temp_nz: SuperSimplex,
pub temp_nz: Fbm,
// Humidity noise
pub humid_nz: Billow,
// Small amounts of noise for simulating rough terrain.
@ -112,20 +112,26 @@ impl WorldSim {
let gen_ctx = GenCtx {
turb_x_nz: SuperSimplex::new().set_seed(rng.gen()),
turb_y_nz: SuperSimplex::new().set_seed(rng.gen()),
chaos_nz: RidgedMulti::new().set_octaves(7).set_seed(rng.gen()),
chaos_nz: RidgedMulti::new().set_octaves(2).set_seed(rng.gen()),
hill_nz: SuperSimplex::new().set_seed(rng.gen()),
alt_nz: HybridMulti::new()
.set_octaves(8)
.set_octaves(2)
.set_persistence(0.1)
.set_seed(rng.gen()),
temp_nz: SuperSimplex::new().set_seed(rng.gen()),
small_nz: BasicMulti::new().set_octaves(2).set_seed(rng.gen()),
//temp_nz: SuperSimplex::new().set_seed(rng.gen()),
temp_nz: Fbm::new()
.set_octaves(8)
.set_persistence(0.9)
.set_seed(rng.gen()),
small_nz: BasicMulti::new().set_octaves(1).set_seed(rng.gen()),
rock_nz: HybridMulti::new().set_persistence(0.3).set_seed(rng.gen()),
cliff_nz: HybridMulti::new().set_persistence(0.3).set_seed(rng.gen()),
warp_nz: FastNoise::new(rng.gen()), //BasicMulti::new().set_octaves(3).set_seed(gen_seed()),
cliff_nz: HybridMulti::new().set_persistence(0.1).set_seed(rng.gen()),
warp_nz: FastNoise::new(rng.gen()), //BasicMulti::new().set_octaves(1).set_seed(gen_seed()),
tree_nz: BasicMulti::new()
.set_octaves(12)
.set_persistence(0.75)
.set_octaves(1)
.set_persistence(0.1)
.set_seed(rng.gen()),
cave_0_nz: SuperSimplex::new().set_seed(rng.gen()),
cave_1_nz: SuperSimplex::new().set_seed(rng.gen()),
@ -134,9 +140,9 @@ impl WorldSim {
region_gen: StructureGen2d::new(rng.gen(), 400, 96),
cliff_gen: StructureGen2d::new(rng.gen(), 80, 56),
humid_nz: Billow::new()
.set_octaves(12)
.set_persistence(0.125)
.set_frequency(1.0)
.set_octaves(9)
.set_persistence(0.7)
.set_frequency(0.2)
// .set_octaves(6)
// .set_persistence(0.5)
.set_seed(rng.gen()),
@ -186,7 +192,7 @@ impl WorldSim {
.get((wposf.div(400.0)).into_array())
.min(1.0)
.max(-1.0)
.mul(0.3))
.mul(0.9))
.add(0.3)
.max(0.0);
@ -1024,7 +1030,7 @@ impl SimChunk {
// Take the weighted average of our randomly generated base humidity, the scaled
// negative altitude, and the calculated water flux over this point in order to compute
// humidity.
const HUMID_WEIGHTS: [f32; 3] = [4.0, 1.0, 1.0];
const HUMID_WEIGHTS: [f32; 3] = [4.0, 0.1, 0.1];
let humidity = cdf_irwin_hall(
&HUMID_WEIGHTS,
[humid_uniform, flux_uniform, 1.0 - alt_uniform],
@ -1032,7 +1038,7 @@ impl SimChunk {
// We also correlate temperature negatively with altitude and absolute latitude, using
// different weighting than we use for humidity.
const TEMP_WEIGHTS: [f32; 2] = [2.0, 1.0 /*, 1.0*/];
const TEMP_WEIGHTS: [f32; 2] = [2.0, 16.0 /*, 1.0*/];
let temp = cdf_irwin_hall(
&TEMP_WEIGHTS,
[