# ThreeCrate GPU
[](https://crates.io/crates/threecrate-gpu)
[](https://docs.rs/threecrate-gpu)
[](https://github.com/rajgandhi1/threecrate#license)
GPU-accelerated algorithms for 3D point cloud processing using wgpu.
## Features
- **Filtering**: GPU statistical outlier removal, radius filtering, voxel grid downsampling
- **Normal Estimation**: Parallel GPU-based surface normal computation
- **Nearest Neighbor Search**: GPU K-nearest and radius neighbor search
- **ICP Registration**: GPU-accelerated Iterative Closest Point
- **TSDF**: Truncated Signed Distance Function volume integration and surface extraction
- **Rendering**: Real-time point cloud and mesh rendering with PBR material support
- **Cross-platform**: Vulkan, Metal, and DirectX 12 via wgpu
## Usage
Add this to your `Cargo.toml`:
```toml
[dependencies]
threecrate-gpu = "0.6.0"
threecrate-core = { version = "0.6.0", features = ["gpu"] }
```
## Example
```rust
use threecrate_gpu::{GpuContext, PointCloudRenderer, RenderConfig, point_cloud_to_vertices};
use threecrate_core::{PointCloud, Point3f};
// Initialize GPU context
let gpu_context = GpuContext::new().await?;
// GPU-accelerated filtering
let filtered = gpu_voxel_grid_filter(&gpu_context, &cloud, 0.05).await?;
// GPU ICP registration
let result = gpu_icp(&gpu_context, &source, &target).await?;
// TSDF volume integration
let mut volume = create_tsdf_volume(resolution, voxel_size);
gpu_tsdf_integrate(&gpu_context, &mut volume, &depth_image, &intrinsics, &pose).await?;
let mesh = gpu_tsdf_extract_surface(&gpu_context, &volume).await?;
// Real-time rendering
let config = RenderConfig::default();
let renderer = PointCloudRenderer::new(&window, config).await?;
let vertices = point_cloud_to_vertices(&cloud, [1.0, 1.0, 1.0], 4.0);
renderer.render(&vertices)?;
```
## GPU Requirements
- **Vulkan**: Preferred backend for best performance
- **Metal**: macOS support via Metal API
- **DirectX 12**: Windows support via DX12
- **OpenGL**: Fallback support for older systems
## License
This project is licensed under either of
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.