spz

Crates.iospz
lib.rsspz
version0.0.6
created_at2025-12-20 21:57:32.271544+00
updated_at2025-12-23 16:13:31.216233+00
descriptionSPZ file format handling for Rust, and CLI tooling.
homepagehttps://github.com/Jackneill/spz
repositoryhttps://github.com/Jackneill/spz
max_upload_size
id1997018
size120,502
Márk Bartos (Jackneill)

documentation

README

SPZ

Rust and Python implementation of the .SPZ file format and CLI tools.
 
WIP
 

Crates.io Version docs.rs lib.rs GitHub Tag
GitHub CI Deps GitHub Last Commit
CodSpeed CodeCov
GitHub License GitHub License MIT
FOSSA Status FOSSA Security



Get it on Flathub

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

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

CodeCov Grid

Development

Pre-Requisites

Python

TODO.

Documentation

Further documentation is available under ./docs.

License

Licensed under either of

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.

FOSSA Scan
Commit count: 0

cargo fmt