6 releases
Uses new Rust 2024
| 0.0.6 | Dec 23, 2025 |
|---|---|
| 0.0.5 | Dec 22, 2025 |
#35 in Data formats
58KB
1.5K
SLoC
SPZ
Rust and Python implementation of the .SPZ file format and CLI tools.
WIP
What is SPZ?
SPZ is a compressed file format for 3D Gaussian Splats, designed by Niantic. It provides efficient storage of Gaussian Splat data with configurable spherical harmonics degrees and coordinate system support.
See docs/SPZ.md for more information.
CLI
$ path/to/spz info assets/racoonfamily.spz
GaussianSplat={num_points=932560, sh_degree=3, antialiased=true, median_ellipsoid_volume=0.0000000046213082, bbox=[x=-281.779541 to 258.382568, y=-240.000000 to 240.000000, z=-240.000000 to 240.000000]}
Rust
Usage
spz = { version = "0.0.6", default-features = false, features = [] }
use spz::prelude::*;
Examples
cargo run --example load_spz
Quick Start
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::path::{Path, PathBuf};
use anyhow::Result;
use spz::{GaussianSplat, UnpackOptions};
fn main() -> Result<()> {
let mut sample_spz = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
sample_spz.push("assets/racoonfamily.spz");
let _gs = spz::GaussianSplat::builder()
.filepath(sample_spz)
.packed(true)?
.unpack_options(
UnpackOptions::builder()
.to_coord_system(spz::CoordinateSystem::default())
.build(),
)
.load()?;
Ok(())
}
#[allow(unused)]
async fn load_spz_async<P>(spz_file: P) -> Result<GaussianSplat>
where
P: AsRef<Path>,
{
let gs = spz::GaussianSplat::builder()
.filepath(spz_file)
.packed(true)?
.unpack_options(
UnpackOptions::builder()
.to_coord_system(spz::CoordinateSystem::default())
.build(),
)
.load_async()
.await?;
Ok(gs)
}
API
Overview
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GaussianSplat {
pub num_points: i32,
pub spherical_harmonics_degree: i32,
pub antialiased: bool,
pub positions: Vec<f32>,
pub scales: Vec<f32>,
pub rotations: Vec<f32>,
pub alphas: Vec<f32>,
pub colors: Vec<f32>,
pub spherical_harmonics: Vec<f32>,
}
Benches
Pre-Requisites
- Install
gnuplotfor html reports. - Install
nextestrunner.
Run
just bench
- The html report of the benchmark can be found under
target/criterion/report/index.html. - View Benchmark and Profiling data on CodSpeed, (from CI runs).
Test Code Coverage
Development
Pre-Requisites
- Install the
moldlinker: https://github.com/rui314/mold - Install
nextest
Python
TODO.
Documentation
Further documentation is available under ./docs.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
SPDX-License-Identifier: Apache-2.0
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
SPDX-License-Identifier: MIT
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~6.5–9MB
~159K SLoC