5 unstable releases
0.3.2 | Jul 18, 2024 |
---|---|
0.3.1 |
|
0.2.1 | May 20, 2024 |
0.1.0 | May 18, 2024 |
#270 in Math
408 downloads per month
Used in voxel-tiler-cli
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
Refer to examples/generate_voxel_bunny.rs
.
How to Run
cargo run --example bunny --features="ply"
Voxelization and Tiling of Point Clouds
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
Refer to generate_terrain_glb
.
How to Run
cargo run --example terrain --features="image"
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
(The English in README.md
and documentation comments was translated from Japanese using ChatGPT and DeepL)
Dependencies
~4–11MB
~139K SLoC