/voxel-tiler-core-rs

Voxel models can be created from point cloud data or elevation tiles and output to file.

Primary LanguageRustApache License 2.0Apache-2.0

English | 日本語

voxel-tiler-core

A crate for voxelizing point clouds and generating 3D tiles.

Features

  • Voxelization based on pixel coordinates
    • Each voxel generated by this crate corresponds to one pixel in the pixel coordinate system.
    • This ensures positional consistency between multiple models.
  • Tile-based partitioning
    • The generated voxel data can be divided into tile spaces at the specified zoom level.
    • This feature allows large point cloud data to be split into multiple files for output.

Supported File Formats

File Format Input Output
ply
glb x
las x
laz x

Usage

Basic Usage

fn example() {
    // Load data
    let file = BufReader::new(File::open("examples/data-source/colored_stanford_bunny.ply").unwrap());

    // Collect vertex information from data
    let point_cloud = PointCloud::from_ply(file);

    // Define resolution
    let resolution = Resolution::Mater(0.03);

    // Voxelize
    let voxel_collection = BuildSimpleVoxelizerDefault::voxelize_one(point_cloud, resolution);

    // Generate mesh
    let mesh = Mesher::meshing(voxel_collection, ValidSide::all());

    // Simplify mesh (optional)
    let simplified_mesh = mesh.simplify();

    // Generate glb file
    let glb = Glb::from_voxel_mesh(mesh.clone()).unwrap();

    // Write file
    let writer = File::create("examples/exports/colored_stanford_bunny.glb").expect("I/O error");
    glb.to_writer(writer).expect("glTF binary output error");
    println!("Generated colored_stanford_bunny.glb");
}

Simple Voxelization

bunny

Refer to examples/generate_voxel_bunny.rs.

How to Run

cargo run --example bunny --features="ply"

Voxelization and Tiling of Point Clouds

tile

Refer to examples/generate_voxel_tile.rs. When dealing with models with many vertex colors generated from point cloud data, converting them to glb files (which are smaller in size than ASCII ply files) seems to make rendering very costly. The cause is under investigation.

How to Run

This takes a very long time. It is recommended to run it in release build.

cargo run --example tile --features="las ply"

Generating Voxel Terrain Models from Geospatial Information Authority of Japan Elevation Tiles

terrain

Refer to generate_terrain_glb.

How to Run

cargo run --example terrain --features="image"

License

Licensed under either of

at your option.

(The English in README.md and documentation comments was translated from Japanese using ChatGPT and DeepL)