#gamedev #graphics #mesh #procedural #terrain

bin+lib mesh-generation

Mesh generation for terrain

4 releases

0.1.3 Sep 3, 2020
0.1.2 Sep 3, 2020
0.1.1 Sep 3, 2020
0.1.0 Sep 3, 2020

#3 in #terrain

MIT/Apache

120KB
172 lines

Mesh Generation

Based on https://www.scratchapixel.com/lessons/procedural-generation-virtual-worlds/perlin-noise-part-2

Example Screenshot

License

Under APACHE 2.0 or MIT


lib.rs:

Based on this guide

Examples

use mesh_generation::mesh::PolyMesh;
use noise::{Perlin, Seedable};

let perlin = Perlin::new();
perlin.set_seed(1564863213);
let mut mesh = PolyMesh::new(Some(128), Some(128), Some(10), Some(10));
let width = 128;
let height = 128;
let noise_map = mesh::generate_noise_map(perlin, width, height, 128.0, 5);
mesh.displace_with_noise_map(noise_map, width, height);
mesh.calculate_normals();
mesh.export_to_obj("./poly_mesh.obj");

Dependencies

~5MB
~96K SLoC