nianticlabs/spz

File format for 3D Gaussian splats. About 10x smaller than the PLY equivalent with virtually no perceptible loss in visual quality. Offered as open source by Niantic Labs. More details at https://scaniverse.com/spz #3dgaussiansplats #gaussiansplatting

spz — Compressed 3D Gaussian Splats

What it is

.spz is a file format for storing 3D Gaussian splats — a technique for representing 3D scenes as a cloud of fuzzy, semi-transparent ellipsoids. The spz repository provides a C++ library to save and load this format, plus TypeScript (via WebAssembly) and Python bindings.

The main selling point: .spz files are typically ~10× smaller than the equivalent .ply files, with minimal visual difference.

Why the size win

Instead of storing each attribute as a full 32-bit float, the format packs values into compact fixed-point integers (e.g. positions as 24-bit, colors as 8-bit per channel) and then compresses the whole thing with ZSTD (a modern compression algorithm). Each attribute stream (positions, colors, rotations, etc.) is compressed independently and in parallel, which speeds up both saving and loading.

Coordinate systems

3D data can be oriented differently depending on the tool that created it. SPZ supports 16 named coordinate systems (e.g. RUB = Right/Up/Back, RDF = Right/Down/Front). When saving, you say what system your data is in; when loading, you say what system your renderer expects. The library converts automatically, including rotating spherical-harmonics coefficients when needed. If you leave it unspecified, no conversion happens — simpler but less interoperable.

File format (version 4)

The file starts with a 32-byte plaintext header containing metadata:

  • Magic number "NGSP" for format detection
  • Version (currently 4)
  • Number of gaussians
  • Spherical-harmonics degree (0–4)
  • Number of fractional bits for fixed-point coordinates
  • Flags (e.g. whether the splat was trained with antialiasing)
  • Number of compressed streams (typically 6)
  • Offset to the table of contents

After the header comes an optional extension zone (vendor-specific records), then a table of contents listing each compressed stream's size, then the compressed data streams themselves.

Older versions (1–3) used gzip instead of ZSTD; the library can still read them but only writes version 4.

How each attribute is stored

Attribute Encoding
Positions 24-bit fixed-point signed integers (fractional bits from header)
Scales 8-bit log-encoded integers
Rotations Smallest 3 components of the normalized quaternion, 10-bit signed each + 2-bit index of the omitted component
Alphas 8-bit unsigned integers
Colors 8-bit unsigned integers (R, G, B)
Spherical harmonics 8-bit signed integers, optionally quantized (see below)

Spherical-harmonics quantization

Spherical harmonics (SH) describe how a splat's color changes with viewing angle. SPZ lets you trade file size against quality by choosing how many bits of precision to keep:

  • sh1Bits — bits for SH degree 1 (default 5, range 1–8)
  • shRestBits — bits for SH degree 2+ (default 4, range 1–8)

Fewer bits → smaller files, slightly lower quality. The unpacking side doesn't need to know these settings; it just fills in zero bits automatically.

Extensions

SPZ supports vendor-specific extensions stored as type–length–value records in the plaintext header zone. Parsers that don't recognize an extension simply skip it. Two documented examples:

  • SPZ_ADOBE_safe_orbit_camera — stores camera limits (min/max elevation, min radius) to constrain viewing.
  • SPZ_NIANTIC_georeference — stores a similarity transform (origin, rotation, scale) mapping the asset into a geocentric coordinate system like EPSG:4978. The library never applies this transform itself; it just carries the metadata.

API surface

C++ — four functions:

  • saveSpz(gaussians, options, output) — encode to a byte vector or a file
  • loadSpz(data, options) — decode from bytes or a file

Both take PackOptions / UnpackOptions for coordinate-system and quantization settings.

TypeScript — built via Emscripten/WebAssembly; exposes limited functionality because JS and WASM memory are managed separately.

Python — nanobind-based bindings for loading, manipulating, and saving splats from Python (pip install .).

Web utility

A browser-based tool at nianticlabs.github.io/spz lets you inspect .spz/.ply metadata and convert between formats without installing anything. It runs entirely in the browser, so it's limited to files up to ~2 GB; larger files need the command-line tools.

Dependencies

The C++ library needs libz and libzstd; the CMake build will auto-download them if missing. Everything else is self-contained.

Related

  • Project
  • Dispatch
  • Project
  • Project
  • Project