@playcanvas/splat-transform 2.0.3 → 2.0.5

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.
Files changed (35) hide show
  1. package/README.md +112 -24
  2. package/dist/cli.mjs +6742 -3734
  3. package/dist/cli.mjs.map +1 -1
  4. package/dist/index.cjs +6683 -3664
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.mjs +6683 -3664
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/lib/gpu/gpu-dilation.d.ts +87 -0
  9. package/dist/lib/gpu/gpu-voxelization.d.ts +2 -1
  10. package/dist/lib/gpu/index.d.ts +1 -0
  11. package/dist/lib/index.d.cts +1 -1
  12. package/dist/lib/index.d.ts +1 -1
  13. package/dist/lib/io/write/memory-file-system.d.ts +1 -1
  14. package/dist/lib/mesh/index.d.ts +2 -1
  15. package/dist/lib/mesh/marching-cubes.d.ts +19 -6
  16. package/dist/lib/mesh/voxel-faces.d.ts +18 -0
  17. package/dist/lib/spatial/gaussian-bvh.d.ts +34 -0
  18. package/dist/lib/types.d.ts +10 -3
  19. package/dist/lib/utils/math.d.ts +2 -1
  20. package/dist/lib/voxel/block-cleanup.d.ts +6 -3
  21. package/dist/lib/voxel/block-mask-buffer.d.ts +18 -19
  22. package/dist/lib/voxel/block-mask-map.d.ts +5 -0
  23. package/dist/lib/voxel/carve.d.ts +3 -2
  24. package/dist/lib/voxel/dilation.d.ts +12 -15
  25. package/dist/lib/voxel/fill-exterior.d.ts +4 -3
  26. package/dist/lib/voxel/fill-floor.d.ts +10 -6
  27. package/dist/lib/voxel/flood-fill.d.ts +4 -1
  28. package/dist/lib/voxel/grid-ops.d.ts +2 -1
  29. package/dist/lib/voxel/morton.d.ts +1 -17
  30. package/dist/lib/voxel/sparse-voxel-grid.d.ts +52 -5
  31. package/dist/lib/voxel/voxel-query.d.ts +14 -9
  32. package/dist/lib/writers/collision-glb.d.ts +7 -8
  33. package/dist/lib/writers/sparse-octree.d.ts +15 -14
  34. package/dist/lib/writers/write-voxel.d.ts +14 -5
  35. package/package.json +1 -1
package/README.md CHANGED
@@ -69,7 +69,7 @@ splat-transform [GLOBAL] input [ACTIONS] ... output [ACTIONS]
69
69
 
70
70
  ## Actions
71
71
 
72
- Actions can be repeated and applied in any order:
72
+ Actions execute in the order specified and can be repeated. Any action may appear after any input or output file:
73
73
 
74
74
  ```none
75
75
  -t, --translate <x,y,z> Translate Gaussians by (x, y, z)
@@ -89,17 +89,19 @@ Actions can be repeated and applied in any order:
89
89
  Use n% to keep a percentage of Gaussians
90
90
  -G, --filter-floaters [size,op,min] Remove Gaussians not contributing to any solid voxel.
91
91
  Evaluates each Gaussian at occupied voxel centers.
92
- Default: size=0.05, opacity=0.1, min=0.004 (1/255)
92
+ Default: size=0.05, opacity=0.1, min=0.004 (1/255).
93
+ Bare flag (no value) uses all defaults.
93
94
  -D, --filter-cluster [res,op,min] Keep only the connected cluster at --seed-pos.
94
95
  GPU-voxelizes at coarse resolution (res world units/voxel).
95
- Default: res=1.0, opacity=0.999, min=0.1
96
+ Default: res=1.0, opacity=0.999, min=0.1.
97
+ Bare flag (no value) uses all defaults.
96
98
  -p, --params <key=val,...> Pass parameters to .mjs generator script
97
- -l, --lod <n> Specify the level of detail, n >= 0
99
+ -l, --lod <n> Tag the Gaussians with LOD level n (n >= 0)
98
100
  -m, --summary Print per-column statistics to stdout
99
101
  -M, --morton-order Reorder Gaussians by Morton code (Z-order curve)
100
102
  ```
101
103
 
