gltf_io – glTF/GLB I/O

class 3dgs_io.gltf_io.GltfSaveOptions(spz_compression=False, metadata=None)

Bases: object

Options for saving to glTF/GLB format.

spz_compression: bool = False

Use SPZ compression (KHR_gaussian_splatting_compression_spz_2).

metadata: GlbMetadata | dict[str, Any] | None = None

Metadata written to asset.extras in the glTF JSON.

Accepts a GlbMetadata instance (recommended) or a plain dict.

3dgs_io.gltf_io.save_gltf(gc, path, options=None, *, ext_attributes=None)

Save a GaussianCloud to a KHR_gaussian_splatting compliant glTF/GLB file.

ext_attributes is an optional {name: (N,) float32} mapping of per-Gaussian scalars (e.g. lidar_intensity_raw, lidar_raydrop_logit). Each is stored as a quantized accessor under the EXT_gaussian_lidar extension on the primitive, kept out of the attributes dict to avoid GLSL-attribute-name issues in generic viewers.

Return type:

None

3dgs_io.gltf_io.load_gltf(path)

Load a GaussianCloud from a KHR_gaussian_splatting compliant glTF/GLB file.

Return type:

GaussianCloud

3dgs_io.gltf_io.load_gltf_with_metadata(path)

Load a GaussianCloud, asset.extras metadata, and EXT_gaussian_lidar arrays.

Return type:

tuple[GaussianCloud, GlbMetadata | dict[str, Any] | None, dict[str, ndarray]]

Returns:

A 3-tuple (GaussianCloud, metadata, ext_attributes).

  • metadata is a GlbMetadata when the extras match the schema, the raw dict for legacy files, or None if none.

  • ext_attributes is a {name: (N,) float32} dict — empty if the file carries no EXT_gaussian_lidar block.