@playcanvas/splat-transform
Version:
Library and CLI tool for 3D Gaussian splat format conversion and transformation
22 lines (21 loc) • 1.24 kB
TypeScript
import { DataTable } from './data-table';
import { type DeviceCreator } from '../types';
declare const sortByVisibility: (dataTable: DataTable, indices: Uint32Array) => void;
/**
* Simplifies a Gaussian splat DataTable to a target number of splats by
* progressive pair-wise merging of nearest-neighbor gaussians.
*
* The merge math is derived from sparkjsdev/spark `gsplat.rs::new_merged`
* (area·α weighted, mass-conserving opacity, no filter floor, opacity
* clamped at 1). It preserves color fidelity through multiple iterations
* far better than the NanoGS Porter-Duff opacity + volume-weighted formula
* does — color drift / over-saturation is essentially gone even at
* aggressive reductions.
*
* @param dataTable - The input splat DataTable.
* @param targetCount - The desired number of output splats.
* @param createDevice - Optional factory yielding a `GraphicsDevice`. When supplied, KNN and edge-cost run on the GPU; otherwise the CPU KD-tree path is used.
* @returns A new DataTable with approximately `targetCount` splats.
*/
declare const simplifyGaussians: (dataTable: DataTable, targetCount: number, createDevice?: DeviceCreator) => Promise<DataTable>;
export { sortByVisibility, simplifyGaussians };