Contents

SplatTransform API: All Pages

The API reference of the @playcanvas/splat-transform 3.10.0 library: reading, processing and writing 3D Gaussian splat data in Node.js and the browser.

The same pages as Markdown, for AI agents: llms-full.txt.

Contents

BufferedReadStream

Class · extends ReadStream

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/buffered-read-stream.ts#L13

ReadStream wrapper that adds read-ahead buffering to reduce async overhead. Reads larger chunks from the inner stream and buffers excess data for subsequent small reads. Useful for sources with high per-call overhead.

Example

// Wrap a stream with 4MB read-ahead buffering
const buffered = new BufferedReadStream(rawStream, 4 * 1024 * 1024);
const data = await buffered.readAll();

Constructors

constructor

new BufferedReadStream(inner: ReadStream, chunkSize?: number)

Create a caching wrapper around a stream.

Parameters

Methods

close

close(): void

Release resources and abort any pending operations.

pull

pull(target: Uint8Array): Promise<number>

Pull data into the provided buffer.

Parameters

Returns Promise<number>: Number of bytes read, or 0 for EOF

Inherited from ReadStream

Column

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/data-table/data-table.ts#L26

A named column of typed array data within a DataTable.

Columns store homogeneous numeric data efficiently using JavaScript typed arrays.

Example

const positions = new Column('x', new Float32Array([1.0, 2.0, 3.0]));
console.log(positions.name);     // 'x'
console.log(positions.dataType); // 'float32'

DataTable

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/data-table/data-table.ts#L94

A table of columnar data representing Gaussian splat properties.

DataTable is the core data structure for splat data. Each column represents a property (e.g., position, rotation, color) as a typed array, and all columns must have the same number of rows.

Standard columns include:

Example

const table = new DataTable([
    new Column('x', new Float32Array([0, 1, 2])),
    new Column('y', new Float32Array([0, 0, 0])),
    new Column('z', new Float32Array([0, 0, 0]))
]);
console.log(table.numRows);    // 3
console.log(table.numColumns); // 3

Methods

clone

clone(options?: object): DataTable

Creates a copy of this DataTable, optionally selecting specific rows and/or columns.

Parameters

Returns DataTable: A new DataTable with copied data.

Example

const full = table.clone();
const subset = table.clone({ rows: [0, 2, 4], columns: ['x', 'y', 'z'] });

permuteRowsInPlace

permuteRowsInPlace(indices: Uint32Array<ArrayBufferLike> | number[]): void

Permutes the rows of this DataTable in-place according to the given indices. After calling, row i will contain the data that was previously at row indices[i].

This is a memory-efficient alternative to clone({ rows }) that modifies the table in-place rather than creating a copy. It reuses ArrayBuffers between columns to minimize memory allocations.

Parameters

MemoryFileSystem

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/write/memory-file-system.ts#L78

A file system that writes files to in-memory buffers.

Useful for generating output without writing to disk, such as when creating data for download or further processing.

Example

const fs = new MemoryFileSystem();
await writeSource({ filename: 'output.ply', outputFormat: 'ply', source, pool, options: {} }, fs);

// Get the generated data
const data = fs.results.get('output.ply');

MemoryReadFileSystem

Class · implements ReadFileSystem

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/memory-file-system.ts#L70

ReadFileSystem for reading from named memory buffers. Useful for testing or when data is already in memory.

Methods

createSource

createSource(filename: string, progress?: ProgressCallback): Promise<ReadSource>

Create a readable source for the given path/identifier.

Parameters

Returns Promise<ReadSource>: Promise resolving to a ReadSource

get

get(name: string): Uint8Array<ArrayBufferLike>

Get a stored buffer by name.

Parameters

Returns Uint8Array<ArrayBufferLike>: The stored data or undefined

set

set(name: string, data: Uint8Array): void

Store a named buffer.

Parameters

ReadStream

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/file-system.ts#L5

Abstract base class for streaming data from a source. Uses a pull-based model where the consumer provides the buffer.

Constructors

constructor

new ReadStream(expectedSize?: number)

Parameters

Properties

bytesRead

bytesRead: number = 0

Total bytes read from this stream so far.

expectedSize

readonly expectedSize: number

Size hint for buffer pre-allocation in readAll(). May be undefined if size is unknown.

Methods

close

close(): void

Release resources and abort any pending operations.

pull

abstract pull(target: Uint8Array): Promise<number>

Pull data into the provided buffer.

Parameters

Returns Promise<number>: Number of bytes read, or 0 for EOF

readAll

readAll(): Promise<Uint8Array<ArrayBufferLike>>

Read entire stream into a single buffer. Uses expectedSize hint if available, grows dynamically if needed.

Returns Promise<Uint8Array<ArrayBufferLike>>: Complete data as Uint8Array

TextRenderer

Class · implements Renderer

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/text-renderer.ts#L80

