voxel-tiler-core

Convert point clouds to voxel data

5 unstable releases

0.3.2 Jul 18, 2024
0.3.1 Jul 18, 2024
0.2.1 May 20, 2024
0.1.0 May 18, 2024

#219 in Math

Download history 109/week @ 2024-07-10 229/week @ 2024-07-17 12/week @ 2024-07-24 6/week @ 2024-07-31 3/week @ 2024-08-28 1/week @ 2024-09-11 5/week @ 2024-09-18 32/week @ 2024-09-25 16/week @ 2024-10-02

54 downloads per month
Used in voxel-tiler-cli

MIT/Apache

110KB
2K SLoC

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)

Dependencies

~4–11MB
~136K SLoC