gaussian-splat-lite 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { IndexedSplats } from "./IndexedSplats.cjs";
2
2
  import type { ReorderedSplatResult } from "./defines.cjs";
3
3
  export type RadPagedSplatsOptions = {
4
- /** Maximum records in one decoded chunk. Defaults to Spark's 65,536. */
4
+ /** Maximum records in one decoded chunk. Defaults to 65,536. */
5
5
  pageSize?: number;
6
6
  pageCount: number;
7
7
  numSh: number;
@@ -1,7 +1,7 @@
1
1
  import { IndexedSplats } from "./IndexedSplats.js";
2
2
  import type { ReorderedSplatResult } from "./defines.js";
3
3
  export type RadPagedSplatsOptions = {
4
- /** Maximum records in one decoded chunk. Defaults to Spark's 65,536. */
4
+ /** Maximum records in one decoded chunk. Defaults to 65,536. */
5
5
  pageSize?: number;
6
6
  pageCount: number;
7
7
  numSh: number;
@@ -7,7 +7,7 @@ export type RadChunkRange = {
7
7
  count?: number;
8
8
  filename?: string;
9
9
  };
10
- /** Spark RAD version 1 directory. Child references use file-global indices. */
10
+ /** RAD version 1 directory. Child references use file-global indices. */
11
11
  export type RadMeta = {
12
12
  version: number;
13
13
  type: "gsplat";
@@ -43,7 +43,7 @@ export type RadDecodedChunk = PostDecodeSplatData & {
43
43
  lodRadii?: Float32Array;
44
44
  };
45
45
  export declare function unpackRadChunk(decoded: RadDecodedChunk): RadChunkData;
46
- /** Without chunkSize, Spark treats the dataset as one chunk. */
46
+ /** Without chunkSize, the dataset is treated as one chunk. */
47
47
  export declare function getRadChunkSpan(
48
48
  meta: RadMeta,
49
49
  index: number,
@@ -7,7 +7,7 @@ export type RadChunkRange = {
7
7
  count?: number;
8
8
  filename?: string;
9
9
  };
10
- /** Spark RAD version 1 directory. Child references use file-global indices. */
10
+ /** RAD version 1 directory. Child references use file-global indices. */
11
11
  export type RadMeta = {
12
12
  version: number;
13
13
  type: "gsplat";
@@ -43,7 +43,7 @@ export type RadDecodedChunk = PostDecodeSplatData & {
43
43
  lodRadii?: Float32Array;
44
44
  };
45
45
  export declare function unpackRadChunk(decoded: RadDecodedChunk): RadChunkData;
46
- /** Without chunkSize, Spark treats the dataset as one chunk. */
46
+ /** Without chunkSize, the dataset is treated as one chunk. */
47
47
  export declare function getRadChunkSpan(
48
48
  meta: RadMeta,
49
49
  index: number,
@@ -0,0 +1,91 @@
1
+ # Building RAD files
2
+
3
+ [Back to documentation](../README.md#documentation)
4
+
5
+ Convert PLY or SPZ models into RAD files with levels of detail (LOD), ready for [RAD streaming](RadStreamScheduler.md). Requires Node.js 20.19+ on the 20.x branch, or 22.12+. No compilation is required.
6
+
7
+ ```sh
8
+ npm install --global gaussian-splat-lite
9
+ gsl-build-lod scene.ply
10
+ ```
11
+
12
+ This writes `scene-lod.rad` beside the input. Large models can take a long time to convert.
13
+
14
+ To run without a global installation:
15
+
16
+ ```sh
17
+ npx --package gaussian-splat-lite gsl-build-lod scene.ply
18
+ ```
19
+
20
+ From a repository checkout, first build the decoder with `npm run build:wasm:lod` (requires Rust), then use `npm run build-lod -- <input>` with the same options. The full `npm run build:wasm` command also builds the decoder.
21
+
22
+ ## Inputs and output
23
+
24
+ Inputs must be `.ply` or `.spz` files. Splats with NaN or infinite values, or a zero rotation, are skipped, and the conversion reports how many.
25
+
26
+ ```sh
27
+ # Convert several files, each to its own RAD file.
28
+ gsl-build-lod room.ply garden.spz
29
+
30
+ # Choose an output path for a single input.
31
+ gsl-build-lod scene.ply -o output/scene.rad
32
+
33
+ # Keep only the base color, reducing file size and memory use.
34
+ gsl-build-lod scene.ply --max-sh 0
35
+ ```
36
+
37
+ The output directory must exist. Existing output files, including matching `.radc` files when using `--rad-chunked`, are never overwritten. Choose a different output name or remove the old files before converting again. Output files are first written under hidden temporary names in the output directory and receive their final names only after all of them are complete. Failed conversions return a nonzero exit code and remove their output files; if a file cannot be removed, a warning shows its path.
38
+
39
+ The output keeps up to SH3. SH4 inputs are accepted and converted to SH3 or the level chosen with `--max-sh`. Higher SH levels retain more view-dependent color and increase file size. Conversion is lossy, so colors and shape can differ slightly from the source.
40
+
41
+ ## LOD spacing
42
+
43
+ ```sh
44
+ gsl-build-lod scene.ply --lod-base 1.75
45
+ ```
46
+
47
+ `--lod-base` controls the spacing between detail levels (default `1.75`, range `1.1`–`16`). Smaller values produce more intermediate levels and usually larger files; larger values produce fewer levels and usually smaller files. This setting does not discard input splats.
48
+
49
+ ## Memory and temporary storage
50
+
51
+ ```sh
52
+ gsl-build-lod scene.ply --memory-budget 16 --temp-dir /fast-disk/rad-temp
53
+ ```
54
+
55
+ `--memory-budget` sets a target in GiB (default `4`, minimum `1`, fractional values accepted). Values such as `16` are supported when enough RAM is available. Lower targets may make conversion slower and require more temporary disk space; output quality is unchanged. If conversion reports insufficient memory, increase this value.
56
+
57
+ The target covers the whole conversion, worker threads included: the converter measures its memory as it runs and keeps within it. Leave room for the operating system and other applications.
58
+
59
+ `--temp-dir` chooses where temporary working files are stored; the default is the system temporary directory. Use a fast disk with enough free space, as temporary files can be much larger than the input. Each conversion keeps them in its own `gsl-build-rad-*` folder there, which is removed when the conversion finishes or fails; if it cannot be removed, a warning shows its path.
60
+
61
+ ## Split files
62
+
63
+ ```sh
64
+ gsl-build-lod scene.ply --rad-chunked
65
+ ```
66
+
67
+ This writes `scene-lod.rad` plus `scene-lod-0.radc`, `scene-lod-1.radc`, and so on.
68
+
69
+ Host all files together in the same directory and load the `.rad` file. A single `.rad` file also supports streaming; its server must support HTTP Range requests.
70
+
71
+ ```js
72
+ import { RadStreamScheduler } from "gaussian-splat-lite";
73
+
74
+ const streaming = new RadStreamScheduler({
75
+ url: "/models/scene-lod.rad",
76
+ });
77
+ ```
78
+
79
+ See [RadStreamScheduler](RadStreamScheduler.md) for the complete loading and display example.
80
+
81
+ ## Options
82
+
83
+ | Option | Default | Description |
84
+ | --- | --- | --- |
85
+ | `--lod-base <base>` | `1.75` | LOD spacing, from `1.1` to `16`; smaller values retain more detail levels. |
86
+ | `--max-sh <0..3>` | `3` | Highest SH degree to keep, limited by the input. |
87
+ | `--memory-budget <GiB>` | `4` | Target memory use in GiB, at least `1`; for example `16`. |
88
+ | `--temp-dir <path>` | System temp directory | Location for temporary files; created if needed. |
89
+ | `--rad-chunked` | Disabled | Write a header and separate `.radc` files. |
90
+ | `-o <path>` or `--output <path>` | `<input-stem>-lod.rad` | Output path; requires exactly one input. |
91
+ | `-h` or `--help` | — | Show command help. |
@@ -2,7 +2,9 @@
2
2
 
3
3
  [Back to documentation](../README.md#documentation)
4
4
 
5
- Shows large RAD scenes by loading only the detail the camera needs, and updating it as the camera moves. It supports RAD version 1 files with levels of detail (LOD), either as a single `.rad` file or split into a header and `.radc` pages. It works on WebGPU and WebGL2, and needs no Spark runtime.
5
+ Shows large RAD scenes by loading only the detail the camera needs, and updating it as the camera moves. It supports RAD version 1 files with levels of detail (LOD), either as a single `.rad` file or split into a header and `.radc` pages. It works on WebGPU and WebGL2.
6
+
7
+ To convert your own models, see [Building RAD files](BuildRad.md).
6
8
 
7
9
  ```js
8
10
  import { RadStreamScheduler } from "gaussian-splat-lite";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaussian-splat-lite",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Three.js Gaussian Splatting renderer with WebGPU/WebGL2, GPU sorting, streaming LOD, and high-precision GIS/ECEF support. Supports PLY, SPZ, SOG and RAD.",
5
5
  "author": "William Liu <lyz15972107087@gmail.com>",
6
6
  "type": "module",
@@ -8,6 +8,9 @@
8
8
  "main": "./dist/gaussian-splat-lite.cjs",
9
9
  "module": "./dist/gaussian-splat-lite.module.js",
10
10
  "types": "./dist/types/index.d.mts",
11
+ "bin": {
12
+ "gsl-build-lod": "./bin/build-lod.js"
13
+ },
11
14
  "exports": {
12
15
  ".": {
13
16
  "import": {
@@ -27,9 +30,11 @@
27
30
  "build:site": "vite build --config vite.site.config.js",
28
31
  "build:types": "node scripts/check-declarations.js && node scripts/build-types.js",
29
32
  "build:wasm": "node rust/build_wasm.js",
33
+ "build:wasm:lod": "node rust/build_wasm.js --lod",
34
+ "build-lod": "node bin/build-lod.js",
30
35
  "check": "node scripts/check-js.js && tsc --noEmit && node scripts/check-declarations.js",
31
36
  "check:rust": "cargo fmt --manifest-path rust/Cargo.toml --all -- --check",
32
- "clean": "rm -rf dist/ node_modules/ rust/target/ rust/gaussian-splat-rs/pkg/",
37
+ "clean": "rm -rf dist/ bin/decoder/ node_modules/ rust/target/ rust/gaussian-splat-rs/pkg/",
33
38
  "dev": "vite --config vite.site.config.js --host",
34
39
  "format": "biome format .",
35
40
  "format:fix": "biome format . --fix",
@@ -44,6 +49,7 @@
44
49
  "test:rust": "cargo test --manifest-path rust/Cargo.toml --workspace --locked"
45
50
  },
46
51
  "files": [
52
+ "bin",
47
53
  "dist",
48
54
  "docs",
49
55
  "CHANGELOG.md",
@@ -76,7 +82,7 @@
76
82
  "publint": "0.3.24",
77
83
  "three": "0.186.0",
78
84
  "typescript": "^5.7.3",
79
- "vite": "^6.0.11",
85
+ "vite": "^6.4.4",
80
86
  "vite-plugin-arraybuffer": "^0.1.4",
81
87
  "vite-plugin-glsl": "^1.3.1"
82
88
  },