@d5techs/3dgs-lib 1.4.19 → 1.4.20

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,18 +1,23 @@
1
1
  /**
2
2
  * SOGEncoder - 将 CompactSplatData 编码为 SOG v2 格式
3
3
  *
4
- * SOG PlayCanvas 的压缩容器格式,本质是 ZIP 包含 meta.json + WebP 图像
5
- * 编码步骤:
6
- * 1. Morton 空间排序(提升渲染时缓存命中率)
4
+ * 完整移植 supersplat SOG 导出流程:
5
+ * 0. 坐标系逆变换(含 SH Wigner D-矩阵逆变换)
6
+ * 1. Morton 码空间排序
7
7
  * 2. 位置:对称对数变换 → 16-bit 量化 → 拆分为 lower/upper 两张 WebP
8
8
  * 3. 缩放:k-means++ 构建 256 codebook → 量化 → WebP
9
9
  * 4. 四元数:smallest-three 编码 → WebP
10
10
  * 5. DC 颜色 + 不透明度:codebook 量化 → WebP
11
+ * 6. 高阶 SH (L1-L3):k-means palette + codebook → centroids/labels WebP
11
12
  */
12
13
  import type { CompactSplatData, CoordinateSystem } from './PLYLoaderMobile';
14
+ export interface SOGEncodeOptions {
15
+ maxSHBands?: number;
16
+ iterations?: number;
17
+ paletteSize?: number;
18
+ }
13
19
  /**
14
20
  * @param coordinateSystem 内部数据的坐标系来源。
15
- * 'blender' 表示数据在加载时做过 Blender→WebGPU 变换,需要先做逆变换再编码。
16
- * 'webgpu' 表示数据已在 SOG 原生坐标系,直接编码。
21
+ * @param options SOG 编码选项
17
22
  */
18
- export declare function serializeSOG(data: CompactSplatData, coordinateSystem?: CoordinateSystem): Promise<ArrayBuffer>;
23
+ export declare function serializeSOG(data: CompactSplatData, coordinateSystem?: CoordinateSystem, options?: SOGEncodeOptions): Promise<ArrayBuffer>;
package/dist/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export { loadSplat, deserializeSplat } from './gs/SplatLoader';
29
29
  export { loadSOG, deserializeSOG } from './gs/SOGLoader';
30
30
  export type { SOGProgressCallback } from './gs/SOGLoader';
31
31
  export { serializeSOG } from './gs/SOGEncoder';
32
+ export type { SOGEncodeOptions } from './gs/SOGEncoder';
32
33
  export { GSSplatRenderer } from './gs/GSSplatRenderer';
33
34
  export { GSSplatSorter } from './gs/GSSplatSorter';
34
35
  export type { SorterOptions, CullingOptions, ScreenInfo } from './gs/GSSplatSorter';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d5techs/3dgs-lib",
3
- "version": "1.4.19",
3
+ "version": "1.4.20",
4
4
  "description": "可扩展的 WebGPU 3D 渲染引擎",
5
5
  "type": "module",
6
6
  "main": "./dist/3dgs-lib.cjs",