Default human-readable text renderer. Emits one event per line - no carriage-return rewriting, no TTY detection, no buffering. Bars render as [#### ...... ] duration, with # appended incrementally on each barTick and the remainder padded with . on barEnd. output events are treated as line-oriented: their text is written to the pipeable sink with a trailing \n appended (callers should not include one themselves).

Verbosity is consulted directly from the shared logger on each event, so this renderer alone decides what to display - the core delivers every scope/bar lifecycle event so embedders consuming the event stream see a faithful record. The display rules are:

Sinks are injected (no process reference here) so the renderer works in both Node CLI and browser/bundle contexts: the CLI passes process.stderr.write for status and process.stdout.write for raw output; library/browser consumers can pass a console.log line buffer.

Properties

mem

mem: boolean

When true, scope-end and bar-end lines gain a [peak cpu=X] suffix (extended to [peak cpu=X gpu=Y] when TextRendererOptions.getPeakGpuMemory is also supplied) sourced from TextRendererOptions.getPeakCpuMemory. No effect when the probe is omitted. Defaults to true when getPeakCpuMemory is provided so embedders that supply a probe see the overlay automatically. Mutable so the host can toggle the overlay without re-installing the renderer.

Methods

handle

handle(event: LogEvent): void

Handle a log event.

Parameters

Transform

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/math.ts#L23

A source-to-engine coordinate transform comprising translation, rotation and uniform scale. Lives alongside a DataTable to describe how raw column data maps to PlayCanvas engine coordinates.

Example

const t = new Transform().fromEulers(0, 0, 180);
console.log(t.isIdentity()); // false

const inv = t.clone().invert();
console.log(t.mul(inv).isIdentity()); // true

Properties

PLY

static PLY: Readonly<Transform>

PLY coordinate convention: 180-degree rotation around Z. Used by formats that store Gaussian data in PLY-style coordinates: PLY, splat, KSplat, SPZ, and SOG.

Methods

clone

clone(): Transform

Creates a deep copy of this transform.

Returns Transform: A new Transform with the same values.

equals

equals(other: Transform, epsilon?: number): boolean

Tests whether this transform equals another within the given tolerance. Quaternion comparison accounts for double-cover (q and -q represent the same rotation).

Parameters

Returns boolean: True if the transforms are equal within the tolerance.

fromEulers

fromEulers(x: number, y: number, z: number): Transform

Sets this transform to a rotation-only transform from Euler angles in degrees.

Parameters

Returns Transform: This transform (for chaining).

getMatrix

getMatrix(result: Mat4): Mat4

Fills the provided Mat4 with the TRS matrix for this transform.

Parameters

Returns Mat4: The filled Mat4.

invert

invert(): Transform

Inverts this transform in-place.

Returns Transform: This transform (for chaining).

isIdentity

isIdentity(epsilon?: number): boolean

Tests whether this transform is effectively identity within the given tolerance.

Parameters

Returns boolean: True if identity within the tolerance.

mul

mul(other: Transform): Transform

Sets this transform to this * other.

Parameters

Returns Transform: This transform (for chaining).

mul2

mul2(a: Transform, b: Transform): Transform

Sets this transform to the composition of a * b. Handles aliasing (either a or b may be this).

Parameters

Returns Transform: This transform (for chaining).

transformPoint

transformPoint(point: Vec3, result: Vec3): Vec3

Transforms a point by this TRS transform: result = translation + rotation * (scale * point).

Parameters

Returns Vec3: The transformed point.

UrlReadFileSystem

Class · implements ReadFileSystem

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/url-file-system.ts#L265

ReadFileSystem for reading from URLs using fetch. Supports optional base URL for relative paths.

Automatically detects whether the server supports Range requests. If Range requests are supported, uses streaming with Range headers for efficient seeking. If not supported (e.g., Python's SimpleHTTPRequestHandler), falls back to downloading the entire file into memory first.

Constructors

constructor

new UrlReadFileSystem(baseUrl?: string)

Parameters

Methods

createSource

createSource(filename: string, progress?: ProgressCallback): Promise<ReadSource>

Create a readable source for the given path/identifier.

Parameters

Returns Promise<ReadSource>: Promise resolving to a ReadSource

WorkerQueue

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/workers/worker-queue.ts#L301

A small cross-platform (Node + browser) worker pool running the CPU-heavy tasks defined in tasks.ts off the main thread. The worker entry is built and shipped as dist/worker.mjs; the pool spawns it from a URL resolved relative to the library bundle. Node and bundlers that rewrite new Worker(new URL('./worker.mjs', import.meta.url)) (e.g. Vite, webpack) pick it up automatically; with other bundlers, set WorkerQueue.workerUrl to the deployed worker asset (mirroring WebPCodec.wasmUrl).

Workers spawn lazily on demand and run one task at a time. When workers are unavailable (running from source via tsx, maxWorkers = 0, or spawn fails) every task runs inline on the calling thread instead - same code, same results, just serial.

Accessors

maxWorkers

static get maxWorkers(): number
static set maxWorkers(value: number)

Maximum number of worker threads. Defaults to one less than the available hardware concurrency, capped at 4. (Peak memory scales with worker count, since each holds its own WebP WASM heap; 4 captures most of the parallelism for SOG writes.)

workerUrl

static get workerUrl(): string
static set workerUrl(value: string)

URL of the worker script, or null when auto-resolved relative to the bundle.

Methods

destroy

static destroy(): Promise<void>

Waits for in-flight tasks to settle, then terminates all workers. Optional: idle workers don't keep the Node process alive, and workers respawn lazily on the next run() call.

Returns Promise<void>: A promise that resolves once all workers are terminated.

ZipFileSystem

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/write/zip-file-system.ts#L69

A file system that writes files into a ZIP archive.

Creates a ZIP file containing all written files. Used internally for bundled output formats like .sog files. Archives past the classic 4 GiB / 65535-entry limits are written with zip64 records; smaller archives use the classic layout only.

Example

const outputWriter = await fs.createWriter('bundle.zip');
const zipFs = new ZipFileSystem(outputWriter);

// Write files into the zip
const writer = await zipFs.createWriter('data.json');
await writer.write(jsonData);
await writer.close();

// Finalize the zip
await zipFs.close();

ZipReadFileSystem

Class · implements ReadFileSystem

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/zip-file-system.ts#L202

Virtual filesystem for reading files from a zip archive. Wraps any ReadSource and provides memory-efficient streaming access.

Methods

close

close(): void

Close the zip filesystem and underlying source.

createSource

createSource(filename: string, _progress?: ProgressCallback): Promise<ReadSource>

Create a readable source for the given path/identifier.

Parameters

Returns Promise<ReadSource>: Promise resolving to a ReadSource

getEntry

getEntry(filename: string): Promise<ZipEntry>

Get entry metadata.

Parameters

Returns Promise<ZipEntry>: Entry metadata or undefined if not found

list

list(): Promise<string[]>

List all entries in the zip file.

Returns Promise<string[]>: Array of entry names

Bar

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/logger.ts#L95

Determinate progress bar handle. Closed explicitly via end(), or implicitly when an enclosing Group's end() (or a Logger.unwindAll) pops it as part of cleanup.

Carries a [Symbol.dispose] slot directly (rather than extending the built-in Disposable lib type) so the published .d.ts stays free of any reference to the Disposable interface. Symbol.dispose itself is still a TS 5.2+ / esnext.disposable (or es2024.disposable) lib symbol, so consumers compiling against these declarations need that lib enabled (or skipLibCheck: true). Callers on TS 5.2+ / Node 20+ can adopt using bar = logger.bar(...) because using only requires the [Symbol.dispose] shape structurally.

Methods

[dispose]

[dispose](): void

Dispose hook so using syntax closes the bar on scope exit.

end

end(): void

Close the bar and emit final timing.

tick

tick(n?: number): void

Advance the bar by n ticks.

Parameters

update

update(current: number): void

Set the bar's absolute progress. Clamped to [0, total]. Suppresses a barTick event when the value is unchanged.

Parameters

ChunkData

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/data.ts#L23

A CPU-resident buffer holding one layer's data for one chunk of gaussians.

A "chunk" is a row-range — a contiguous subset of gaussians; a ChunkData holds one layer's data for one such chunk (it carries a .layer, and you acquire and bind position/geometric/color/other separately). Buffers are acquired from a ChunkDataPool, filled by ChunkSource.read, used by consumers (writers, kernels that upload data to the GPU themselves), and then released back to the pool. The underlying ArrayBuffer is reused across subsequent acquisitions of the same byte size.

count is the number of gaussians of valid data this buffer holds; it matches the source's chunkSize except for the final (short) chunk. The backing data buffer is allocated at full chunk capacity (chunkSize * stride), so the valid region is always the leading count * stride bytes. stride is the bytes per gaussian, dictated by the layer (and, for color and other, by the SH band count or extras schema).

Properties

count

readonly count: number

Number of gaussians of valid data this buffer holds.

data

readonly data: ArrayBuffer

CPU buffer holding this layer's interleaved per-gaussian records. Its capacity may exceed count * stride (it is sized for a full chunk); only the leading count * stride bytes are meaningful.

fields

readonly fields: ChunkFieldMap

Field name -> byte offset / component descriptor within the stride.

layer

readonly layer: ChunkLayer

Which layer this buffer holds.

stride

readonly stride: number

Bytes per gaussian for this buffer's layer.

Methods

field

field(name: string): Float32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Extract one named field as a tight (de-interleaved) typed-array over the valid rows. The result is a copy — fields are generally a sub-span of the stride, so a zero-copy view isn't possible.

Parameters

Returns Float32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

release

release(): void

Return this buffer to its ChunkDataPool for reuse. After this call the buffer must not be referenced again.

ChunkDataPool

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/pool.ts#L25

A pool-backed allocator for ChunkData buffers.

The pool owns a single chunkSize (the gaussians-per-chunk granularity); every buffer it hands out is backed by an ArrayBuffer of full capacity (chunkSize * stride). A short final chunk's buffer therefore shares a pool slot with full-chunk buffers of the same layer stride — the pool keys on the buffer's byte size, so reuse is by capacity, not by the (possibly smaller) count.

No GraphicsDevice is required: these are CPU buffers. A consumer that needs GPU-resident data uploads chunkData.data itself.

Pool growth is bounded by maxPooledBytes (default 2 GB). On release, if pooling the buffer would exceed the cap, it is dropped (left to the garbage collector) instead. Call ChunkDataPool.trim to free pooled buffers down to a target.

Properties

bytesInUse

readonly bytesInUse: number

Total bytes currently held by callers (not in the pool).

bytesPooled

readonly bytesPooled: number

Total bytes free-listed and ready to be reused.

chunkSize

readonly chunkSize: number

Gaussians-per-chunk granularity this pool allocates for.

Methods

acquire

acquire(layer: ChunkLayer, layout: LayerLayout, count: number): ChunkData

Acquire a ChunkData buffer for the given layer/layout holding count gaussians of valid data (0 < count <= chunkSize). Reuses a pooled buffer of matching capacity if available; otherwise allocates a new one.

Parameters

Returns ChunkData

destroy

destroy(): void

Drop all pooled buffers. Buffers in use are unaffected.

trim

trim(targetBytes: number): void

Free pooled buffers until bytesPooled <= targetBytes.

Parameters

ChunkSource

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/source.ts#L97

Lazy, chunked, layered view onto gaussian splat data.

Sources are opened over a file (or derived from another source via a combinator) and expose only metadata up front — no gaussian data is loaded at open time except for formats whose decode is fundamentally whole-blob (SPZ, MJS). Data is materialized into caller-allocated ChunkData buffers on demand via ChunkSource.read.

Memory ownership is on the caller: buffers are acquired from a ChunkDataPool, filled by read, used, and released back to the pool. The source itself never holds long-lived buffer memory on the caller's behalf.

Methods

close

close(): Promise<void>

Release any open file handles or internal decode state. Idempotent; safe to call multiple times.

Returns Promise<void>

read

read(request: ReadRequest): Promise<void>

Fill the caller's destination buffers from the source, selecting rows either by chunk index or by an explicit index list (see ReadRequest). Layers present in the request are filled; absent layers are skipped. All passed buffers must share the same count — the chunk size for a chunk request, or count for a gather.

Every source supports both selections: a chunk is a contiguous range and a gather is an arbitrary one, but the per-row decode is the same.

Parameters

Returns Promise<void>

Group

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/logger.ts#L137

Named, timed scope returned from Logger.group. Manages the scope's lifecycle only - free-form messages, nested groups and bars are emitted via the global logger (they auto-indent under whatever is on top of the active-scope stack).

Open scopes with logger.group(name) and close them with sub.end() after the body. Embedders that catch their own exceptions (rather than letting them propagate to a logger.error() call) should call Logger.unwindAll from their catch to close any scopes/bars left dangling on the stack.

Carries a [Symbol.dispose] slot directly (rather than extending the built-in Disposable lib type) so the published .d.ts stays free of any reference to the Disposable interface. Symbol.dispose itself is still a TS 5.2+ / esnext.disposable (or es2024.disposable) lib symbol, so consumers compiling against these declarations need that lib enabled (or skipLibCheck: true). Callers on TS 5.2+ / Node 20+ can adopt using g = logger.group(...) because using only requires the [Symbol.dispose] shape structurally.

Methods

[dispose]

[dispose](): void

Dispose hook so using syntax closes the group on scope exit.

end

end(): void

Close the group, popping anything still open above it on the stack (defensively handles forgotten inner scopes) and emit the timing event.

ReadFileSystem

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/file-system.ts#L111

Interface for a file system that can create readable sources. Implementations exist for various backends (URL, Node FS, Zip, Memory).

Methods

createSource

createSource(filename: string, progress?: ProgressCallback): Promise<ReadSource>

Create a readable source for the given path/identifier.

Parameters

Returns Promise<ReadSource>: Promise resolving to a ReadSource

ReadSource

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/file-system.ts#L71

Interface representing a readable data source. Provides size information and creates streams for reading.

Properties

seekable

readonly seekable: boolean

Whether range reads are supported. If false, read() must be called with no arguments or start=0.

size

readonly size: number

The size of the source in bytes, or undefined if unknown. For compressed sources (e.g., gzipped HTTP), this may be approximate.

Methods

close

close(): void

Release any resources held by this source.

read

read(start?: number, end?: number): ReadStream

Create a stream for reading data, optionally with a byte range.

Parameters

Returns ReadStream: A ReadStream for pulling data

throws Error if range requested on non-seekable source

Renderer

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/logger.ts#L72

Renderer interface. Receives the full stream of semantic lifecycle events (LogEvent) and decides how to display them. The core does not filter scope/bar events by verbosity, so renderers see a faithful record of every scope open/close and bar progress update - embedders consuming the event stream can rely on this for progress UIs that must close themselves on completion. Visibility decisions (e.g. hiding successful scopeEnd footers at non-verbose verbosity) are the renderer's responsibility; logger.getVerbosity is available to consult.

message events for info, warn and debug are gated by verbosity at the façade (see LoggerCore.isLevelVisible) before reaching the renderer; error is always delivered.

Methods

handle

handle(event: LogEvent): void

Handle a log event.

Parameters

TextRendererOptions

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/text-renderer.ts#L9

Output streams and optional memory-usage probe for TextRenderer.

Properties

getPeakCpuMemory

getPeakCpuMemory?: () => number

Optional peak CPU-side memory probe in bytes (monotonic). Used by the [peak cpu=X] overlay gated by the renderer's mem field. In Node this is typically derived from process.resourceUsage().maxRSS (which is kernel-tracked and reflects the whole process - including ArrayBuffers - rather than just the V8 heap).

getPeakGpuMemory

getPeakGpuMemory?: () => number

Optional peak GPU memory probe in bytes (monotonic, like getPeakCpuMemory). When supplied alongside getPeakCpuMemory and reporting a non-zero value, the --memory overlay gains a gpu=Y entry: [peak cpu=X gpu=Y]. Zero suppresses the entry, so runs that never touch the GPU keep the CPU-only overlay. In the CLI this is fed by the engine's VRAM counters (see node-device.ts).

output

output?: (chunk: string) => void

Receives output events, one logical unit per call, each already terminated with \n by the renderer. Hand this to the pipeable channel (typically process.stdout.write.bind(process.stdout)). Defaults to the same sink as write when omitted.

write

write: (chunk: string) => void

Receives all status chunks (scopes, bars, messages). May contain partial-line writes (e.g. progress-bar # ticks). For TTY output, hand this to a stream that flushes on partials (process.stderr.write.bind(process.stderr) in Node) so bars render in place. For non-interactive output (CI logs, file redirects), wrap in a line buffer that holds chunks until a \n arrives - the bar's incremental writes then coalesce into a single complete line per bar.

VoxelMetadata

Interface

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/writers/write-voxel.ts#L169

Metadata for a voxel octree file.

Properties

asset

asset: { generator: string }

Asset metadata

Properties

gridBounds

gridBounds: { max: number[]; min: number[] }

Grid bounds aligned to 4x4x4 block boundaries

Properties

leafDataCount

leafDataCount: number

Total number of Uint32 entries in the leafData array

leafSize

leafSize: number

Voxels per leaf dimension (always 4)

nodeCount

nodeCount: number

Total number of Uint32 entries in the nodes array

numInteriorNodes

numInteriorNodes: number

Number of interior nodes

numMixedLeaves

numMixedLeaves: number

Number of mixed leaf nodes

sceneBounds

sceneBounds: { max: number[]; min: number[] }

Scene bounds (in PlayCanvas coordinate space for v1.1+)

Properties

treeDepth

treeDepth: number

Maximum tree depth

version

version: string

File format version

voxelResolution

voxelResolution: number

Size of each voxel in world units

CameraTrack

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/render/camera-track.ts#L70

A camera animation track evaluated in frame time.

type CameraTrack = undefined

ChunkField

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/layout.ts#L52

Description of a single named field within a layer's per-gaussian record.

byteOffset is the offset from the start of one gaussian's record; components is the count of type elements that make up the field.

type ChunkField = undefined

ChunkFieldMap

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/layout.ts#L59

Map from field name to its layout within a chunk's stride.

type ChunkFieldMap = Readonly<Record<string, ChunkField>>

ChunkLayer

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/layout.ts#L9

ChunkLayer identifiers — the disjoint storage tiers of a gaussian source.

type ChunkLayer = "position" | "geometric" | "color" | "other"

ChunkSourceMetadata

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/source.ts#L21

Static description of a ChunkSource's contents — what's in it and how it's laid out. Populated at open() time; never changes thereafter.

chunkSize is the gaussian count per chunk; all chunks are this size except the final one in each LOD, which holds lodCounts[lod] % chunkSize gaussians (or chunkSize if the count divides evenly).

layouts exposes the byte stride and named field map for each available layer, used by callers when acquiring ChunkData buffers from a ChunkDataPool.

LOD is a structural axis: a chunk belongs to exactly one LOD. Sources never carry a per-gaussian LOD tag.

type ChunkSourceMetadata = undefined

CollisionMeshShape

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/types.ts#L12

Collision mesh shape generated alongside voxel output.

type CollisionMeshShape = "smooth" | "faces"

ColumnType

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/data-table/data-table.ts#L12

String identifiers for typed array element types.

type ColumnType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "float32" | "float64"

Decimate

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L167

Simplify splats to a target count using NanoGS progressive pairwise merging.

Instead of discarding low-visibility splats, this iteratively merges nearby similar splats into single approximating Gaussians using Mass-Preserving Moment Matching (MPMM), preserving scene structure and appearance.

Removal is allocated at a uniform rate everywhere; for the adaptive variant call decimateSourceAdaptive() directly.

type Decimate = undefined

DecimateAdaptiveSpill

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/decimate/decimate-source.ts#L72

Where intermediate generations spill when they exceed the in-memory budget. remove deletes a spill file once its generation is consumed (optional; without it temp files are left behind).

type DecimateAdaptiveSpill = undefined

DecimateSpill

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/decimate-uniform/decimate-source.ts#L47

Where intermediate generations spill when they exceed the in-memory budget. remove deletes a spill file once its generation is consumed (optional; without it temp files are left behind).

type DecimateSpill = undefined

DeviceCreator

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/types.ts#L203

A function that creates a PlayCanvas GraphicsDevice on demand.

Used for GPU-accelerated operations such as SOG compression and voxelization. The application is responsible for caching if needed.

type DeviceCreator = () => Promise<GraphicsDevice>

ExtraColumn

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/layout.ts#L121

Descriptor for a single column in the other layer.

type ExtraColumn = undefined

FileInfo

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/read.ts#L209

Header-only structural metadata for a splat file — the lightweight counterpart to a full read, for validating/inspecting a file (e.g. before upload) without decoding its gaussian data. Reports every LOD level.

For formats opened via readFile, integrity (truncation/corruption) is enforced by the readers themselves, which throw on a size mismatch — so a returned FileInfo implies a sound file. The sog and spz header peeks validate the header but not the payload.

type FileInfo = undefined

FilterBands

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L84

Remove spherical harmonic bands above a threshold.

type FilterBands = undefined

FilterBox

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L94

Keep only splats within a bounding box.

type FilterBox = undefined

FilterByValue

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L70

Filter splats by comparing a column value.

For opacity, scale_0/1/2, and f_dc_0/1/2, the value is specified in user-friendly (transformed) space: linear opacity (0-1), linear scale, and linear color (0-1). The value is automatically converted to raw PLY space before comparison.

To compare against raw PLY values directly (without the user-friendly conversion), use the _raw suffix (e.g. opacity_raw, scale_0_raw, f_dc_0_raw).

If the DataTable has a pending spatial transform and the column is affected by it (position, rotation, scale, or SH columns), the transform is applied (baked in) before comparison. This applies to both regular and _raw columns.

type FilterByValue = undefined

FilterCluster

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L201

Filter Gaussians to keep only those in the connected cluster at a seed position.

GPU-voxelizes the scene at a coarse resolution, finds the connected component of occupied blocks containing the seed, and keeps only Gaussians whose AABB overlaps that cluster.

type FilterCluster = undefined

FilterFloaters

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L183

Remove Gaussians that don't meaningfully contribute to any solid voxel.

GPU-voxelizes the scene at a given resolution, then evaluates each Gaussian's opacity contribution at occupied voxel centers. Discards Gaussians whose contribution is below a minimum threshold at every solid voxel.

type FilterFloaters = undefined

FilterNaN

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L51

Remove splats containing NaN or Infinity values.

type FilterNaN = undefined

FilterSphere

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L106

Keep only splats within a sphere.

type FilterSphere = undefined

Info

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L142

Print structural metadata (per-LOD counts, columns, SH bands) to the logger — the cheap, header-level counterpart to Stats (no data specifics).

type Info = undefined

InputFormat

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/read.ts#L35

Supported input file formats for Gaussian splat data.

type InputFormat = "mjs" | "ksplat" | "splat" | "sog" | "ply" | "spz" | "lcc" | "lcc2" | "lod"

LayerLayout

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/layout.ts#L68

The byte stride and per-field map for a single layer of a source.

Sources publish a LayerLayout per available layer in their metadata. Callers pass a layout (along with a gaussian count) to a ChunkDataPool's acquire to receive a properly-sized ChunkData.

type LayerLayout = undefined

LodStats

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/ops/stats.ts#L69

Per-LOD column statistics: identity (lod, numGaussians), the column-name axis (columns), and the aligned measurement arrays (data). JSON.stringify of this is the stats JSON output shape (NaN fields — e.g. an all-NaN column's min — serialize as null).

type LodStats = undefined

LodStatsData

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/ops/stats.ts#L34

A LOD's measurements in columnar (struct-of-arrays) form: every field is an array index-aligned with the owning LodStats's columns.

type LodStatsData = undefined

LogEvent

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/logger.ts#L31

Semantic event delivered to a Renderer. Renderers can filter, format and display these as they wish.

scopeStart / scopeEnd represent the open/close of a Group. They carry optional index / total fields when the scope is part of a numbered series, which renderers can use to switch to a [N/T] name style.

barStart / barTick / barEnd represent a determinate progress bar. The bar's name is repeated on every event so the renderer can keep its label stable across in-place updates while tracking progress via current and total.

output is the pipeable channel: each event represents a single logical unit of output (typically one line - or a multi-line block treated as a unit) that the renderer is expected to terminate with a newline. Callers should not include a trailing \n themselves.

type LogEvent = { depth: number; index?: number; kind: "scopeStart"; name: string; total?: number } | { depth: number; durationMs: number; failed?: boolean; index?: number; kind: "scopeEnd"; name: string; total?: number } | { depth: number; kind: "barStart"; name: string; total: number } | { current: number; depth: number; kind: "barTick"; name: string; total: number } | { current: number; depth: number; durationMs: number; failed?: boolean; kind: "barEnd"; name: string; total: number } | { depth: number; kind: "message"; level: MessageKind; text: string } | { kind: "output"; text: string }

Logger

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/logger.ts#L583

Public type alias for the logger object. Embedders can type-hint against this to inject a configured logger.

type Logger = typeof logger

MessageKind

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/logger.ts#L11

Severity tag for free-form messages (ordered descending by severity).

type MessageKind = "error" | "warn" | "info" | "debug"

MortonOrder

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L152

Reorder splats by Morton code (Z-order curve) for improved spatial locality.

type MortonOrder = undefined

Options

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/types.ts#L17

Options for read/write operations.

type Options = undefined

OutputFormat

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/write.ts#L27

Supported output file formats for Gaussian splat data.

type OutputFormat = "csv" | "sog" | "sog-bundle" | "lod" | "compressed-ply" | "ply" | "splat" | "spz" | "glb" | "html" | "html-bundle" | "voxel" | "image"

Param

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/types.ts#L190

Parameter passed to MJS generator scripts (see ReadFileOptions.params).

type Param = undefined

ProcessAction

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L243

A processing action to apply to splat data.

Actions can transform, filter, or analyze the data:

type ProcessAction = Translate | Rotate | Scale | FilterNaN | FilterByValue | FilterBands | FilterBox | FilterSphere | FilterFloaters | FilterCluster | ProcessParam | Stats | Info | MortonOrder | Decimate

ProcessOptions

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L217

Options for processing actions that require external resources.

type ProcessOptions = undefined

ProcessParam

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L118

Parameter for .mjs generator modules.

type ProcessParam = undefined

ProgressCallback

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/file-system.ts#L104

Progress callback for tracking read operations.

type ProgressCallback = (bytesLoaded: number, totalBytes: number | undefined) => void

ReadFileOptions

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/read.ts#L95

Options for reading a Gaussian splat file.

type ReadFileOptions = undefined

ReadRequest

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/source.ts#L79

A read request to a ChunkSource, selecting source rows in one of two ways:

Gather underpins the LOD writer's "positions resident, heavy data fetched per output chunk" pass — for a fixed-stride file source each row is a byte-range read, so a unit pulls only its own gaussians (≈ 1× total reads, no whole-scene residency). The two are the same operation with a different row selection; the decode is identical, which is why a source serves both from one read.

The arms are disjoint on the indices key, so an implementation discriminates with 'indices' in request (gather) vs the chunk path otherwise.

type ReadRequest = ReadTarget & { chunkIndex: number } | ReadTarget & { count: number; indexOffset: number; indices: Uint32Array }

ReadTarget

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/source.ts#L49

Fields common to every ReadRequest: which LOD to read and the destination buffers for whichever layers the caller wants filled. Layers omitted from the request are skipped.

type ReadTarget = undefined

Rotate

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L31

Rotate splats by Euler angles.

type Rotate = undefined

Scale

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L41

Uniformly scale all splats.

type Scale = undefined

SHBands

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/layout.ts#L19

Spherical harmonics band count.

type SHBands = 0 | 1 | 2 | 3

SourceStats

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/ops/stats.ts#L97

Statistics for an entire source: one LodStats per LOD level.

type SourceStats = undefined

SplatModel

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/splat-model.ts#L11

How a scene was trained, and therefore how a renderer must evaluate it.

The variants are mutually exclusive, hence one enum rather than independent flags. A source that carries no tag reads as default.

type SplatModel = "default" | "antialiased" | "2dgs"

Stats

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L131

Print per-LOD, per-column statistics (with the structural info block) to the logger — the data-level counterpart to Info.

type Stats = undefined

TrackPose

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/render/camera-track.ts#L60

A camera pose on a track: position, look-at target, vertical fov in degrees and, optionally, a unit up vector (the renderer's up option applies when absent, so tracks predating up keep working).

type TrackPose = undefined

Translate

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L21

Translate splats by a 3D vector offset.

type Translate = undefined

TypedArray

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/data-table/data-table.ts#L6

Union of all typed array types supported for column data.

type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array

Verbosity

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/logger.ts#L8

Verbosity level controlling which messages reach the renderer.

type Verbosity = "quiet" | "normal" | "verbose"

WriteImageOptions

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/writers/write-image.ts#L36

Options for writing a rendered splat image.

type WriteImageOptions = undefined

WriteSourceOptions

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/write.ts#L142

Options for writeSource.

type WriteSourceOptions = undefined

WriteVoxelOptions

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/writers/write-voxel.ts#L130

Options for writing a voxel octree file.

type WriteVoxelOptions = undefined

ZipEntry

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/zip-file-system.ts#L7

Metadata for a zip file entry.

type ZipEntry = undefined

bakeTransform

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/ops/bake-transform.ts#L31

bakeTransform(src: ChunkSource, targetSpace: Transform): ChunkSource

Bake a source's pending coordinate-space transform into a target space, lazily and per chunk — the streaming analog of convertToSpace.

Computes delta = targetSpace⁻¹ · meta.transform once; each read delegates to the parent (filling the caller's buffers with raw data) and then applies delta in place to whichever layers were requested, exactly as transformColumns does for a DataTable:

The returned source reports meta.transform = targetSpace (its data is now baked). Consumers (writers, GPU feeds) wrap their input with this once and never reimplement transform handling.

Parameters

Returns ChunkSource: A derived source whose reads yield data in targetSpace.

combine

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/data-table/combine.ts#L26

combine(dataTables: DataTable[]): DataTable

Combines multiple DataTables into a single DataTable.

Merges rows from all input tables. Columns are matched by name and type; columns that don't exist in all tables will have undefined values for rows from tables lacking that column.

If tables have differing source transforms, all data is first converted to engine coordinate space (identity transform) before combining.

Parameters

Returns DataTable: A new DataTable containing all rows from all input tables.

Example

const combined = combine([tableA, tableB, tableC]);
console.log(combined.numRows); // tableA.numRows + tableB.numRows + tableC.numRows

computeStats

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/stats.ts#L28

computeStats(input: DataTable | ChunkSource, pool?: ChunkDataPool): Promise<SourceStats>

Compute per-LOD, per-column statistics for splat data in a single streaming pass — exact min/max/mean/stdDev/NaN/Inf, an approximate median, and a 16-bin histogram per column, in columnar form (see SourceStats).

Accepts either a ChunkSource (read chunk-by-chunk, constant memory) or a legacy DataTable (bridged transiently; yields a single LOD). Values are the raw, unbaked values — any pending transform is not applied.

Parameters

Returns Promise<SourceStats>: The per-LOD statistics.

Example

const stats = await computeStats(dataTable);
const { columns, mean } = stats.lods[0];
console.log(mean[columns.indexOf('opacity')]);

concatSource

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/ops/concat-source.ts#L34

concatSource(allSources: ChunkSource[], pool: ChunkDataPool): ChunkSource

Concatenate several sources end-to-end into one, as a lazy view.

Output gaussians are the inputs' gaussians in order: all of sources[0], then all of sources[1], and so on. Every source must agree on layout (chunk size, SH bands, available layers, extra columns) and on the pending coordinate-space transform — concatenating data in mismatched spaces is silently wrong, so a transform mismatch throws (the caller must bake to a common space first).

Single-LOD only. Reads stitch contiguous row ranges: an output chunk is filled by block-copying the overlapping span out of each contributing source chunk (order is preserved, so each overlap is a contiguous byte range — one set() per layer, not a per-row gather). Source chunks are read on demand; peak extra memory is one source chunk-set of temporaries.

Parameters

Returns ChunkSource: A derived source serving the concatenated gaussians chunk-by-chunk.

createChunkDataPool

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/pool.ts#L59

createChunkDataPool(options?: object): ChunkDataPool

Create a CPU ChunkData pool.

Parameters

Returns ChunkDataPool: A new ChunkDataPool.

dataTableToChunkSource

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/compat/data-table.ts#L153

dataTableToChunkSource(dataTable: DataTable, chunkSize?: number, indices?: Uint32Array, model?: SplatModel): InMemoryChunkSource

Convert a legacy DataTable into a ChunkSource by repacking its columnar data into the canonical per-layer interleaved layout.

Detects SH band count from the highest f_rest_* index, identifies non-standard columns as other-layer extras, and copies each gaussian's fields into the appropriate per-layer buffer.

Used during the 3.0 migration by readers that haven't yet been ported to native chunked decoding — they call this at the end of their existing decode to upgrade to the new return type.

When indices is supplied, only those rows are repacked, in that order — a direct ordered-subset gather (e.g. the LOD writer's per-unit gather), avoiding a separate DataTable.clone({ rows }) copy.

Parameters

Returns InMemoryChunkSource: A CPU-resident InMemoryChunkSource over the repacked data.

decimateSource

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/decimate-uniform/decimate-source.ts#L122

decimateSource(source: ChunkSource, pool: ChunkDataPool, opts: DecimateOptions): Promise<ChunkSource>

Chunk-native, memory-bounded decimation to an exact target count.

Design: positions resident; KD blocks as an IO pattern only; per-block exact global 16-NN + edge costs (GPU when a device is supplied) reduced to K resident candidates; global bucketed greedy matching with chain closure; a second heavy pass moment-matches groups and streams the output.

The returned source supports a single sequential pass (it computes the merge stream on demand) — the PLY-terminal consumption model. Its close releases the input source and any intermediate spill files. Deep targets run multiple generations; intermediates land in RAM when small enough, else in temp PLY spills under opts.spill.scratchDir.

Parameters

Returns Promise<ChunkSource>: The decimated stream-once source with exact metadata.

decimateSourceAdaptive

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/decimate/decimate-source.ts#L179

decimateSourceAdaptive(source: ChunkSource, pool: ChunkDataPool, opts: DecimateOptions): Promise<ChunkSource>

Chunk-native, memory-bounded decimation to an exact target count.

Design: positions resident; KD blocks as an IO pattern only; per-block exact global 16-NN + edge costs (GPU when a device is supplied) reduced to K resident candidates; global bucketed greedy matching with chain closure; a second heavy pass moment-matches groups and streams the output.

The returned source supports a single sequential pass (it computes the merge stream on demand) — the PLY-terminal consumption model. Its close releases the input source and any intermediate spill files. Deep targets run multiple generations; intermediates land in RAM when small enough, else in temp PLY spills under opts.spill.scratchDir.

Parameters

Returns Promise<ChunkSource>: The decimated stream-once source with exact metadata.

fmtBytes

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/fmt.ts#L28

fmtBytes(n: number): string

Format a byte count using binary (1024-based) units.

Parameters

Returns string: The formatted string (e.g. 1.5MB).

fmtCount

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/fmt.ts#L59

fmtCount(n: number): string

Format a count using SI suffixes (K/M/B/T) above 1000.

Parameters

Returns string: The formatted string.

fmtTime

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/fmt.ts#L11

fmtTime(ms: number): string

Format a duration in milliseconds as a human-readable string.

Parameters

Returns string: The formatted string.

getOutputFormat

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/write.ts#L56

getOutputFormat(filename: string, options: Options): OutputFormat

Determines the output format based on file extension and options.

Parameters

Returns OutputFormat: The detected output format.

throws Error if the file extension is not recognized.

Example

const format = getOutputFormat('scene.ply', {});  // returns 'ply'
const format2 = getOutputFormat('scene.sog', {});  // returns 'sog-bundle'

isSplatModel

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/splat-model.ts#L23

isSplatModel(value: unknown): value is SplatModel

Narrow an externally-supplied string to a SplatModel. Per-format readers use this on whatever their container spells the tag as.

Parameters

Returns value is SplatModel: True if value is a model name.

loadCameraTrack

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/render/camera-track.ts#L472

loadCameraTrack(json: unknown, defaultFov: number, defaultUp?: Vec3Like): CameraTrack

Build a camera track from parsed JSON, detecting the source by shape.

Parameters

Returns CameraTrack: The track.

materializeToDataTable

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/compat/data-table.ts#L289

materializeToDataTable(src: ChunkSource, pool: ChunkDataPool, layers?: Set<ChunkLayer>): Promise<DataTable>

Materialize a ChunkSource into the legacy columnar DataTable representation.

Each requested layer is read chunk-by-chunk and scattered into the appropriate named columns (x, y, z, rot_*, scale_*, opacity, f_dc_*, f_rest_*, plus extras).

Parameters

Returns Promise<DataTable>: A DataTable holding the source's gaussians in canonical column form.

processDataTable

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process.ts#L318

processDataTable(dataTable: DataTable, processActions: ProcessAction[], options?: ProcessOptions): Promise<DataTable>

Applies a sequence of processing actions to splat data.

Actions are applied in order and can include transformations (translate, rotate, scale), filters (NaN, value, box, sphere, bands), and analysis (stats).

Parameters

Returns Promise<DataTable>: The processed DataTable (may be a new instance if filtered).

Example

import { Vec3 } from 'playcanvas';

const processed = await processDataTable(dataTable, [
    { kind: 'scale', value: 0.5 },
    { kind: 'translate', value: new Vec3(0, 1, 0) },
    { kind: 'filterNaN' },
    // opacity value is in linear space (0-1), automatically converted to logit for comparison
    { kind: 'filterByValue', columnName: 'opacity', comparator: 'gt', value: 0.1 }
]);

processSource

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process-source.ts#L58

processSource(source: ChunkSource, actions: ProcessAction[], pool: ChunkDataPool, options?: ProcessOptions): Promise<ChunkSource>

Apply a sequence of processing actions to a ChunkSource, the streaming analog of processDataTable. Transforms compose lazily onto the pending meta.transform (via mapSource); filters scan the source and return a filtered view (via filterSource); stats streams a one-pass per-LOD accumulation (via computeSourceStats) — a diagnostic pass that leaves the data unchanged.

Supports only the SOURCE_ACTION_KINDS; throws on any unsupported action rather than silently dropping it (processSourceBridged owns the processDataTable fallback for everything else).

Parameters

Returns Promise<ChunkSource>: The processed source (a view chain over source).

processSourceBridged

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/process-source.ts#L150

processSourceBridged(source: ChunkSource, actions: ProcessAction[], pool: ChunkDataPool, options?: ProcessOptions): Promise<ChunkSource>

Apply an ordered action list to a ChunkSource, streaming the chunk-native runs and bridging only the DataTable-only runs. Consecutive actions are grouped into maximal same-mode runs (order preserved): a chunk-native run (SOURCE_ACTION_KINDS) goes through processSource; a DataTable-only run (decimate, the GPU voxel filters, …) materializes once, runs processDataTable, and re-bridges to a source via dataTableToChunkSource. So the not-yet-chunked ops do their work inline as islands and everything around them keeps streaming.

Parameters

Returns Promise<ChunkSource>: The processed source.

readFile

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/read.ts#L138

readFile(readFileOptions: ReadFileOptions): Promise<ChunkSource[]>

Reads a Gaussian splat file and returns its data as ChunkSources (usually one; a Streamed SOG/LCC/LCC2 container yields a single structural multi-LOD source).

Readers are chunk-native: ply/splat/spz/lcc/lcc2/lod return lazy / streaming sources whose close() releases the underlying file(s); whole-blob formats (sog/mjs/ksplat) are decoded up front and returned resident. Callers that need a DataTable materialize at their own boundary (and call source.close() when done).

Per-format progress (decoding bars, multi-payload bars) is emitted directly by each reader through the global logger; install a renderer via logger.setRenderer(...) to consume those events.

Parameters

Returns Promise<ChunkSource[]>: Promise resolving to an array of chunk sources containing the splat data.

Example

import { readFile, getInputFormat, UrlReadFileSystem } from '@playcanvas/splat-transform';

const filename = 'scene.ply';
const fileSystem = new UrlReadFileSystem('https://example.com/');
const sources = await readFile({
    filename,
    inputFormat: getInputFormat(filename),
    fileSystem
});

readFileInfo

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/read.ts#L277

readFileInfo(readFileOptions: ReadFileOptions): Promise<FileInfo>

Read a splat file's structural metadata as efficiently as the format allows — from the header alone wherever possible, without decoding gaussian data, and across every LOD level.

sog is peeked from meta.json (no WebP decode) and spz from its 16-byte header (no payload decode: gzip-wrapped v1-3 files inflate only enough of the stream to reach the header); every other format opens via readFile (header-only for the lazy readers; eager for ksplat/mjs) and reads its meta. For those, integrity is enforced by the readers, which throw on a size mismatch, so a returned FileInfo implies a structurally sound file; the sog/spz peeks validate the header but not the payload. A FileInfo doesn't imply splat data either: a permissive container (e.g. a point-cloud PLY) reads fine with gaussian: false. To test "is this a valid splat", check both: a throw means unreadable, gaussian is the data verdict.

Parameters

Returns Promise<FileInfo>: The file's FileInfo.

readPly

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/readers/read-ply.ts#L734

readPly(source: ReadSource, pool: ChunkDataPool): Promise<ChunkSource>

Open a gaussian-splat PLY as a ChunkSource. The single public PLY reader.

Standard uncompressed binary PLY is read lazily: only the header is parsed at open time, and each read seeks the requested chunk's byte range, pulls just those records, and de-interleaves the requested layers into the caller's buffers. Standard gaussian properties map to the position/geometric/color layers; non-standard properties (e.g. normals) become other-layer extras.

Compressed PLY (the packed chunk+vertex format) is read lazily too: each chunk is range-read and dequantized on demand (see readCompressedChunked). Either way the data is labelled Transform.PLY.

The source must be seekable (range reads).

Parameters

Returns Promise<ChunkSource>: A lazy ChunkSource over the file.

resolveSplatModel

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/splat-model.ts#L35

resolveSplatModel(models: SplatModel[]): SplatModel

Resolve the model of a combined scene. Mixing models can't be represented in one output, so any disagreement falls back to default — the safe read, since every variant renders acceptably (if not optimally) as ordinary gaussians.

Parameters

Returns SplatModel: The agreed model, or default when they disagree.

selectLod

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/ops/select-lod.ts#L17

selectLod(src: ChunkSource, level: number): ChunkSource

View a single LOD level of a multi-LOD source as a single-LOD source — the inverse of stackLods. Reads (chunk or gather) forward to the parent with lod: level; metadata is narrowed to that level's counts.

Several selectLod views typically share one parent (one per level, then re-stacked), so close() is a no-op: the caller owns the parent's lifetime and closes it once. (A view closing the shared parent would break the other levels — e.g. a per-level pass that materializes one level.)

Parameters

Returns ChunkSource: A single-LOD source over src's level level.

sortMortonColumns

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/ops/morton-order.ts#L166

sortMortonColumns(x: ArrayLike<number>, y: ArrayLike<number>, z: ArrayLike<number>, indices: Uint32Array): void

Sort indices in place into morton (Z-order) using columnar positions: point g's coordinates are x[g], y[g], z[g]. The columnar sibling of sortMortonInterleaved for resident position columns (e.g. the LOD writer's slim centroids) and DataTable x/y/z columns.

Parameters

sortMortonInterleaved

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/ops/morton-order.ts#L151

sortMortonInterleaved(positions: ArrayLike<number>, indices: Uint32Array, stride?: number): void

Sort indices in place into morton (Z-order) using interleaved positions [x, y, z, x, y, z, ...] — the natural packing of the position layer.

stride lets the same call sort a wider record whose first three words are xyz, e.g. a packed [x, y, z, w] GPU texture row viewed as floats, without copying the positions out first.

Parameters

stackLods

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/ops/stack-lods.ts#L22

stackLods(sources: ChunkSource[]): ChunkSource

Stack N single-LOD sources into one structural multi-LOD source: output LOD i is sources[i]. read dispatches by request.lod to the matching source (read at its own LOD 0). numGaussians is LOD 0's count; lodCounts[i] is sources[i]'s gaussian count.

This is how per-detail-level inputs become one structural scene for the LOD writer — multi-PLY --tag-lod tags (one source per tagged level) or a DataTable split by its lod column — replacing the old per-gaussian lod tag array. LOD is a structural axis here; no source carries a per-gaussian LOD tag.

All inputs must share layout (chunk size, SH bands, layers, extras, transform) and be single-LOD; the stacked metadata is inherited from sources[0].

Parameters

Returns ChunkSource: A multi-LOD source dispatching by LOD to the inputs.

writeImage

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/writers/write-image.ts#L214

writeImage(options: WriteImageOptions, fs: FileSystem): Promise<void>

Renders the splat scene to a lossless WebP image written via fs, or to a sequence of them along a camera track.

Parameters

Returns Promise<void>

Example

await writeImage({
    filename: 'view.webp',
    source,
    pool,
    cameraPosition: { x: 0, y: 0, z: 5 },
    fov: 60,
    width: 1920, height: 1080,
    createDevice: async () => myDevice
}, fs);

writeSource

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/write.ts#L172

writeSource(writeSourceOptions: WriteSourceOptions, fs: FileSystem): Promise<void>

Write a ChunkSource to a file. Formats with a source writer (ply, sog, compressed-ply, splat, image) consume the source directly; the rest (csv, spz, glb, html, voxel) still take a DataTable, so the source is materialized right here and the table stays a private detail of those writers until each is ported.

lod output is written via writeLodSource (multi-LOD + env), not here.

Each writer is responsible for opening its own Writing log group and emitting filename (size) info entries per output file.

Parameters

Returns Promise<void>

writeVoxel

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/writers/write-voxel.ts#L420

writeVoxel(options: WriteVoxelOptions, fs: FileSystem): Promise<void>

Voxelizes Gaussian splat data and writes the result as a sparse voxel octree.

This function performs GPU-accelerated voxelization of Gaussian splat data and outputs two or three files:

The binary file layout is:

Parameters

Returns Promise<void>

Example

import { writeVoxel, MemoryFileSystem } from '@playcanvas/splat-transform';

const fs = new MemoryFileSystem();
await writeVoxel({
    filename: 'scene.voxel.json',
    dataTable: myDataTable,
    voxelResolution: 0.05,
    opacityCutoff: 0.1,
    collisionMesh: true,
    createDevice: async () => myGraphicsDevice
}, fs);

logger

Variable

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/logger.ts#L455

Public logger surface.

Open named, timed scopes with Logger.group. Pass { index, total } to render the group as part of a numbered series. Indeterminate progress is reported with Logger.bar. Free-form messages route through info / warn / error / debug, indented under whatever is on top of the active-scope stack.

Both group and bar are pure-push operations: opening a new scope simply places it on top of the stack without auto-closing siblings, so call order directly determines nesting. Close scopes with handle.end() after the body. Callers that route failures through Logger.error get scope cleanup for free; embedders that swallow exceptions should call Logger.unwindAll from their catch to close every still-open scope.

const logger: { bar: any; debug: any; error: any; getVerbosity: any; group: any; info: any; output: any; setRenderer: any; setVerbosity: any; unwindAll: any; warn: any }

Properties

revision

Variable

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/version.ts#L9

The splat-transform revision (short Git hash of HEAD at build time).

const revision: "$_CURRENT_REVISION" = '$_CURRENT_REVISION'

version

Variable

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/version.ts#L4

The splat-transform version (semver MAJOR.MINOR.PATCH).

const version: "$_CURRENT_VERSION" = '$_CURRENT_VERSION'