Mountain Maker is a Rust application that procedurally generates 3D terrain meshes using Diffusion Limited Aggregation (DLA) algorithms. The program creates realistic-looking mountains and terrain that can be exported to GLB format for use in 3D applications. This video was the inspiration.
- Generate procedural 3D mountains using Diffusion Limited Aggregation
- Control the simulation parameters via command line arguments
- Export the results as GLB 3D model files
- Reproducible terrain generation using optional random seeds
- Multi-step refinement process with optional intermediate step saving
- Rust toolchain (cargo, rustc)
- GLB viewer for viewing the exported 3D models
git clone https://github.com/yourusername/mountain-maker.git
cd mountain-maker
cargo build --releaseRun the application with default settings:
cargo runUsage: mountain-maker [OPTIONS]
Options:
--width <WIDTH> Width of the simulation grid [default: 200]
--height <HEIGHT> Height of the simulation grid [default: 200]
--particles <PARTICLES> Number of particles to simulate [default: 5000]
--stickiness <STICKINESS> Particle stickiness (0.0-1.0) [default: 0.7]
--step-size <STEP_SIZE> Random walk step size [default: 1]
--blur-radius <BLUR_RADIUS> Blur radius for smoothing [default: 8]
--upsample-factor <UPSAMPLE_FACTOR> Upscaling factor for each iteration [default: 2]
--steps <STEPS> Number of refinement steps [default: 4]
--blur-strength <BLUR_STRENGTH> Blur strength (0.0-1.0) [default: 0.7]
--seed <SEED> Random seed for reproducible terrain generation
-o, --output <OUTPUT> Output path for the GLB file [default: mountain_mesh.glb]
--scale-x <SCALE_X> X-axis scale factor [default: 1]
--scale-y <SCALE_Y> Y-axis scale factor [default: 1]
--scale-z <SCALE_Z> Z-axis height scale factor [default: 200]
--save-steps Save intermediate step files
--step-dir <STEP_DIR> Directory to save intermediate step files
-h, --help Print help
-V, --version Print version
Generate a terrain with a specific seed for reproducibility:
cargo run -- --seed 123456Generate a larger, more detailed terrain:
cargo run -- --width 300 --height 300 --particles 10000 --steps 5Adjust the terrain shape with different parameters:
cargo run -- --stickiness 0.8 --scale-z 300 --blur-radius 10Save intermediate steps for visualization:
cargo run -- --save-steps --step-dir step_outputs- The application runs a Diffusion Limited Aggregation simulation in 2D
- The simulation result is converted to a height map
- Multiple steps of upsampling and blurring refine the terrain
- The final height map is converted to a 3D mesh
- The mesh is exported as a GLB file for use in 3D applications
This project is licensed under the MIT License - see the LICENSE file for details.
- The mesh-tools crate for 3D mesh handling and export
- The glam crate for vector mathematics
- The clap crate for command-line argument parsing