102
- ## Global Options
104
+ ## General Options
103
105
 
104
106
  ```none
105
107
  -h, --help Show this help and exit
@@ -109,29 +111,80 @@ Actions can be repeated and applied in any order:
109
111
  --mem Show memory usage in progress output
110
112
  --tty Interactive bar rendering (default on a TTY; --no-tty to disable)
111
113
  -w, --overwrite Overwrite output file if it exists
112
- -i, --iterations <n> Iterations for SOG SH compression (more=better). Default: 10
114
+ ```
115
+
116
+ ## GPU Options
117
+
118
+ Used by SOG compression and GPU voxelization (`--filter-cluster`, `--filter-floaters`, `.voxel.json` output).
119
+
120
+ ```none
113
121
  -L, --list-gpus List available GPU adapters and exit
114
- -g, --gpu <n|cpu> Select device for SOG compression: GPU adapter index | 'cpu'
122
+ -g, --gpu <n|cpu> Device for GPU operations: GPU adapter index | 'cpu'
123
+ ('cpu' disables GPU and is incompatible with
124
+ GPU-only features like --filter-cluster)
125
+ ```
126
+
127
+ ## SOG Compression Options
128
+
129
+ Apply when writing `.sog`, `meta.json`, `lod-meta.json`, or `.html` outputs.
130
+
131
+ ```none
132
+ -i, --iterations <n> Iterations for SH compression (more=better). Default: 10
133
+ ```
134
+
135
+ ## HTML Viewer Output Options
136
+
137
+ Apply when writing `.html` outputs.
138
+
139
+ ```none
115
140
  -E, --viewer-settings <settings.json> HTML viewer settings JSON file
116
141
  -U, --unbundled Generate unbundled HTML viewer with separate files
142
+ ```
143
+
144
+ > [!NOTE]
145
+ > See the [SuperSplat Viewer Settings Schema](https://github.com/playcanvas/supersplat-viewer?tab=readme-ov-file#settings-schema) for details on how to pass data to the `-E` option.
146
+
147
+ ## LCC Input Options
148
+
149
+ Apply when reading `.lcc` files.
150
+
151
+ ```none
117
152
  -O, --lod-select <n,n,...> Comma-separated LOD levels to read from LCC input
153
+ ```
154
+
155
+ ## LOD Output Options
156
+
157
+ Apply when writing `lod-meta.json` (multi-LOD streaming SOG bundle).
158
+
159
+ ```none
118
160
  -C, --lod-chunk-count <n> Approximate number of Gaussians per LOD chunk in K. Default: 512
119
161
  -X, --lod-chunk-extent <n> Approximate size of an LOD chunk in world units (m). Default: 16
120
- --voxel-params [size,opacity] Voxel size and opacity threshold for .voxel.json. Default: 0.05,0.1
121
- --voxel-external-fill [size] Fill exterior voxels by dilation from seed. Default size: 1.6
122
- --voxel-floor-fill [radius] Fill each column upward from bottom until hitting solid (runs before carve).
162
+ ```
163
+
164
+ ## Voxel Output Options
165
+
166
+ Apply when writing `.voxel.json` (sparse voxel octree for collision detection). See the [Collision Mesh Guide](guides/COLLISION.md) for a deep dive on each step and tuning.
167
+
168
+ ```none
169
+ --voxel-params [size,opacity] Voxel size and opacity threshold. Default: 0.05,0.1
170
+ --voxel-external-fill [size] Seal exterior voxels via boundary flood fill (interior scenes).
171
+ [size] (world units) is the dilation distance applied
172
+ before the flood fill to bridge small wall gaps.
173
+ --seed-pos is used to verify the volume is enclosed at
174
+ the seed; the fill is skipped if the seed is reachable
175
+ from outside.
176
+ Default size: 1.6
177
+ --voxel-floor-fill [radius] Fill each column upward from bottom until hitting solid (exterior scenes).
123
178
  Optional radius (world units): only patch XZ areas surrounded by floor
124
179
  within 2*radius; large empty exterior areas are left alone.
125
180
  Default radius: 1.6
126
- --voxel-carve [h,r] Carve navigable space using capsule flood fill from seed.
181
+ --voxel-carve [h,r] Carve navigable space using capsule flood fill from seed.
127
182
  Default: height=1.6, radius=0.2
128
- --seed-pos <x,y,z> Seed position for voxel processing and --filter-cluster. Default: 0,0,0
129
- -K, --collision-mesh Generate collision mesh (.collision.glb) from the voxel output.
183
+ --seed-pos <x,y,z> Seed position for voxel fill/carve and --filter-cluster.
184
+ Default: 0,0,0
185
+ -K, --collision-mesh [smooth|faces] Generate collision mesh (.collision.glb). Default: smooth
130
186
  ```
131
187
 
132
- > [!NOTE]
133
- > See the [SuperSplat Viewer Settings Schema](https://github.com/playcanvas/supersplat-viewer?tab=readme-ov-file#settings-schema) for details on how to pass data to the `-E` option.
134
-
135
188
  ## Examples
136
189
 
137
190
  ### Basic Operations
@@ -244,20 +297,55 @@ splat-transform gen-grid.mjs -p width=10,height=10,scale=10,color=0.1 scenes/gri
244
297
 
245
298
  ### Voxel Format
246
299
 
247
- The voxel format stores sparse voxel octree data for collision detection. It consists of two files: `.voxel.json` (metadata) and `.voxel.bin` (binary octree data).
300
+ The voxel format stores sparse voxel octree data for collision detection. It consists of two files: `.voxel.json` (metadata) and `.voxel.bin` (binary octree data). Pass `-K` to also emit a `.collision.glb` mesh derived from the voxel grid.
301
+
302
+ For a step-by-step walkthrough of each option (with illustrations), see the [Collision Mesh Guide](guides/COLLISION.md).
303
+
304
+ #### Recommended pipeline
248
305
 
249
306
  ```bash
250
- # Generate voxel collision data from a splat file
251
- splat-transform input.ply output.voxel.json
307
+ splat-transform input.ply \
308
+ --filter-cluster --seed-pos x,y,z \
309
+ [--voxel-external-fill | --voxel-floor-fill] [--voxel-carve] \
310
+ [-K [smooth|faces]] \
311
+ output.voxel.json
312
+ ```
252
313
 
253
- # Generate voxel data with custom resolution and opacity threshold
254
- splat-transform --voxel-params 0.1,0.3 input.ply output.voxel.json
314
+ `--filter-cluster` isolates the central scene and discards stray floaters before voxelization. `--seed-pos` is shared by `--filter-cluster` and the voxel fill/carve passes — set it once to a known-walkable point inside the scene.
315
+
316
+ #### Interior scenes (rooms, indoor scans)
255
317
 
256
- # Generate voxel data with exterior fill and carve
257
- splat-transform --voxel-external-fill --voxel-carve input.ply output.voxel.json
318
+ Use `--voxel-external-fill` to seal the void around the room interior, then `--voxel-carve` to hollow out the navigable space:
258
319
 
259
- # Generate voxel data with custom seed position and carve parameters
320
+ ```bash
321
+ splat-transform room.ply \
322
+ --filter-cluster --seed-pos 0,1,0 \
323
+ --voxel-external-fill --voxel-carve \
324
+ -K room.voxel.json
325
+ ```
326
+
327
+ #### Exterior scenes (outdoor objects, terrain)
328
+
329
+ Use `--voxel-floor-fill` to fill the ground beneath surfaces, optionally followed by `--voxel-carve`:
330
+
331
+ ```bash
332
+ splat-transform terrain.ply \
333
+ --filter-cluster --seed-pos 0,0,0 \
334
+ --voxel-floor-fill \
335
+ -K terrain.voxel.json
336
+ ```
337
+
338
+ #### Other examples
339
+
340
+ ```bash
341
+ # Voxelize with custom resolution and opacity threshold
342
+ splat-transform --voxel-params 0.1,0.3 input.ply output.voxel.json
343
+
344
+ # Custom carve capsule (height, radius)
260
345
  splat-transform --seed-pos 1,0,0 --voxel-carve 2.0,0.3 input.ply output.voxel.json
346
+
347
+ # Watertight voxel-face collision mesh
348
+ splat-transform -K faces input.ply output.voxel.json
261
349
  ```
262
350
 
263
351
  ### Device Selection for SOG Compression