gaussian-splat-lite 1.3.1 → 1.3.2

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.
@@ -19,7 +19,7 @@ type DecodedSplatWithSh = DecodedSplat & {
19
19
  * Fades affect display only: records returned to picking retain their source opacity. */
20
20
  export declare abstract class IndexedSplats extends Splats {
21
21
  readonly layerSize: number;
22
- readonly numSh: 0 | 1 | 2 | 3;
22
+ readonly numSh: 0 | 1 | 2 | 3 | 4;
23
23
  protected readonly opacities: SplatOpacityTable;
24
24
  protected sourceIndices: Uint32Array<ArrayBuffer>;
25
25
  protected visibleIndices: Uint32Array;
@@ -55,7 +55,7 @@ export declare abstract class IndexedSplats extends Splats {
55
55
  private getStorageIndex;
56
56
  getSourceIndex(index: number): number;
57
57
  private checkVisibleRange;
58
- getNumSh(): 0 | 3 | 2 | 1;
58
+ getNumSh(): 0 | 1 | 2 | 3 | 4;
59
59
  /** Estimated GPU storage for packed records, render indices and opacity tables. */
60
60
  get textureByteLength(): number;
61
61
  getByteLength(): number;
@@ -19,7 +19,7 @@ type DecodedSplatWithSh = DecodedSplat & {
19
19
  * Fades affect display only: records returned to picking retain their source opacity. */
20
20
  export declare abstract class IndexedSplats extends Splats {
21
21
  readonly layerSize: number;
22
- readonly numSh: 0 | 1 | 2 | 3;
22
+ readonly numSh: 0 | 1 | 2 | 3 | 4;
23
23
  protected readonly opacities: SplatOpacityTable;
24
24
  protected sourceIndices: Uint32Array<ArrayBuffer>;
25
25
  protected visibleIndices: Uint32Array;
@@ -55,7 +55,7 @@ export declare abstract class IndexedSplats extends Splats {
55
55
  private getStorageIndex;
56
56
  getSourceIndex(index: number): number;
57
57
  private checkVisibleRange;
58
- getNumSh(): 0 | 3 | 2 | 1;
58
+ getNumSh(): 0 | 1 | 2 | 3 | 4;
59
59
  /** Estimated GPU storage for packed records, render indices and opacity tables. */
60
60
  get textureByteLength(): number;
61
61
  getByteLength(): number;
@@ -55,7 +55,7 @@ export declare class Splats {
55
55
  getNumSplats(): number;
56
56
  /** @internal Copy cached local bounds into the target box. */
57
57
  getBoundingBox(centersOnly?: boolean, target?: THREE.Box3): THREE.Box3;
58
- getNumSh(): 1 | 2 | 0 | 3;
58
+ getNumSh(): 0 | 1 | 2 | 3 | 4;
59
59
  /** Current retained bytes for encoded Splat, sort-center, and SH arrays. */
60
60
  getByteLength(): number;
61
61
  /** @internal Consume owned arrays for transfer to a streaming worker. */
@@ -55,7 +55,7 @@ export declare class Splats {
55
55
  getNumSplats(): number;
56
56
  /** @internal Copy cached local bounds into the target box. */
57
57
  getBoundingBox(centersOnly?: boolean, target?: THREE.Box3): THREE.Box3;
58
- getNumSh(): 1 | 2 | 0 | 3;
58
+ getNumSh(): 0 | 1 | 2 | 3 | 4;
59
59
  /** Current retained bytes for encoded Splat, sort-center, and SH arrays. */
60
60
  getByteLength(): number;
61
61
  /** @internal Consume owned arrays for transfer to a streaming worker. */
@@ -12,10 +12,12 @@ export declare enum SplatFileType {
12
12
  RAD = "rad",
13
13
  }
14
14
  export type SplatExtra = {
15
- sh1?: Uint32Array;
16
- sh2?: Uint32Array;
17
- sh3a?: Uint32Array;
18
- sh3b?: Uint32Array;
15
+ shBlock0?: Uint32Array;
16
+ shBlock1?: Uint32Array;
17
+ shBlock2?: Uint32Array;
18
+ shBlock3?: Uint32Array;
19
+ shBlock4?: Uint32Array;
20
+ shBlock5?: Uint32Array;
19
21
  };
20
22
  /** Morton storage records per cached spatial bounds block. */
21
23
  export declare const SPLAT_BOUNDS_BLOCK_SIZE = 256;
@@ -12,10 +12,12 @@ export declare enum SplatFileType {
12
12
  RAD = "rad",
13
13
  }
14
14
  export type SplatExtra = {
15
- sh1?: Uint32Array;
16
- sh2?: Uint32Array;
17
- sh3a?: Uint32Array;
18
- sh3b?: Uint32Array;
15
+ shBlock0?: Uint32Array;
16
+ shBlock1?: Uint32Array;
17
+ shBlock2?: Uint32Array;
18
+ shBlock3?: Uint32Array;
19
+ shBlock4?: Uint32Array;
20
+ shBlock5?: Uint32Array;
19
21
  };
20
22
  /** Morton storage records per cached spatial bounds block. */
21
23
  export declare const SPLAT_BOUNDS_BLOCK_SIZE = 256;
@@ -1,6 +1,13 @@
1
1
  import type { SplatExtra } from "./defines.cjs";
2
- export declare const SH_KEYS: readonly ["sh1", "sh2", "sh3a", "sh3b"];
3
- export declare const SH_ARRAY_COUNTS: readonly [0, 1, 2, 4];
2
+ export declare const SH_KEYS: readonly [
3
+ "shBlock0",
4
+ "shBlock1",
5
+ "shBlock2",
6
+ "shBlock3",
7
+ "shBlock4",
8
+ "shBlock5",
9
+ ];
10
+ export declare const SH_ARRAY_COUNTS: readonly [0, 1, 2, 4, 6];
4
11
  /** Merge cached min XYZ / max XYZ values without decoding records. */
5
12
  export declare function unionSplatBounds(
6
13
  target: Float32Array,
@@ -8,7 +15,7 @@ export declare function unionSplatBounds(
8
15
  offset?: number,
9
16
  ): void;
10
17
  export declare function resetSplatBounds(bounds: Float32Array): void;
11
- export declare function getSplatShDegree(extra: SplatExtra): 1 | 2 | 0 | 3;
18
+ export declare function getSplatShDegree(extra: SplatExtra): 0 | 1 | 2 | 3 | 4;
12
19
  /** Packed texture storage; capacity includes padding, but excludes sort centers. */
13
20
  export declare function getSplatTextureBytes(
14
21
  capacity: number,
@@ -1,6 +1,13 @@
1
1
  import type { SplatExtra } from "./defines.js";
2
- export declare const SH_KEYS: readonly ["sh1", "sh2", "sh3a", "sh3b"];
3
- export declare const SH_ARRAY_COUNTS: readonly [0, 1, 2, 4];
2
+ export declare const SH_KEYS: readonly [
3
+ "shBlock0",
4
+ "shBlock1",
5
+ "shBlock2",
6
+ "shBlock3",
7
+ "shBlock4",
8
+ "shBlock5",
9
+ ];
10
+ export declare const SH_ARRAY_COUNTS: readonly [0, 1, 2, 4, 6];
4
11
  /** Merge cached min XYZ / max XYZ values without decoding records. */
5
12
  export declare function unionSplatBounds(
6
13
  target: Float32Array,
@@ -8,7 +15,7 @@ export declare function unionSplatBounds(
8
15
  offset?: number,
9
16
  ): void;
10
17
  export declare function resetSplatBounds(bounds: Float32Array): void;
11
- export declare function getSplatShDegree(extra: SplatExtra): 1 | 2 | 0 | 3;
18
+ export declare function getSplatShDegree(extra: SplatExtra): 0 | 1 | 2 | 3 | 4;
12
19
  /** Packed texture storage; capacity includes padding, but excludes sort centers. */
13
20
  export declare function getSplatTextureBytes(
14
21
  capacity: number,
@@ -69,7 +69,7 @@ type AttributeValue<Components extends AttributeComponents> =
69
69
  : Vec4Value;
70
70
  type SplatShCoefficientContext = {
71
71
  index: number;
72
- degree: 1 | 2 | 3;
72
+ degree: 1 | 2 | 3 | 4;
73
73
  order: number;
74
74
  };
75
75
  declare class SplatPostDecodeShPatch {
@@ -69,7 +69,7 @@ type AttributeValue<Components extends AttributeComponents> =
69
69
  : Vec4Value;
70
70
  type SplatShCoefficientContext = {
71
71
  index: number;
72
- degree: 1 | 2 | 3;
72
+ degree: 1 | 2 | 3 | 4;
73
73
  order: number;
74
74
  };
75
75
  declare class SplatPostDecodeShPatch {
@@ -67,7 +67,7 @@ export declare const InputField: {
67
67
  /** @internal */
68
68
  export type InputField = (typeof InputField)[keyof typeof InputField];
69
69
  /** @internal */
70
- export declare const SH_COEFFICIENT_COUNT = 15;
70
+ export declare const SH_COEFFICIENT_COUNT = 24;
71
71
  /** @internal */
72
72
  export type SplatPostDecodeValueType =
73
73
  | "float"
@@ -184,8 +184,10 @@ export type PostDecodeSplatData = {
184
184
  splat1: Uint32Array;
185
185
  sortCenters: Float32Array;
186
186
  sourceIds?: Uint32Array;
187
- sh1?: Uint32Array;
188
- sh2?: Uint32Array;
189
- sh3a?: Uint32Array;
190
- sh3b?: Uint32Array;
187
+ shBlock0?: Uint32Array;
188
+ shBlock1?: Uint32Array;
189
+ shBlock2?: Uint32Array;
190
+ shBlock3?: Uint32Array;
191
+ shBlock4?: Uint32Array;
192
+ shBlock5?: Uint32Array;
191
193
  };
@@ -67,7 +67,7 @@ export declare const InputField: {
67
67
  /** @internal */
68
68
  export type InputField = (typeof InputField)[keyof typeof InputField];
69
69
  /** @internal */
70
- export declare const SH_COEFFICIENT_COUNT = 15;
70
+ export declare const SH_COEFFICIENT_COUNT = 24;
71
71
  /** @internal */
72
72
  export type SplatPostDecodeValueType =
73
73
  | "float"
@@ -184,8 +184,10 @@ export type PostDecodeSplatData = {
184
184
  splat1: Uint32Array;
185
185
  sortCenters: Float32Array;
186
186
  sourceIds?: Uint32Array;
187
- sh1?: Uint32Array;
188
- sh2?: Uint32Array;
189
- sh3a?: Uint32Array;
190
- sh3b?: Uint32Array;
187
+ shBlock0?: Uint32Array;
188
+ shBlock1?: Uint32Array;
189
+ shBlock2?: Uint32Array;
190
+ shBlock3?: Uint32Array;
191
+ shBlock4?: Uint32Array;
192
+ shBlock5?: Uint32Array;
191
193
  };
@@ -43,9 +43,9 @@ Read these from `splat`:
43
43
  | `splat.opacity` | `float` | Opacity as stored in the model, which can be above 1 |
44
44
  | `splat.alpha` | `float` | Opacity from 0 (transparent) to 1 (opaque) |
45
45
  | `splat.color` | `vec3` | RGB color |
46
- | `splat.sh.coefficient(index)` | `vec3` | One of the 15 view-dependent color coefficients |
46
+ | `splat.sh.coefficient(index)` | `vec3` | One of the 24 view-dependent color coefficients (indices 0–23, SH1–SH4) |
47
47
 
48
- `splat.sh.map((coefficient, { degree }) => ...)` builds a calculation for all 15 coefficients at once. Only the ones the model has are updated.
48
+ `splat.sh.map((coefficient, { degree }) => ...)` builds a calculation for all 24 coefficients at once. Only the ones the model has are updated.
49
49
 
50
50
  ## Returning changes
51
51
 
@@ -11,6 +11,8 @@ The model formats you can load:
11
11
  | `SplatFileType.SOG` | `"sog"` | `.sog`, or a SOG `meta.json` with its images |
12
12
  | `SplatFileType.RAD` | `"rad"` | `.rad` |
13
13
 
14
+ PLY and SPZ support view-dependent color up to SH4 on WebGL, WebGPU, and the WebGL2 fallback. RAD and SOG support up to SH3. Models render all their available coefficients by default; set [`mesh.maxSh`](SplatMesh.md#properties) to limit the degree.
15
+
14
16
  The format is normally detected from the URL or `fileName`, so you rarely need this. Set it when the name does not show the format:
15
17
 
16
18
  ```js
package/docs/SplatMesh.md CHANGED
@@ -59,7 +59,7 @@ Choose at most one of `url`, `file`, `fileBytes`, or `splats`; combining them th
59
59
  | `numSplats` | `number` | Current Splat count |
60
60
  | `recolor` | `THREE.Color(1, 1, 1)` | Color multiplier for the whole model |
61
61
  | `opacity` | `1` | Opacity multiplier for the whole model |
62
- | `maxSh` | `3` | Limit view-dependent color detail; `0` uses the base color only |
62
+ | `maxSh` | `4` | Limit view-dependent color detail to SH0–SH4; `0` uses the base color only |
63
63
  | `edits` | `SplatEdit[] \| null` | Explicit list of [edits](SplatEdit.md) for this mesh |
64
64
  | `splats` | `Splats \| undefined` | The model's [Splats](Splats.md) data |
65
65
  | `needsUpdate` | `boolean` setter | Set to `true` to force a refresh |
package/docs/Splats.md CHANGED
@@ -49,7 +49,7 @@ Calling `initialize()` again or `dispose()` cancels a load still in progress; it
49
49
  ## Data rules
50
50
 
51
51
  - **Indices are not file order.** Splats are reordered while loading. Use `getSourceIndex(index)`, or a picking hit's `sourceIndex`, to get the ID from the original file. Passing existing `Splats` to a mesh keeps their order.
52
- - **Reads return copies.** `getSplat()` returns new `center`, `scales`, `quaternion`, `opacity`, `color`, and `sh` values on each call; changing them does not change the model. `sh` holds 0, 3, 8, or 15 RGB coefficients, depending on the model's degree.
52
+ - **Reads return copies.** `getSplat()` returns new `center`, `scales`, `quaternion`, `opacity`, `color`, and `sh` values on each call; changing them does not change the model. `sh` holds 0, 3, 8, 15, or 24 RGB coefficients, depending on the model's degree (SH0–SH4).
53
53
  - **`forEachSplat()` reuses its objects.** The same objects are passed for every Splat, so clone anything you want to keep after the callback returns.
54
54
  - **Streamed data is read-only.** Data from [RadStreamScheduler](RadStreamScheduler.md) or [SogStreamScheduler](SogStreamScheduler.md) cannot be reinitialized.
55
55
  - **Bounds live on the mesh.** Use [`mesh.getBoundingBox()`](SplatMesh.md#bounding-box).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaussian-splat-lite",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
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",