Skip to main content

Crate symbios_ground

Crate symbios_ground 

Source
Expand description

§symbios-ground

An algorithmic terrain engine for procedural heightmap generation, erosion simulation, and texture-weight (splat) mapping.

§Core types

TypeDescription
HeightMap2-D grid of f32 heights with world-space sampling helpers
LakePooled water body detected during hydraulic erosion
TerrainGeneratorTrait implemented by all generators
SplatMapper / WeightMap4-channel RGBA texture-weight map from height + slope

§Generators

TypeAlgorithm
DiamondSquareClassic fractal Diamond-Square; preserves caller dimensions via bilinear downsample
FbmNoiseFractional Brownian Motion (multi-octave value noise)
VoronoiTerracingVoronoi-based stepped plateaus

§Erosion

TypeDescription
HydraulicErosionDroplet-based particle erosion (carves valleys, pools lakes, splays river deltas)
ThermalErosionTalus/slope-smoothing erosion (with optional underwater rules)

§Streaming / LOD

TypeDescription
TiledHeightMapSparse, infinite-world heightmap generated tile-by-tile on demand
HeightMapTileOne generated tile owned by a TiledHeightMap
derive_tile_seedMixes a base seed with tile coordinates into a per-tile seed

§World-space splat queries

FunctionDescription
SplatMapper::sample_weights_at / sample_splat_weights_atNormalised [f32; 4] splat weights at a world position
SplatMapper::sample_biome_at / sample_biome_atDominant RGBA channel index (0..=3) at a world position

§Quick start

use symbios_ground::{DiamondSquare, HeightMap, HydraulicErosion,
                     SplatMapper, TerrainGenerator, ThermalErosion};

// 1. Create a 129×129 heightmap with 1 world-unit per cell.
let mut heightmap = HeightMap::new(129, 129, 1.0);

// 2. Generate fractal terrain.
DiamondSquare::new(42, 0.6).generate(&mut heightmap);

// 3. Smooth with thermal erosion, then carve with hydraulic erosion.
ThermalErosion::new().erode(&mut heightmap);
HydraulicErosion::new(42).erode(&mut heightmap);

// 4. Build a 4-channel texture weight map (grass / dirt / rock / snow).
let weight_map = SplatMapper::default().generate(&heightmap);

// 5. Query world-space height and surface normal at any position.
let height = heightmap.get_height_at(64.5, 64.5);
let normal = heightmap.get_normal_at(64.5, 64.5);

Re-exports§

pub use erosion::HydraulicErosion;
pub use erosion::ThermalErosion;
pub use generator::TerrainGenerator;
pub use generators::DiamondSquare;
pub use generators::FbmNoise;
pub use generators::VoronoiTerracing;
pub use heightmap::HeightMap;
pub use heightmap::Lake;
pub use splat::SplatMapper;
pub use splat::SplatRule;
pub use splat::WeightMap;
pub use splat::sample_biome_at;
pub use splat::sample_splat_weights_at;
pub use tile::HeightMapTile;
pub use tile::TiledHeightMap;
pub use tile::derive_tile_seed;

Modules§

erosion
generator
generators
heightmap
splat
tile
LOD / tile streaming abstraction for large heightmaps.