Loading...
Searching...
No Matches
SpzCodec.hpp
1#pragma once
2
3#include <ossia/dataflow/geometry_port.hpp>
4
5#include <span>
6#include <string_view>
7
8namespace Threedim::PrimitiveCloud
9{
10
11// Decode a Niantic SPZ v1-3 file into a primitive_cloud_component.
12//
13// SPZ stores splats column-grouped (positions, then scales, then
14// rotations, then alphas, then colors, then SH) inside a gzip-
15// compressed payload, in the RUB coordinate system. We unpack via
16// the vendored Niantic library, rotate to RDF (the convention every
17// existing 3dgs.classic preset assumes), then transpose into the
18// canonical 62-float / 248-byte PLY-compatible row layout:
19//
20// floats 0..2 x, y, z
21// floats 3..5 nx, ny, nz (zero — not in SPZ)
22// floats 6..8 f_dc_0..2 (SH DC = colors)
23// floats 9..53 f_rest_0..44 (R coeffs, then G, then B; padded
24// with zero for shDegree<3)
25// float 54 opacity (pre-sigmoid)
26// floats 55..57 scale_0..2 (log-space)
27// floats 58..61 rot_0..3 (PLY convention w,x,y,z)
28//
29// Returns nullptr on parse failure or v4 files (ZSTD support not
30// vendored — converting v4 → v3 with the upstream `spz-tool` works
31// around it). Sets format_id = "3dgs.classic" so the existing preset
32// picks it up transparently.
33ossia::primitive_cloud_component_ptr parse_spz(std::string_view bytes);
34
35} // namespace Threedim::PrimitiveCloud